Since this is a tool about project discovery, first we have to collectall the data.
Collect the data
To collect all the data simply run
This will run all sorts of different analysis and store all the data in a
You can skip running tests (for example, it tests take too long to run or they are broken) and collecting coverage information with the
mix arch.explore --no-coverage
Under the hood, data collection is divided in several phases.
You can run each phase individually. They are
arch.explore.static: Analysis the AST of the project code. It requires Credo.
arch.explore.xrefs: Collects information about module dependencies. It forces a compilation.
arch.explore.apps: Get information about the applications in the project. It must compile the project.
arch.explore.ecto: Collects modules with Ecto schema and their associations.
arch.explore.coverage: Calculate test coverage per module and function. It must run the test suite.
Depending on your project, you can choose to run only the stages you are interested in, or to skip some stage that is specially expensive to run.
The only necessary stage is
arch.explore.static and it must be run before any other.
Include dependencies in the analysis
Some explore tasks can also gather information from dependencies, they are
To filter the dependencies you can use the flag
--include-deps and a unix-style glob pattern.
*matches none or many tokens
?matches exactly one token
[abc]matches a set of tokens
[a-z]matches a range of tokens
[!...]matches anything but a set of tokens
mix arch.explore.static --include-deps 'phoenix*'
This will target:
--include-deps can be passed more than once, the dependencies set will be the union of all the filters, example.
mix arch.explore.static --include-deps 'ecto*' --include-deps 'archeometer'
This will target:
There are some predefined tasks to give you a brief overview of the project.
mix arch.xref: Will create a dependency graph in several possible formats.
mix arch.dsm: Will create a Design Structure Matrix, and will use it to find the cyclic dependencies in the project.
mix arch.treemap: Will generate a treemap of the modules within an specific application.
mix arch.report.html: Creates a comprehensive report on the project under review.
If you want to have a more in depth exploration of your project, don't forget to read the following guides:
- Queries and Schemas: make queries to the data base using Elixir code