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