Minimal CLI for Cyclomatic Complexity and Maintainability Index
Project description
Oganesson
A simple python code quality checked built on top of Radon.
Why Oganesson?
Whereas radon provides a rich reporting CLI, it does not support CI out of the box. Xenon provides a CLI for using cyclomatic complexity metrics for a CI pipeline, however it doesn't offer other metrics.
Oganesson provides a minimal CLI to generate a simple Cyclomatic Complexity and Maintainability Index report for a codebase. It also provides a flag for CI use --trigger which raises an exception when any components of a codebase fall outside of the determined range.
In short, Oganesson makes a number of compromises to produce a very simple tool to get key metrics about a codebase, and use in a CI.
Installation
Oganesson can be installed from pypi:
pip install oganesson-py
This installs the oganesson CLI tool.
Usage
Currently oganesson intends only to provide the oganesson CLI tool:
$ oganesson --help
Usage: oganesson [OPTIONS] [PATHS]...
# Oganesson
A CLI for running quality metrics on Python code. Currently a wrapper
around Radon, with intent to add a few extra metrics in time.
Whereas radon has flake8 support, and xenon is designed to work in a CI for
cyclometric complexity, the maintainability index isn't supported in CI out
of the box. This tool produces a report to the stdout of all instances
which don't satisfy the thresholds set. If the trigger flag is set, the
tool will raise an exception (for CI, or in future commit hooks).
Options:
-a, --analysers [cc|mi] Choice of analysers [default: cc, mi]
--max-cc INTEGER Threshold for cyclomatic complexity
reporting. [default: 0]
--min-mi FLOAT Threshold for maintainability index
reporting in range [0, 100]. [default:
100.0]
--mi-multiline-comments BOOLEAN
Treat multi-line strings as comments for
maintainability reporting. [default: True]
-t, --trigger Raise an exception if quality thesholds are
breached.
--ignore TEXT Directories to ignore [default: venv,
.venv, .git]
--help Show this message and exit.
Simple Case - All Metrics
In the most simple case, to analyse all python files in the current directory, run oganesson. An analysis report will be sent the the stdout, listing all python files and the analysis metrics associated with each component of the file.
Choosing Analysers
To choose which analysers to use, use the analysers options, this can be cc or mi.
Filtered Metrics
By default, oganesson captures all components and outputs their cyclomatic complexity and maintainability index. To report only "poor" metrics, change the min-mi or max-cc.
For example oganesson --analysers cc --max-ci 5 will only report the cyclomatic complexity of components with a cyclomatic complexity greater than 5.
CI Usage
When used in a CI pipeline, use the --trigger flag to raise an exception if any of the thresholds are breached.
Note that by default the max-ci and min-mi thresholds will capture all possible values, so the job will fail in all cases. For this to be useful it should be used alongside the max-ci and min-mi options.
A good starting point would be oganesson --max-cc 10 --min-mi 20 --trigger
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file oganesson_py-0.1.1.tar.gz.
File metadata
- Download URL: oganesson_py-0.1.1.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6c49b35dc4b3489b9c23bfcd4738060d3d50ea7f5bc6f8a01ed9810cdc3b138
|
|
| MD5 |
966f3307f5f215c404ca47736898115b
|
|
| BLAKE2b-256 |
549ce8ecc7e86d5df33b5fff9cc572dcd48aa8ac18c8d5e32fe3edcdea2d23e2
|
File details
Details for the file oganesson_py-0.1.1-py3-none-any.whl.
File metadata
- Download URL: oganesson_py-0.1.1-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec17bb5ece2cd47a4af826b3f9ee7e574125fd175d7028aa800d712d20c4b76e
|
|
| MD5 |
e8d642f62ff22a01169d235b5e0491e9
|
|
| BLAKE2b-256 |
fcb83c352a4ecea4452ba0c2a83df71ff8486b7ca5d397174c1657749899c978
|