Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-mccabe for openSUSE:Factory checked in at 2022-08-19 17:53:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-mccabe (Old) and /work/SRC/openSUSE:Factory/.python-mccabe.new.2083 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-mccabe" Fri Aug 19 17:53:13 2022 rev:9 rq:997689 version:0.7.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-mccabe/python-mccabe.changes 2019-07-08 15:02:03.482628273 +0200 +++ /work/SRC/openSUSE:Factory/.python-mccabe.new.2083/python-mccabe.changes 2022-08-19 17:54:17.519825413 +0200 @@ -1,0 +2,8 @@ +Thu Aug 18 08:28:37 UTC 2022 - Dirk M??ller <[email protected]> + +- update to 0.7.0: + * Drop support for all versions of Python lower than 3.6 + * Add support for Python 3.8, 3.9, and 3.10 + * Fix option declaration for Flake8 + +------------------------------------------------------------------- Old: ---- mccabe-0.6.1.tar.gz New: ---- mccabe-0.7.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-mccabe.spec ++++++ --- /var/tmp/diff_new_pack.QSd5ef/_old 2022-08-19 17:54:18.723827936 +0200 +++ /var/tmp/diff_new_pack.QSd5ef/_new 2022-08-19 17:54:18.731827953 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-mccabe # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,13 +18,15 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-mccabe -Version: 0.6.1 +Version: 0.7.0 Release: 0 Summary: McCabe checker, plugin for flake8 License: MIT Group: Development/Languages/Python URL: https://github.com/flintwork/mccabe Source: https://files.pythonhosted.org/packages/source/m/mccabe/mccabe-%{version}.tar.gz +BuildRequires: %{python_module hypothesis} +BuildRequires: %{python_module hypothesmith} BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} BuildRequires: fdupes ++++++ mccabe-0.6.1.tar.gz -> mccabe-0.7.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mccabe-0.6.1/PKG-INFO new/mccabe-0.7.0/PKG-INFO --- old/mccabe-0.6.1/PKG-INFO 2017-01-26 23:13:05.000000000 +0100 +++ new/mccabe-0.7.0/PKG-INFO 2022-01-24 02:12:04.795890800 +0100 @@ -1,162 +1,13 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: mccabe -Version: 0.6.1 +Version: 0.7.0 Summary: McCabe checker, plugin for flake8 Home-page: https://github.com/pycqa/mccabe -Author: Ian Cordasco -Author-email: [email protected] +Author: Tarek Ziade +Author-email: [email protected] +Maintainer: Ian Stapleton Cordasco +Maintainer-email: [email protected] License: Expat license -Description: McCabe complexity checker - ========================= - - Ned's script to check McCabe complexity. - - This module provides a plugin for ``flake8``, the Python code checker. - - - Installation - ------------ - - You can install, upgrade, uninstall ``mccabe`` with these commands:: - - $ pip install mccabe - $ pip install --upgrade mccabe - $ pip uninstall mccabe - - - Standalone script - ----------------- - - The complexity checker can be used directly:: - - $ python -m mccabe --min 5 mccabe.py - ("185:1: 'PathGraphingAstVisitor.visitIf'", 5) - ("71:1: 'PathGraph.to_dot'", 5) - ("245:1: 'McCabeChecker.run'", 5) - ("283:1: 'main'", 7) - ("203:1: 'PathGraphingAstVisitor.visitTryExcept'", 5) - ("257:1: 'get_code_complexity'", 5) - - - Plugin for Flake8 - ----------------- - - When both ``flake8 2.0`` and ``mccabe`` are installed, the plugin is - available in ``flake8``:: - - $ flake8 --version - 2.0 (pep8: 1.4.2, pyflakes: 0.6.1, mccabe: 0.2) - - By default the plugin is disabled. Use the ``--max-complexity`` switch to - enable it. It will emit a warning if the McCabe complexity of a function is - higher that the value:: - - $ flake8 --max-complexity 10 coolproject - ... - coolproject/mod.py:1204:1: C901 'CoolFactory.prepare' is too complex (14) - - This feature is quite useful to detect over-complex code. According to McCabe, - anything that goes beyond 10 is too complex. - - - Links - ----- - - * Feedback and ideas: http://mail.python.org/mailman/listinfo/code-quality - - * Cyclomatic complexity: http://en.wikipedia.org/wiki/Cyclomatic_complexity. - - * Ned Batchelder's script: - http://nedbatchelder.com/blog/200803/python_code_complexity_microtool.html - - - Changes - ------- - - 0.6.1 - 2017-01-26 - `````````````````` - - * Fix signature for ``PathGraphingAstVisitor.default`` to match the signature - for ``ASTVisitor`` - - 0.6.0 - 2017-01-23 - `````````````````` - - * Add support for Python 3.6 - - * Fix handling for missing statement types - - 0.5.3 - 2016-12-14 - `````````````````` - - * Report actual column number of violation instead of the start of the line - - 0.5.2 - 2016-07-31 - `````````````````` - - * When opening files ourselves, make sure we always name the file variable - - 0.5.1 - 2016-07-28 - `````````````````` - - * Set default maximum complexity to -1 on the class itself - - 0.5.0 - 2016-05-30 - `````````````````` - - * PyCon 2016 PDX release - - * Add support for Flake8 3.0 - - 0.4.0 - 2016-01-27 - `````````````````` - - * Stop testing on Python 3.2 - - * Add support for async/await keywords on Python 3.5 from PEP 0492 - - 0.3.1 - 2015-06-14 - `````````````````` - - * Include ``test_mccabe.py`` in releases. - - * Always coerce the ``max_complexity`` value from Flake8's entry-point to an - integer. - - 0.3 - 2014-12-17 - ```````````````` - - * Computation was wrong: the mccabe complexity starts at 1, not 2. - - * The ``max-complexity`` value is now inclusive. E.g.: if the - value is 10 and the reported complexity is 10, then it passes. - - * Add tests. - - - 0.2.1 - 2013-04-03 - `````````````````` - - * Do not require ``setuptools`` in setup.py. It works around an issue - with ``pip`` and Python 3. - - - 0.2 - 2013-02-22 - ```````````````` - - * Rename project to ``mccabe``. - - * Provide ``flake8.extension`` setuptools entry point. - - * Read ``max-complexity`` from the configuration file. - - * Rename argument ``min_complexity`` to ``threshold``. - - - 0.1 - 2013-02-11 - ```````````````` - * First release - Keywords: flake8 mccabe Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable @@ -165,12 +16,184 @@ Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.3 -Classifier: Programming Language :: Python :: 3.4 -Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: Software Development :: Quality Assurance +Requires-Python: >=3.6 +License-File: LICENSE + +McCabe complexity checker +========================= + +Ned's script to check McCabe complexity. + +This module provides a plugin for ``flake8``, the Python code checker. + + +Installation +------------ + +You can install, upgrade, or uninstall ``mccabe`` with these commands:: + + $ pip install mccabe + $ pip install --upgrade mccabe + $ pip uninstall mccabe + + +Standalone script +----------------- + +The complexity checker can be used directly:: + + $ python -m mccabe --min 5 mccabe.py + ("185:1: 'PathGraphingAstVisitor.visitIf'", 5) + ("71:1: 'PathGraph.to_dot'", 5) + ("245:1: 'McCabeChecker.run'", 5) + ("283:1: 'main'", 7) + ("203:1: 'PathGraphingAstVisitor.visitTryExcept'", 5) + ("257:1: 'get_code_complexity'", 5) + + +Plugin for Flake8 +----------------- + +When both ``flake8 2+`` and ``mccabe`` are installed, the plugin is +available in ``flake8``:: + + $ flake8 --version + 2.0 (pep8: 1.4.2, pyflakes: 0.6.1, mccabe: 0.2) + +By default the plugin is disabled. Use the ``--max-complexity`` switch to +enable it. It will emit a warning if the McCabe complexity of a function is +higher than the provided value:: + + $ flake8 --max-complexity 10 coolproject + ... + coolproject/mod.py:1204:1: C901 'CoolFactory.prepare' is too complex (14) + +This feature is quite useful for detecting over-complex code. According to McCabe, +anything that goes beyond 10 is too complex. + +Flake8 has many features that mccabe does not provide. Flake8 allows users to +ignore violations reported by plugins with ``# noqa``. Read more about this in +`their documentation +<http://flake8.pycqa.org/en/latest/user/violations.html#in-line-ignoring-errors>`__. +To silence violations reported by ``mccabe``, place your ``# noqa: C901`` on +the function definition line, where the error is reported for (possibly a +decorator). + + +Links +----- + +* Feedback and ideas: http://mail.python.org/mailman/listinfo/code-quality + +* Cyclomatic complexity: http://en.wikipedia.org/wiki/Cyclomatic_complexity + +* Ned Batchelder's script: + http://nedbatchelder.com/blog/200803/python_code_complexity_microtool.html + +* McCabe complexity: http://en.wikipedia.org/wiki/Cyclomatic_complexity + + +Changes +------- + +0.7.0 - 2021-01-23 +`````````````````` + +* Drop support for all versions of Python lower than 3.6 + +* Add support for Python 3.8, 3.9, and 3.10 + +* Fix option declaration for Flake8 + +0.6.1 - 2017-01-26 +`````````````````` + +* Fix signature for ``PathGraphingAstVisitor.default`` to match the signature + for ``ASTVisitor`` + +0.6.0 - 2017-01-23 +`````````````````` + +* Add support for Python 3.6 + +* Fix handling for missing statement types + +0.5.3 - 2016-12-14 +`````````````````` + +* Report actual column number of violation instead of the start of the line + +0.5.2 - 2016-07-31 +`````````````````` + +* When opening files ourselves, make sure we always name the file variable + +0.5.1 - 2016-07-28 +`````````````````` + +* Set default maximum complexity to -1 on the class itself + +0.5.0 - 2016-05-30 +`````````````````` + +* PyCon 2016 PDX release + +* Add support for Flake8 3.0 + +0.4.0 - 2016-01-27 +`````````````````` + +* Stop testing on Python 3.2 + +* Add support for async/await keywords on Python 3.5 from PEP 0492 + +0.3.1 - 2015-06-14 +`````````````````` + +* Include ``test_mccabe.py`` in releases. + +* Always coerce the ``max_complexity`` value from Flake8's entry-point to an + integer. + +0.3 - 2014-12-17 +```````````````` + +* Computation was wrong: the mccabe complexity starts at 1, not 2. + +* The ``max-complexity`` value is now inclusive. E.g.: if the + value is 10 and the reported complexity is 10, then it passes. + +* Add tests. + + +0.2.1 - 2013-04-03 +`````````````````` + +* Do not require ``setuptools`` in setup.py. It works around an issue + with ``pip`` and Python 3. + + +0.2 - 2013-02-22 +```````````````` + +* Rename project to ``mccabe``. + +* Provide ``flake8.extension`` setuptools entry point. + +* Read ``max-complexity`` from the configuration file. + +* Rename argument ``min_complexity`` to ``threshold``. + + +0.1 - 2013-02-11 +```````````````` +* First release + + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mccabe-0.6.1/README.rst new/mccabe-0.7.0/README.rst --- old/mccabe-0.6.1/README.rst 2017-01-26 23:11:16.000000000 +0100 +++ new/mccabe-0.7.0/README.rst 2022-01-24 02:10:14.000000000 +0100 @@ -9,7 +9,7 @@ Installation ------------ -You can install, upgrade, uninstall ``mccabe`` with these commands:: +You can install, upgrade, or uninstall ``mccabe`` with these commands:: $ pip install mccabe $ pip install --upgrade mccabe @@ -33,7 +33,7 @@ Plugin for Flake8 ----------------- -When both ``flake8 2.0`` and ``mccabe`` are installed, the plugin is +When both ``flake8 2+`` and ``mccabe`` are installed, the plugin is available in ``flake8``:: $ flake8 --version @@ -41,30 +41,49 @@ By default the plugin is disabled. Use the ``--max-complexity`` switch to enable it. It will emit a warning if the McCabe complexity of a function is -higher that the value:: +higher than the provided value:: $ flake8 --max-complexity 10 coolproject ... coolproject/mod.py:1204:1: C901 'CoolFactory.prepare' is too complex (14) -This feature is quite useful to detect over-complex code. According to McCabe, +This feature is quite useful for detecting over-complex code. According to McCabe, anything that goes beyond 10 is too complex. +Flake8 has many features that mccabe does not provide. Flake8 allows users to +ignore violations reported by plugins with ``# noqa``. Read more about this in +`their documentation +<http://flake8.pycqa.org/en/latest/user/violations.html#in-line-ignoring-errors>`__. +To silence violations reported by ``mccabe``, place your ``# noqa: C901`` on +the function definition line, where the error is reported for (possibly a +decorator). + Links ----- * Feedback and ideas: http://mail.python.org/mailman/listinfo/code-quality -* Cyclomatic complexity: http://en.wikipedia.org/wiki/Cyclomatic_complexity. +* Cyclomatic complexity: http://en.wikipedia.org/wiki/Cyclomatic_complexity * Ned Batchelder's script: http://nedbatchelder.com/blog/200803/python_code_complexity_microtool.html +* McCabe complexity: http://en.wikipedia.org/wiki/Cyclomatic_complexity + Changes ------- +0.7.0 - 2021-01-23 +`````````````````` + +* Drop support for all versions of Python lower than 3.6 + +* Add support for Python 3.8, 3.9, and 3.10 + +* Fix option declaration for Flake8 + 0.6.1 - 2017-01-26 `````````````````` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mccabe-0.6.1/mccabe.egg-info/PKG-INFO new/mccabe-0.7.0/mccabe.egg-info/PKG-INFO --- old/mccabe-0.6.1/mccabe.egg-info/PKG-INFO 2017-01-26 23:13:05.000000000 +0100 +++ new/mccabe-0.7.0/mccabe.egg-info/PKG-INFO 2022-01-24 02:12:04.000000000 +0100 @@ -1,162 +1,13 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: mccabe -Version: 0.6.1 +Version: 0.7.0 Summary: McCabe checker, plugin for flake8 Home-page: https://github.com/pycqa/mccabe -Author: Ian Cordasco -Author-email: [email protected] +Author: Tarek Ziade +Author-email: [email protected] +Maintainer: Ian Stapleton Cordasco +Maintainer-email: [email protected] License: Expat license -Description: McCabe complexity checker - ========================= - - Ned's script to check McCabe complexity. - - This module provides a plugin for ``flake8``, the Python code checker. - - - Installation - ------------ - - You can install, upgrade, uninstall ``mccabe`` with these commands:: - - $ pip install mccabe - $ pip install --upgrade mccabe - $ pip uninstall mccabe - - - Standalone script - ----------------- - - The complexity checker can be used directly:: - - $ python -m mccabe --min 5 mccabe.py - ("185:1: 'PathGraphingAstVisitor.visitIf'", 5) - ("71:1: 'PathGraph.to_dot'", 5) - ("245:1: 'McCabeChecker.run'", 5) - ("283:1: 'main'", 7) - ("203:1: 'PathGraphingAstVisitor.visitTryExcept'", 5) - ("257:1: 'get_code_complexity'", 5) - - - Plugin for Flake8 - ----------------- - - When both ``flake8 2.0`` and ``mccabe`` are installed, the plugin is - available in ``flake8``:: - - $ flake8 --version - 2.0 (pep8: 1.4.2, pyflakes: 0.6.1, mccabe: 0.2) - - By default the plugin is disabled. Use the ``--max-complexity`` switch to - enable it. It will emit a warning if the McCabe complexity of a function is - higher that the value:: - - $ flake8 --max-complexity 10 coolproject - ... - coolproject/mod.py:1204:1: C901 'CoolFactory.prepare' is too complex (14) - - This feature is quite useful to detect over-complex code. According to McCabe, - anything that goes beyond 10 is too complex. - - - Links - ----- - - * Feedback and ideas: http://mail.python.org/mailman/listinfo/code-quality - - * Cyclomatic complexity: http://en.wikipedia.org/wiki/Cyclomatic_complexity. - - * Ned Batchelder's script: - http://nedbatchelder.com/blog/200803/python_code_complexity_microtool.html - - - Changes - ------- - - 0.6.1 - 2017-01-26 - `````````````````` - - * Fix signature for ``PathGraphingAstVisitor.default`` to match the signature - for ``ASTVisitor`` - - 0.6.0 - 2017-01-23 - `````````````````` - - * Add support for Python 3.6 - - * Fix handling for missing statement types - - 0.5.3 - 2016-12-14 - `````````````````` - - * Report actual column number of violation instead of the start of the line - - 0.5.2 - 2016-07-31 - `````````````````` - - * When opening files ourselves, make sure we always name the file variable - - 0.5.1 - 2016-07-28 - `````````````````` - - * Set default maximum complexity to -1 on the class itself - - 0.5.0 - 2016-05-30 - `````````````````` - - * PyCon 2016 PDX release - - * Add support for Flake8 3.0 - - 0.4.0 - 2016-01-27 - `````````````````` - - * Stop testing on Python 3.2 - - * Add support for async/await keywords on Python 3.5 from PEP 0492 - - 0.3.1 - 2015-06-14 - `````````````````` - - * Include ``test_mccabe.py`` in releases. - - * Always coerce the ``max_complexity`` value from Flake8's entry-point to an - integer. - - 0.3 - 2014-12-17 - ```````````````` - - * Computation was wrong: the mccabe complexity starts at 1, not 2. - - * The ``max-complexity`` value is now inclusive. E.g.: if the - value is 10 and the reported complexity is 10, then it passes. - - * Add tests. - - - 0.2.1 - 2013-04-03 - `````````````````` - - * Do not require ``setuptools`` in setup.py. It works around an issue - with ``pip`` and Python 3. - - - 0.2 - 2013-02-22 - ```````````````` - - * Rename project to ``mccabe``. - - * Provide ``flake8.extension`` setuptools entry point. - - * Read ``max-complexity`` from the configuration file. - - * Rename argument ``min_complexity`` to ``threshold``. - - - 0.1 - 2013-02-11 - ```````````````` - * First release - Keywords: flake8 mccabe Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable @@ -165,12 +16,184 @@ Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.3 -Classifier: Programming Language :: Python :: 3.4 -Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: Software Development :: Quality Assurance +Requires-Python: >=3.6 +License-File: LICENSE + +McCabe complexity checker +========================= + +Ned's script to check McCabe complexity. + +This module provides a plugin for ``flake8``, the Python code checker. + + +Installation +------------ + +You can install, upgrade, or uninstall ``mccabe`` with these commands:: + + $ pip install mccabe + $ pip install --upgrade mccabe + $ pip uninstall mccabe + + +Standalone script +----------------- + +The complexity checker can be used directly:: + + $ python -m mccabe --min 5 mccabe.py + ("185:1: 'PathGraphingAstVisitor.visitIf'", 5) + ("71:1: 'PathGraph.to_dot'", 5) + ("245:1: 'McCabeChecker.run'", 5) + ("283:1: 'main'", 7) + ("203:1: 'PathGraphingAstVisitor.visitTryExcept'", 5) + ("257:1: 'get_code_complexity'", 5) + + +Plugin for Flake8 +----------------- + +When both ``flake8 2+`` and ``mccabe`` are installed, the plugin is +available in ``flake8``:: + + $ flake8 --version + 2.0 (pep8: 1.4.2, pyflakes: 0.6.1, mccabe: 0.2) + +By default the plugin is disabled. Use the ``--max-complexity`` switch to +enable it. It will emit a warning if the McCabe complexity of a function is +higher than the provided value:: + + $ flake8 --max-complexity 10 coolproject + ... + coolproject/mod.py:1204:1: C901 'CoolFactory.prepare' is too complex (14) + +This feature is quite useful for detecting over-complex code. According to McCabe, +anything that goes beyond 10 is too complex. + +Flake8 has many features that mccabe does not provide. Flake8 allows users to +ignore violations reported by plugins with ``# noqa``. Read more about this in +`their documentation +<http://flake8.pycqa.org/en/latest/user/violations.html#in-line-ignoring-errors>`__. +To silence violations reported by ``mccabe``, place your ``# noqa: C901`` on +the function definition line, where the error is reported for (possibly a +decorator). + + +Links +----- + +* Feedback and ideas: http://mail.python.org/mailman/listinfo/code-quality + +* Cyclomatic complexity: http://en.wikipedia.org/wiki/Cyclomatic_complexity + +* Ned Batchelder's script: + http://nedbatchelder.com/blog/200803/python_code_complexity_microtool.html + +* McCabe complexity: http://en.wikipedia.org/wiki/Cyclomatic_complexity + + +Changes +------- + +0.7.0 - 2021-01-23 +`````````````````` + +* Drop support for all versions of Python lower than 3.6 + +* Add support for Python 3.8, 3.9, and 3.10 + +* Fix option declaration for Flake8 + +0.6.1 - 2017-01-26 +`````````````````` + +* Fix signature for ``PathGraphingAstVisitor.default`` to match the signature + for ``ASTVisitor`` + +0.6.0 - 2017-01-23 +`````````````````` + +* Add support for Python 3.6 + +* Fix handling for missing statement types + +0.5.3 - 2016-12-14 +`````````````````` + +* Report actual column number of violation instead of the start of the line + +0.5.2 - 2016-07-31 +`````````````````` + +* When opening files ourselves, make sure we always name the file variable + +0.5.1 - 2016-07-28 +`````````````````` + +* Set default maximum complexity to -1 on the class itself + +0.5.0 - 2016-05-30 +`````````````````` + +* PyCon 2016 PDX release + +* Add support for Flake8 3.0 + +0.4.0 - 2016-01-27 +`````````````````` + +* Stop testing on Python 3.2 + +* Add support for async/await keywords on Python 3.5 from PEP 0492 + +0.3.1 - 2015-06-14 +`````````````````` + +* Include ``test_mccabe.py`` in releases. + +* Always coerce the ``max_complexity`` value from Flake8's entry-point to an + integer. + +0.3 - 2014-12-17 +```````````````` + +* Computation was wrong: the mccabe complexity starts at 1, not 2. + +* The ``max-complexity`` value is now inclusive. E.g.: if the + value is 10 and the reported complexity is 10, then it passes. + +* Add tests. + + +0.2.1 - 2013-04-03 +`````````````````` + +* Do not require ``setuptools`` in setup.py. It works around an issue + with ``pip`` and Python 3. + + +0.2 - 2013-02-22 +```````````````` + +* Rename project to ``mccabe``. + +* Provide ``flake8.extension`` setuptools entry point. + +* Read ``max-complexity`` from the configuration file. + +* Rename argument ``min_complexity`` to ``threshold``. + + +0.1 - 2013-02-11 +```````````````` +* First release + + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mccabe-0.6.1/mccabe.py new/mccabe-0.7.0/mccabe.py --- old/mccabe-0.6.1/mccabe.py 2017-01-26 23:10:14.000000000 +0100 +++ new/mccabe-0.7.0/mccabe.py 2022-01-24 02:08:10.000000000 +0100 @@ -16,7 +16,7 @@ except ImportError: # Python 2.5 from flake8.util import ast, iter_child_nodes -__version__ = '0.6.1' +__version__ = '0.7.0' class ASTVisitor(object): @@ -242,7 +242,7 @@ kwargs = { 'default': -1, 'action': 'store', - 'type': 'int', + 'type': int, 'help': 'McCabe complexity threshold', 'parse_from_config': 'True', } @@ -291,8 +291,7 @@ def get_module_complexity(module_path, threshold=7): """Returns the complexity of a module""" - with open(module_path, "rU") as mod: - code = mod.read() + code = _read(module_path) return get_code_complexity(code, threshold, filename=module_path) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mccabe-0.6.1/setup.cfg new/mccabe-0.7.0/setup.cfg --- old/mccabe-0.6.1/setup.cfg 2017-01-26 23:13:05.000000000 +0100 +++ new/mccabe-0.7.0/setup.cfg 2022-01-24 02:12:04.795890800 +0100 @@ -1,8 +1,8 @@ -[wheel] +[bdist_wheel] universal = 1 -[aliases] -test = pytest +[metadata] +license_file = LICENSE [egg_info] tag_build = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mccabe-0.6.1/setup.py new/mccabe-0.7.0/setup.py --- old/mccabe-0.6.1/setup.py 2017-01-23 13:24:16.000000000 +0100 +++ new/mccabe-0.7.0/setup.py 2022-01-24 02:07:47.000000000 +0100 @@ -4,57 +4,54 @@ from setuptools import setup -def get_version(fname='mccabe.py'): +def get_version(fname="mccabe.py"): with open(fname) as f: for line in f: - if line.startswith('__version__'): - return eval(line.split('=')[-1]) + if line.startswith("__version__"): + return eval(line.split("=")[-1]) def get_long_description(): descr = [] - for fname in ('README.rst',): + for fname in ("README.rst",): with open(fname) as f: descr.append(f.read()) - return '\n\n'.join(descr) + return "\n\n".join(descr) setup( - name='mccabe', + name="mccabe", version=get_version(), description="McCabe checker, plugin for flake8", long_description=get_long_description(), - keywords='flake8 mccabe', - author='Tarek Ziade', - author_email='[email protected]', - maintainer='Ian Cordasco', - maintainer_email='[email protected]', - url='https://github.com/pycqa/mccabe', - license='Expat license', - py_modules=['mccabe'], + keywords="flake8 mccabe", + author="Tarek Ziade", + author_email="[email protected]", + maintainer="Ian Stapleton Cordasco", + maintainer_email="[email protected]", + url="https://github.com/pycqa/mccabe", + license="Expat license", + py_modules=["mccabe"], zip_safe=False, - setup_requires=['pytest-runner'], - tests_require=['pytest'], entry_points={ - 'flake8.extension': [ - 'C90 = mccabe:McCabeChecker', + "flake8.extension": [ + "C90 = mccabe:McCabeChecker", ], }, classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Environment :: Console', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Topic :: Software Development :: Libraries :: Python Modules', - 'Topic :: Software Development :: Quality Assurance', + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Software Development :: Quality Assurance", ], + python_requires=">=3.6", ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mccabe-0.6.1/test_mccabe.py new/mccabe-0.7.0/test_mccabe.py --- old/mccabe-0.6.1/test_mccabe.py 2017-01-23 13:24:16.000000000 +0100 +++ new/mccabe-0.7.0/test_mccabe.py 2022-01-24 01:48:32.000000000 +0100 @@ -1,11 +1,17 @@ import unittest import sys + try: from StringIO import StringIO except ImportError: from io import StringIO import pytest +try: + import hypothesmith + from hypothesis import HealthCheck, given, settings, strategies as st +except ImportError: + hypothesmith = None import mccabe from mccabe import get_code_complexity @@ -18,7 +24,7 @@ expr_as_statement = '''\ def f(): - """docstring""" + 0xF00D ''' @@ -229,6 +235,45 @@ mccabe.McCabeChecker.parse_options(options) self.assertEqual(16, mccabe.McCabeChecker.max_complexity) + def test_get_module_complexity(self): + self.assertEqual(0, mccabe.get_module_complexity("mccabe.py")) + + +# This test uses the Hypothesis and Hypothesmith libraries to generate random +# syntatically-valid Python source code and applies McCabe on it. +@settings( + max_examples=1000, # roughly 1k tests/minute, or half that under coverage + derandomize=False, # deterministic mode to avoid CI flakiness + deadline=None, # ignore Hypothesis' health checks; we already know that + suppress_health_check=HealthCheck.all(), # this is slow and filter-heavy. +) +@given( + # Note that while Hypothesmith might generate code unlike that written by + # humans, it's a general test that should pass for any *valid* source code. + # (so e.g. running it against code scraped of the internet might also help) + src_contents=hypothesmith.from_grammar() | hypothesmith.from_node(), + max_complexity=st.integers(min_value=1), +) [email protected](not hypothesmith, reason="hypothesmith could not be imported") +def test_idempotent_any_syntatically_valid_python( + src_contents: str, max_complexity: int +) -> None: + """Property-based tests for mccabe. + + This test case is based on a similar test for Black, the code formatter. + Black's test was written by Zac Hatfield-Dodds, the author of Hypothesis + and the Hypothesmith tool for source code generation. You can run this + file with `python`, `pytest`, or (soon) a coverage-guided fuzzer Zac is + working on. + """ + + # Before starting, let's confirm that the input string is valid Python: + compile(src_contents, "<string>", "exec") # else bug is in hypothesmith + + # Then try to apply get_complexity_number to the code... + get_code_complexity(src_contents, max_complexity) + if __name__ == "__main__": + test_idempotent_any_syntatically_valid_python() unittest.main()
