1Metadata-Version: 1.1 2Name: mccabe 3Version: 0.6.1 4Summary: McCabe checker, plugin for flake8 5Home-page: https://github.com/pycqa/mccabe 6Author: Ian Cordasco 7Author-email: graffatcolmingov@gmail.com 8License: Expat license 9Description: McCabe complexity checker 10 ========================= 11 12 Ned's script to check McCabe complexity. 13 14 This module provides a plugin for ``flake8``, the Python code checker. 15 16 17 Installation 18 ------------ 19 20 You can install, upgrade, uninstall ``mccabe`` with these commands:: 21 22 $ pip install mccabe 23 $ pip install --upgrade mccabe 24 $ pip uninstall mccabe 25 26 27 Standalone script 28 ----------------- 29 30 The complexity checker can be used directly:: 31 32 $ python -m mccabe --min 5 mccabe.py 33 ("185:1: 'PathGraphingAstVisitor.visitIf'", 5) 34 ("71:1: 'PathGraph.to_dot'", 5) 35 ("245:1: 'McCabeChecker.run'", 5) 36 ("283:1: 'main'", 7) 37 ("203:1: 'PathGraphingAstVisitor.visitTryExcept'", 5) 38 ("257:1: 'get_code_complexity'", 5) 39 40 41 Plugin for Flake8 42 ----------------- 43 44 When both ``flake8 2.0`` and ``mccabe`` are installed, the plugin is 45 available in ``flake8``:: 46 47 $ flake8 --version 48 2.0 (pep8: 1.4.2, pyflakes: 0.6.1, mccabe: 0.2) 49 50 By default the plugin is disabled. Use the ``--max-complexity`` switch to 51 enable it. It will emit a warning if the McCabe complexity of a function is 52 higher that the value:: 53 54 $ flake8 --max-complexity 10 coolproject 55 ... 56 coolproject/mod.py:1204:1: C901 'CoolFactory.prepare' is too complex (14) 57 58 This feature is quite useful to detect over-complex code. According to McCabe, 59 anything that goes beyond 10 is too complex. 60 61 62 Links 63 ----- 64 65 * Feedback and ideas: http://mail.python.org/mailman/listinfo/code-quality 66 67 * Cyclomatic complexity: http://en.wikipedia.org/wiki/Cyclomatic_complexity. 68 69 * Ned Batchelder's script: 70 http://nedbatchelder.com/blog/200803/python_code_complexity_microtool.html 71 72 73 Changes 74 ------- 75 76 0.6.1 - 2017-01-26 77 `````````````````` 78 79 * Fix signature for ``PathGraphingAstVisitor.default`` to match the signature 80 for ``ASTVisitor`` 81 82 0.6.0 - 2017-01-23 83 `````````````````` 84 85 * Add support for Python 3.6 86 87 * Fix handling for missing statement types 88 89 0.5.3 - 2016-12-14 90 `````````````````` 91 92 * Report actual column number of violation instead of the start of the line 93 94 0.5.2 - 2016-07-31 95 `````````````````` 96 97 * When opening files ourselves, make sure we always name the file variable 98 99 0.5.1 - 2016-07-28 100 `````````````````` 101 102 * Set default maximum complexity to -1 on the class itself 103 104 0.5.0 - 2016-05-30 105 `````````````````` 106 107 * PyCon 2016 PDX release 108 109 * Add support for Flake8 3.0 110 111 0.4.0 - 2016-01-27 112 `````````````````` 113 114 * Stop testing on Python 3.2 115 116 * Add support for async/await keywords on Python 3.5 from PEP 0492 117 118 0.3.1 - 2015-06-14 119 `````````````````` 120 121 * Include ``test_mccabe.py`` in releases. 122 123 * Always coerce the ``max_complexity`` value from Flake8's entry-point to an 124 integer. 125 126 0.3 - 2014-12-17 127 ```````````````` 128 129 * Computation was wrong: the mccabe complexity starts at 1, not 2. 130 131 * The ``max-complexity`` value is now inclusive. E.g.: if the 132 value is 10 and the reported complexity is 10, then it passes. 133 134 * Add tests. 135 136 137 0.2.1 - 2013-04-03 138 `````````````````` 139 140 * Do not require ``setuptools`` in setup.py. It works around an issue 141 with ``pip`` and Python 3. 142 143 144 0.2 - 2013-02-22 145 ```````````````` 146 147 * Rename project to ``mccabe``. 148 149 * Provide ``flake8.extension`` setuptools entry point. 150 151 * Read ``max-complexity`` from the configuration file. 152 153 * Rename argument ``min_complexity`` to ``threshold``. 154 155 156 0.1 - 2013-02-11 157 ```````````````` 158 * First release 159 160Keywords: flake8 mccabe 161Platform: UNKNOWN 162Classifier: Development Status :: 5 - Production/Stable 163Classifier: Environment :: Console 164Classifier: Intended Audience :: Developers 165Classifier: License :: OSI Approved :: MIT License 166Classifier: Operating System :: OS Independent 167Classifier: Programming Language :: Python 168Classifier: Programming Language :: Python :: 2 169Classifier: Programming Language :: Python :: 2.7 170Classifier: Programming Language :: Python :: 3 171Classifier: Programming Language :: Python :: 3.3 172Classifier: Programming Language :: Python :: 3.4 173Classifier: Programming Language :: Python :: 3.5 174Classifier: Programming Language :: Python :: 3.6 175Classifier: Topic :: Software Development :: Libraries :: Python Modules 176Classifier: Topic :: Software Development :: Quality Assurance 177