xenon


Namexenon JSON
Version 0.9.3 PyPI version JSON
download
home_pagehttps://xenon.readthedocs.org/
SummaryMonitor code metrics for Python on your CI server
upload_time2024-10-21 10:27:53
maintainerNone
docs_urlNone
authorMichele Lacchia
requires_pythonNone
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            xenon
=====

.. image:: https://img.shields.io/coveralls/rubik/xenon/master.svg
    :alt: Coveralls badge
    :target: https://coveralls.io/r/rubik/xenon?branch=master

.. image:: https://img.shields.io/pypi/v/xenon.svg
    :alt: PyPI latest version badge
    :target: https://pypi.python.org/pypi/xenon/

.. image:: https://img.shields.io/pypi/format/xenon.svg
    :alt: Download format
    :target: http://pythonwheels.com/

.. image:: https://img.shields.io/pypi/l/xenon.svg
    :alt: Xenon license
    :target: https://pypi.python.org/pypi/xenon/


----

Xenon is a monitoring tool based on `Radon <https://github.com/rubik/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:

.. code-block:: sh

   $ pip install xenon

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

.. code-block:: sh

   $ python setup.py install

Xenon is tested with Python versions **2.7** and **3.6** to **3.12** 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
+++++++++++++++++

.. code-block:: sh

   $ xenon --max-absolute B --max-modules A --max-average A

or, more succinctly:

.. code-block:: sh

   $ 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:

* 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.

Pre-commit hook
+++++++++++++++

Xenon can be used in combination with `pre-commit <https://pre-commit.com/>`_ as follows:

.. code-block:: yaml

    # monitor code complexity
    - repo: https://github.com/rubik/xenon
      rev: v0.9.0
      hooks:
      - id: xenon
        args: ['--max-absolute=B', '--max-modules=B', '--max-average=A']

Note: due to how options are passed to commands by pre-commit, make sure to
pass values either with an equals sign like in the above example, or by
splitting them as separate list items, e.g. ``['--max-absolute', 'B']``.

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:

* More on cyclomatic complexity:
  http://radon.readthedocs.org/en/latest/intro.html
* More on Radon's ranking:
  http://radon.readthedocs.org/en/latest/commandline.html#the-cc-command


.. _.travis.yml file: https://github.com/rubik/xenon/blob/master/.travis.yml

            

