# Static Analysis

FSM2 is able to perform a static analysis on your state machine. The static analysis tool is able to detect a number of issues with your FSM including:

* States which cannot be reached
* Duplicate States
* Events which target an non-registered state.

To perform a static analysis I usually set up a unit tests. This allows me to manually run the static analysis with a single click on the unit test.

```dart
  test('export', () async {
    final machine = _createMachine();
    await machine.analyse();
  });
```

##


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://fsm2.onepub.dev/debugging-your-fsm/static-analysis.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
