_images/logo.png

A Python application for tracking, reporting on timing and complexity in tests and applications.

Documentation Status https://badge.fury.io/py/wily.svg

Wily uses git to go through each revision (commit) in a branch and run complexity and code-analysis metrics over the code. You can use this to limit your code or report on trends for complexity, length etc.

What is wily?

Wily is a command-line tool for archiving, exploring and graphing the complexity of Python source code.

Wily supports iterating over a git repository and indexing the complexity of the Python source files using a number of algorithms. You can then report on those in the console or graph them to a browser.

Getting Started

You can install wily from PyPi using pip

$ pip install wily

Wily needs an index of the project before any of the commands can be used. Build Command builds an index in a Git repository. Provide the path to your source code as the first argument.

Warning

Before you run wily, add .wily/ to your .gitignore file and commit it. Wily will warn you if this is missing.

$ wily build src/
_images/wily_build1.png

You can provide multiple source directories, such as your test projects.

$ wily build src/ test/

See Build Command for more details on the build command.

Now that you have an index, you can run wily report or wily graph to see the data.

_images/wily_report1.png

You can display any of the metrics in a HTML graph by running the graph command with the path to the file and the metric

$ wily graph wily/__main__.py raw.loc
_images/single_metric_graph1.png

See Report Command and Graph Command for more details on the report and graph commands.

To get a list of available metrics, run:

$ wily list-metrics

Pre-commit hook

You can install wily as a pre-commit plugin.

repos:
-   repo: local
    hooks:
    -   id: wily
        name: wily
        entry: wily diff
        verbose: true
        language: python
        additional_dependencies: [wily]

“cute animal doing dabbing” [Designed by Freepik](https://www.freepik.com/free-vector/cute-animal-doing-dabbing_2462508.htm)