Skip to main content

Wily.

Project description

wily

A command-line application for tracking, reporting on complexity of Python tests and applications.

Build Status Build Status codecov Documentation Status PyPI version black

wily [a]:
quick to think of things, having a very good understanding of situations and possibilities, 
and often willing to use tricks to achieve an aim.

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.

Usage

See the Documentation Site for full usage guides.

Wily can be used via a command line interface, wily.

 $ wily --help
 

help-screen

pre-commit plugin

You can install wily as a pre-commit plugin by adding the following to .pre-commit-config.yaml

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

Command line usage

wily build

The first step to using wily is to build a wily cache with all of the statistics of your project.

Usage: __main__.py build [OPTIONS] [TARGETS]...

  Build the wily cache

Options:
  -n, --max-revisions INTEGER  The maximum number of historical commits to
                               archive
  -o, --operators TEXT         List of operators, separated by commas
  --help                       Show this message and exit.

By default, wily will assume your project folder is a git directory. Wily will not build a cache if the working copy is dirty (has changed files not commited).

 $ wily build src/

Limit the number of revisions (defaults to 50).

wily-build

wily report

Show a specific metric for a given file, requires that .wily/ exists

wily report will print the metric and the delta between each revision.

wily-report

wily graph

Similar to wily report but instead of printing in the console, wily will print a graph in a browser.

wily-graph

wily index

Show information about the build directory. Requires that .wily/ exists.

wily index will print the configuration to the screen and list all revisions that have been analysed and the operators used.

wily-graph

wily list-metrics

List the metrics available in the Wily operators. Each one of the metrics can be used in wily graph and wily report

 $ wily list-metrics
mccabe operator:
No metrics available
raw operator:
╒═════════════════╤══════════════════════╤═══════════════╤══════════════════════════╕
│                 │ Name                 │ Description   │ Type                     │
╞═════════════════╪══════════════════════╪═══════════════╪══════════════════════════╡
│ loc             │ Lines of Code        │ <class 'int'> │ MetricType.Informational │
├─────────────────┼──────────────────────┼───────────────┼──────────────────────────┤
│ lloc            │ L Lines of Code      │ <class 'int'> │ MetricType.Informational │
├─────────────────┼──────────────────────┼───────────────┼──────────────────────────┤
│ sloc            │ S Lines of Code      │ <class 'int'> │ MetricType.Informational │
├─────────────────┼──────────────────────┼───────────────┼──────────────────────────┤
│ comments        │ Multi-line comments  │ <class 'int'> │ MetricType.Informational │
├─────────────────┼──────────────────────┼───────────────┼──────────────────────────┤
│ multi           │ Multi lines          │ <class 'int'> │ MetricType.Informational │
├─────────────────┼──────────────────────┼───────────────┼──────────────────────────┤
│ blank           │ blank lines          │ <class 'int'> │ MetricType.Informational │
├─────────────────┼──────────────────────┼───────────────┼──────────────────────────┤
│ single_comments │ Single comment lines │ <class 'int'> │ MetricType.Informational │
╘═════════════════╧══════════════════════╧═══════════════╧══════════════════════════╛
cyclomatic operator:
No metrics available
maintainability operator:
╒══════╤═════════════════════════╤═════════════════╤══════════════════════════╕
│      │ Name                    │ Description     │ Type                     │
╞══════╪═════════════════════════╪═════════════════╪══════════════════════════╡
│ rank │ Maintainability Ranking │ <class 'str'>   │ MetricType.Informational │
├──────┼─────────────────────────┼─────────────────┼──────────────────────────┤
│ mi   │ Maintainability Index   │ <class 'float'> │ MetricType.AimLow        │
╘══════╧═════════════════════════╧═════════════════╧══════════════════════════╛

Configuration

You can put a wily.cfg file in your project directory and wily will override the runtime settings. Here are the available options:

# list of operators, choose from cyclomatic, maintainability, mccabe and raw
operators = cyclomatic,raw
# archiver to use, defaults to git
archiver = git
# path to analyse, defaults to .
path = /path/to/target
# max revisions to archive, defaults to 50
max_revisions = 20

You can also override the path to the configuration with the --config flag on the command-line.

Credits

"cute animal doing dabbing" Designed by Freepik

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wily-1.8.2.tar.gz (1.4 MB view details)

Uploaded Source

Built Distribution

wily-1.8.2-py3-none-any.whl (88.1 kB view details)

Uploaded Python 3

File details

Details for the file wily-1.8.2.tar.gz.

File metadata

  • Download URL: wily-1.8.2.tar.gz
  • Upload date:
  • Size: 1.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.20.1

File hashes

Hashes for wily-1.8.2.tar.gz
Algorithm Hash digest
SHA256 f410e1f1d0e5e578f19f55e9ed4fe3b1de1751823258e50b04f0ddc143ba95af
MD5 c8e7bf882642426c46bfdc86730b7e98
BLAKE2b-256 75b0e68183b4b05fb55c55540643f7c73d803ee32917042018bc58bfc8b05072

See more details on using hashes here.

File details

Details for the file wily-1.8.2-py3-none-any.whl.

File metadata

  • Download URL: wily-1.8.2-py3-none-any.whl
  • Upload date:
  • Size: 88.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.20.1

File hashes

Hashes for wily-1.8.2-py3-none-any.whl
Algorithm Hash digest
SHA256 87c379466a460eab69d8ffaf12da6c133278677f91a7a805df7d158a8a75cfa3
MD5 e2b2394f164276eff494a9a95ca2e3d0
BLAKE2b-256 7def1343a8d8d404f770e811c071d509435cf9a7cc48697ebb064d1301190443

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page