Archeometer

Proof of concept work for analyzing Elixir code bases. Things like:

The goal is to give you an insight into how a project is organized and how it could be improved.

Work In Progress

Installation

For the time being, this package is not in Hex. To use it you can specify the Git repository directly. If you already use Credo, be sure to use at least the 1.6.6 version.

def deps do
[
{:archeometer, git: "https://gitlab.bunsan.io/RD/archeometer", only: [:dev, :test], runtime: false},
# and if you already use Credo, be sure to use at least the 1.6.6 version and add something like this
{:credo, "~> 1.6.6", only: [:dev, :test], runtime: false}
]
end

Or alternatively, you can clone this repository and add the dependency as a path: "path/to/the/repo" instead.

Setup for development

To use the correct Erlang and Elixir version we use asdf-vm. You need to run

asdf install

on the root of the repository.

To add the git hooks you must change the default hooks path to githooks using the following command

git config core.hooksPath .githooks

with this, before each commit the hook will find issues related with compilation errors and warnings, failures in tests, issues or warnings in Credo and a correct code formatting.

Third party dependencies

Some non Elixir dependencies are necessary:

Usage

Collecting Data

Data collection is divided in several phases, depending on the requirements of each phase. To collect all the data simply run

mix arch.explore

And a SQLite database will be created with all the collected data.

You can also run each phase individually. They are

Explore your project

There are some predefined tasks to give you a brief overview of the project.

Directly poke at the database

For everything else, you can always run queries directly into the generated database. For example, to get the top 10 modules with more lines you could run

select m.name, m.num_lines
from modules m
order by num_lines desc
limit 10;

There are plenty of more examples in the Wiki!