Code Monkey home page Code Monkey logo

xenon's Introduction

xenon

Travis-CI badge

Coveralls badge

PyPI latest version badge

Download format

Xenon license


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.

Installation

With Pip:

Or download the source and run the setup file (requires setuptools):

Xenon is tested with all versions of Python from 2.7 to 3.6 as well as PyPy.

Usage

Typically you would use Xenon in two scenarios:

  1. As a git commit hook: to make sure that your code never exceeds some complexity values.
  2. On a continuous integration server: as a part of your build, to keep under control, as above, your code's complexity. See Xenon's .travis.yml file for an example usage.

The command line

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:

  • -a, --max-average: Threshold for the average complexity (across all the codebase).
  • -m, --max-modules: Threshold for modules complexity.
  • -b, --max-absolute: Absolute threshold for block complexity.

All of these options are inclusive.

An actual example

or, more succinctly:

With these options Xenon will exit with a non-zero exit code if any of the following conditions is met:

  • At least one block has a rank higher than B (i.e. C, D, E or F).
  • At least one module has a rank higher than A.
  • The average complexity (among all of the analyzed blocks) is ranked with B or higher.

Other resources

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:

xenon's People

Contributors

danilito19 avatar davegallant avatar dougthor42 avatar dsch avatar idmitrievsky avatar lucomsky avatar rubik avatar tsunammis avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.