Skip to main content

No project description provided

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


Download files

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

Source Distribution

oganesson_py-0.1.0a2.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oganesson_py-0.1.0a2-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file oganesson_py-0.1.0a2.tar.gz.

File metadata

  • Download URL: oganesson_py-0.1.0a2.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

Hashes for oganesson_py-0.1.0a2.tar.gz
Algorithm Hash digest
SHA256 26e888a07344105dad98a3f8ef11c5d313974ee826c8709c24269b30ab1d46a9
MD5 b813a881f28edf0427696e6eff0ae0c8
BLAKE2b-256 6d8e4757fcebf582de79e57e45ee408548b00ede5566d95df7c95bbd6bcb3a2d

See more details on using hashes here.

File details

Details for the file oganesson_py-0.1.0a2-py3-none-any.whl.

File metadata

  • Download URL: oganesson_py-0.1.0a2-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for oganesson_py-0.1.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 8316dbaafb981bacb6c47460400cca8f3a6141fea9a4e51ffce196cedfafaf1c
MD5 77f2f4dcb43b7504886c4ac3ac6f6804
BLAKE2b-256 18b929888c1553130b68c98950b367d789191719ee55b890d26ddb2b274f198e

See more details on using hashes here.

Supported by

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