{ "info": { "author": "Florian Bruhin", "author_email": "me@the-compiler.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Plugins", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Quality Assurance", "Topic :: Software Development :: Testing" ], "description": "pytest-mccabe\n=============\n\n.. image:: https://travis-ci.org/The-Compiler/pytest-mccabe.svg?branch=master\n :target: https://travis-ci.org/The-Compiler/pytest-mccabe\n\npy.test plugin for checking cyclomatic complexity of python source with\n`mccabe`_.\n\n.. _mccabe: https://pypi.python.org/pypi/mccabe/\n\nUsage\n-----\n\ninstall via::\n\n pip install pytest-mccabe\n\nif you then type::\n\n py.test --mccabe\n\nevery file ending in ``.py`` will be discovered and run through mccabe,\nstarting from the command line arguments.\n\nSimple usage example\n--------------------\n\nConsider you have this (deliberately bad and complex) code:\n\n.. code-block:: python\n\n # module.py\n\n import random\n import os.path\n\n def some_function():\n num = random.random()\n if 0 <= num < 0.1:\n print(\"1\")\n elif 0.1 <= num < 0.2:\n print(\"2\")\n elif 0.2 <= num < 0.3:\n print(\"3\")\n elif 0.3 <= num < 0.4:\n print(\"4\")\n elif 0.4 <= num < 0.5:\n print(\"5\")\n elif 0.5 <= num < 0.6:\n print(\"6\")\n elif 0.6 <= num < 0.7:\n print(\"7\")\n elif 0.7 <= num < 0.8:\n print(\"8\")\n elif 0.8 <= num < 0.9:\n print(\"9\")\n elif 0.9 <= num < 1:\n print(\"10\")\n\nRunning py.test with pytest-mccabe installed shows you this function is\nconsidered too complex::\n\n $ py.test -q --mccabe module.py\n F\n ============================== FAILURES ==============================\n ____________________________ mccabe-check ____________________________\n .../module.py:4: C901 'some_function' is too complex (11)\n\n\nConfiguring mccabe complexity per project and file\n--------------------------------------------------\n\nYou may configure the maximum complexity for your project\nby adding an ``mccabe-complexity`` entry to pytest config file (e.g.\n``setup.cfg``) like this:\n\n.. code-block:: ini\n\n [pytest]\n mccabe-complexity=15\n\nRerunning with the above example will now look better::\n\n $ py.test -q --mccabe foo.py\n .\n 1 passed in 0.00 seconds\n\nIf you have some files where you want to set a higher complexity than the\nproject-wide one, you can start a mccabe-complexity line with a glob-pattern:\n\n.. code-block:: ini\n\n [pytest]\n mccabe-complexity =\n *.py 7\n magic.py 10\n\nIgnoring certain functions\n--------------------------\n\nYou can exclude certain functions from the complexity check by adding comments\nlike this:\n\n.. code-block:: python\n\n def some_function(): # noqa\n ...\n\n def another_function(): # pragma: no mccabe\n ...\n\n(both will work - ``# noqa`` is mainly there for `flake8`_ compatibility)\n\n.. _flake8: https://pypi.python.org/pypi/flake8\n\n\nRunning mccabe checks and no other tests\n----------------------------------------\n\nYou can restrict your test run to only perform \"mccabe\" tests\nand not any other tests by typing::\n\n py.test --mccabe -m mccabe\n\nThis will only run tests that are marked with the \"mccabe\" keyword\nwhich is added for the mccabe test items added by this plugin.\n\nIf you are using pytest < 2.4, then use the following invocation\nto the same effect::\n\n py.test --mccabe -k mccabe\n\n\nNotes\n-----\n\nThe repository of this plugin is at https://github.com/The-Compiler/pytest-mccabe\n\nFor more info on py.test see http://pytest.org\n\nThe code is based on Florian Schulze's excellent `pytest-flakes`_ - Thanks!\n\n.. _pytest-flakes: https://pypi.python.org/pypi/pytest-flakes\n\nChanges\n=======\n\n0.1\n---\n\n- Initial release.\n\n1.0\n---\n\n- Drop support for Python 2.6, 3.2, 3.3 and 3.4\n- Add support for Python 3.5, 3.6 and 3.7\n- Make this plugin compatible with pytest 4.x and 5.x\n- Drop support for \"setup.py test\"\n- Remove outdated pytest-cache dependency\n- Various code/CI cleanups\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/The-Compiler/pytest-mccabe", "keywords": "pytest plugin mccabe complexity", "license": "MIT license", "maintainer": "", "maintainer_email": "", "name": "pytest-mccabe", "package_url": "https://pypi.org/project/pytest-mccabe/", "platform": "", "project_url": "https://pypi.org/project/pytest-mccabe/", "project_urls": { "Homepage": "https://github.com/The-Compiler/pytest-mccabe" }, "release_url": "https://pypi.org/project/pytest-mccabe/1.0/", "requires_dist": [ "pytest (>=3.6.0)", "mccabe" ], "requires_python": "", "summary": "pytest plugin to run the mccabe code complexity checker.", "version": "1.0" }, "last_serial": 5802573, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "19d7bb1520e2077299e294f8c28412b2", "sha256": "9c663e2e7c2510302d7ff57a11acb56b851c6807b2c744e77eb968b1bbb66cca" }, "downloads": -1, "filename": "pytest_mccabe-0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "19d7bb1520e2077299e294f8c28412b2", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7212, "upload_time": "2015-06-02T18:24:42", "url": "https://files.pythonhosted.org/packages/ed/fa/9ccf1c3bdaa8f48186c1e2af1a742846a304686d36dd91f23902d3afc9bf/pytest_mccabe-0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "246444a05013660651498d549589fa34", "sha256": "f68af99861c06a27d45ee7682071a201fe0a7785f2ec0a96080022db5ca62012" }, "downloads": -1, "filename": "pytest-mccabe-0.1.tar.gz", "has_sig": false, "md5_digest": "246444a05013660651498d549589fa34", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6137, "upload_time": "2015-06-02T18:22:45", "url": "https://files.pythonhosted.org/packages/2f/de/db22476b05df9e553358a65bc4d2abffec5764b6fd86545f379faf946bb2/pytest-mccabe-0.1.tar.gz" } ], "1.0": [ { "comment_text": "", "digests": { "md5": "9b6ea1bb28420f4073b95a3421173b52", "sha256": "16b9bccafb52c052307503733aa287a10cb6f57273ca07470c5bd9127d011af3" }, "downloads": -1, "filename": "pytest_mccabe-1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9b6ea1bb28420f4073b95a3421173b52", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5857, "upload_time": "2019-09-09T09:03:27", "url": "https://files.pythonhosted.org/packages/5b/aa/ccaa4467b9661277d05b64fd3bdcec91c6114af1525bb750f4269c0065c9/pytest_mccabe-1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "58c75f425dd698fdaba858b1d4e926ed", "sha256": "02c9c1e9d02f0522d659809e1e7bf74e3e8fa7fb74eb55f177afb4701c8d9a4c" }, "downloads": -1, "filename": "pytest-mccabe-1.0.tar.gz", "has_sig": false, "md5_digest": "58c75f425dd698fdaba858b1d4e926ed", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6053, "upload_time": "2019-09-09T09:03:29", "url": "https://files.pythonhosted.org/packages/0c/74/454b25b4e709347a95f69f75a68e720a9189a37b1305f42f1f0176e7732f/pytest-mccabe-1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9b6ea1bb28420f4073b95a3421173b52", "sha256": "16b9bccafb52c052307503733aa287a10cb6f57273ca07470c5bd9127d011af3" }, "downloads": -1, "filename": "pytest_mccabe-1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9b6ea1bb28420f4073b95a3421173b52", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5857, "upload_time": "2019-09-09T09:03:27", "url": "https://files.pythonhosted.org/packages/5b/aa/ccaa4467b9661277d05b64fd3bdcec91c6114af1525bb750f4269c0065c9/pytest_mccabe-1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "58c75f425dd698fdaba858b1d4e926ed", "sha256": "02c9c1e9d02f0522d659809e1e7bf74e3e8fa7fb74eb55f177afb4701c8d9a4c" }, "downloads": -1, "filename": "pytest-mccabe-1.0.tar.gz", "has_sig": false, "md5_digest": "58c75f425dd698fdaba858b1d4e926ed", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6053, "upload_time": "2019-09-09T09:03:29", "url": "https://files.pythonhosted.org/packages/0c/74/454b25b4e709347a95f69f75a68e720a9189a37b1305f42f1f0176e7732f/pytest-mccabe-1.0.tar.gz" } ] }