Monitor code metrics for Python on your CI server
Xenon is a monitoring tool based on Radon. It monitors your code’s complexity. Ideally, Xenon is run every time you commit code. Through command line options, you can set various thresholds for the complexity of your code. It will fail (i.e. it will exit with a non-zero exit code) when any of these requirements is not met.
$ pip install xenon
Or download the source and run the setup file (requires setuptools):
$ python setup.py install
Xenon is tested with all versions of Python from 2.7 to 3.6 as well as PyPy.
Typically you would use Xenon in two scenarios:
Everything boils down to Xenon’s command line usage. To control which files are analyzed, you use the options -e, --exclude and -i, --ignore. Both accept a comma-separated list of glob patterns. The value usually needs quoting at the command line, to prevent the shell from expanding the pattern (in case there is only one). Every filename is matched against the exclude patterns. Every directory name is matched against the ignore patterns. If any of the patterns matches, Xenon won’t even descend into them.
The actual threshold values are defined through these options:
All of these options are inclusive.
$ xenon --max-absolute B --max-modules A --max-average A
or, more succinctly:
$ xenon -b B -m A -a A
With these options Xenon will exit with a non-zero exit code if any of the following conditions is met:
For more information regarding cyclomatic complexity and static analysis in Python, please refer to Radon’s documentation, the project on which Xenon is based on:
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|File Name & Checksum SHA256 Checksum Help||Version||File Type||Upload Date|
|xenon-0.5.2-py2.py3-none-any.whl (9.8 kB) Copy SHA256 Checksum SHA256||3.6||Wheel||Jun 21, 2017|
|xenon-0.5.2.tar.gz (6.7 kB) Copy SHA256 Checksum SHA256||–||Source||Jun 21, 2017|