Raw data

            {
    "_id": null,
    "home_page": "https://xenon.readthedocs.org/",
    "name": "xenon",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Michele Lacchia",
    "author_email": "michelelacchia@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c4/7c/2b341eaeec69d514b635ea18481885a956d196a74322a4b0942ef0c31691/xenon-0.9.3.tar.gz",
    "platform": "any",
    "description": "xenon\n=====\n\n.. image:: https://img.shields.io/coveralls/rubik/xenon/master.svg\n    :alt: Coveralls badge\n    :target: https://coveralls.io/r/rubik/xenon?branch=master\n\n.. image:: https://img.shields.io/pypi/v/xenon.svg\n    :alt: PyPI latest version badge\n    :target: https://pypi.python.org/pypi/xenon/\n\n.. image:: https://img.shields.io/pypi/format/xenon.svg\n    :alt: Download format\n    :target: http://pythonwheels.com/\n\n.. image:: https://img.shields.io/pypi/l/xenon.svg\n    :alt: Xenon license\n    :target: https://pypi.python.org/pypi/xenon/\n\n\n----\n\nXenon is a monitoring tool based on `Radon <https://github.com/rubik/radon/>`_.\nIt monitors your code's complexity.  Ideally, Xenon is run every time you\ncommit code. Through command line options, you can set various thresholds for\nthe **complexity** of your code. It will fail (i.e. it will exit with a\nnon-zero exit code) when any of these requirements is not met.\n\nInstallation\n------------\n\nWith Pip:\n\n.. code-block:: sh\n\n   $ pip install xenon\n\nOr download the source and run the setup file (requires setuptools):\n\n.. code-block:: sh\n\n   $ python setup.py install\n\nXenon is tested with Python versions **2.7** and **3.6** to **3.12** as well as\n**PyPy**.\n\nUsage\n-----\n\nTypically you would use Xenon in two scenarios:\n\n1. As a ``git commit`` hook: to make sure that your code never exceeds some\n   complexity values.\n\n2. On a **continuous integration** server: as a part of your build, to keep\n   under control, as above, your code's complexity. See Xenon's\n   `.travis.yml file`_ for an example usage.\n\nThe command line\n++++++++++++++++\n\nEverything boils down to Xenon's command line usage.\nTo control which files are analyzed, you use the options ``-e, --exclude`` and\n``-i, --ignore``. Both accept a comma-separated list of glob patterns. The\nvalue usually needs quoting at the command line, to prevent the shell from\nexpanding the pattern (in case there is only one). Every filename is matched\nagainst the *exclude* patterns. Every directory name is matched against the\n*ignore* patterns.  If any of the patterns matches, Xenon won't even descend\ninto them.\n\nThe actual threshold values are defined through these options:\n\n* ``-a, --max-average``: Threshold for the *average* complexity (across all the\n  codebase).\n* ``-m, --max-modules``: Threshold for *modules* complexity.\n* ``-b, --max-absolute``: *Absolute* threshold for *block* complexity.\n\n\nAll of these options are inclusive.\n\nAn actual example\n+++++++++++++++++\n\n.. code-block:: sh\n\n   $ xenon --max-absolute B --max-modules A --max-average A\n\nor, more succinctly:\n\n.. code-block:: sh\n\n   $ xenon -b B -m A -a A\n\nWith these options Xenon will exit with a non-zero exit code if any of the\nfollowing conditions is met:\n\n* At least one block has a rank higher than ``B`` (i.e. ``C``, ``D``, ``E`` or\n  ``F``).\n* At least one module has a rank higher than ``A``.\n* The average complexity (among all of the analyzed blocks) is ranked with\n  ``B`` or higher.\n\nPre-commit hook\n+++++++++++++++\n\nXenon can be used in combination with `pre-commit <https://pre-commit.com/>`_ as follows:\n\n.. code-block:: yaml\n\n    # monitor code complexity\n    - repo: https://github.com/rubik/xenon\n      rev: v0.9.0\n      hooks:\n      - id: xenon\n        args: ['--max-absolute=B', '--max-modules=B', '--max-average=A']\n\nNote: due to how options are passed to commands by pre-commit, make sure to\npass values either with an equals sign like in the above example, or by\nsplitting them as separate list items, e.g. ``['--max-absolute', 'B']``.\n\nOther resources\n---------------\n\nFor more information regarding cyclomatic complexity and static analysis in\nPython, please refer to Radon's documentation, the project on which Xenon is\nbased on:\n\n* More on cyclomatic complexity:\n  http://radon.readthedocs.org/en/latest/intro.html\n* More on Radon's ranking:\n  http://radon.readthedocs.org/en/latest/commandline.html#the-cc-command\n\n\n.. _.travis.yml file: https://github.com/rubik/xenon/blob/master/.travis.yml\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Monitor code metrics for Python on your CI server",
    "version": "0.9.3",
    "project_urls": {
        "Download": "https://pypi.python.org/xenon/",
        "Homepage": "https://xenon.readthedocs.org/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6f5d29ff8665b129cafd147d90b86e92babee32e116e3c84447107da3e77f8fb",
                "md5": "ed9bead1c27c61b5fbab3644c8087223",
                "sha256": "6e2c2c251cc5e9d01fe984e623499b13b2140fcbf74d6c03a613fa43a9347097"
            },
            "downloads": -1,
            "filename": "xenon-0.9.3-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ed9bead1c27c61b5fbab3644c8087223",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 8966,
            "upload_time": "2024-10-21T10:27:51",
            "upload_time_iso_8601": "2024-10-21T10:27:51.121328Z",
            "url": "https://files.pythonhosted.org/packages/6f/5d/29ff8665b129cafd147d90b86e92babee32e116e3c84447107da3e77f8fb/xenon-0.9.3-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c47c2b341eaeec69d514b635ea18481885a956d196a74322a4b0942ef0c31691",
                "md5": "ad5704f183619803a022c70429743b62",
                "sha256": "4a7538d8ba08aa5d79055fb3e0b2393c0bd6d7d16a4ab0fcdef02ef1f10a43fa"
            },
            "downloads": -1,
            "filename": "xenon-0.9.3.tar.gz",
            "has_sig": false,
            "md5_digest": "ad5704f183619803a022c70429743b62",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 9883,
            "upload_time": "2024-10-21T10:27:53",
            "upload_time_iso_8601": "2024-10-21T10:27:53.722905Z",
            "url": "https://files.pythonhosted.org/packages/c4/7c/2b341eaeec69d514b635ea18481885a956d196a74322a4b0942ef0c31691/xenon-0.9.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-21 10:27:53",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "xenon"
}
        
Elapsed time: 0.34555s