Hello community,

here is the log from the commit of package python-mccabe for openSUSE:Factory 
checked in at 2015-05-15 09:03:03
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-mccabe (Old)
 and      /work/SRC/openSUSE:Factory/.python-mccabe.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-mccabe"

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-mccabe/python-mccabe.changes      
2013-10-25 11:21:49.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.python-mccabe.new/python-mccabe.changes 
2015-05-15 09:03:05.000000000 +0200
@@ -1,0 +2,10 @@
+Thu May  7 16:34:53 UTC 2015 - benoit.mo...@gmx.fr
+
+- update to version 0.3:
+  * 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
+- add the LICENSE to the package documentation
+
+-------------------------------------------------------------------

Old:
----
  mccabe-0.2.1.tar.gz

New:
----
  mccabe-0.3.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-mccabe.spec ++++++
--- /var/tmp/diff_new_pack.H1u2Be/_old  2015-05-15 09:03:07.000000000 +0200
+++ /var/tmp/diff_new_pack.H1u2Be/_new  2015-05-15 09:03:07.000000000 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python-mccabe
 #
-# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           python-mccabe
-Version:        0.2.1
+Version:        0.3
 Release:        0
 Summary:        McCabe checker, plugin for flake8
 License:        MIT
@@ -48,7 +48,7 @@
 
 %files
 %defattr(-,root,root,-)
-%doc README.rst
+%doc LICENSE README.rst
 %{python_sitelib}/*
 
 %changelog

++++++ mccabe-0.2.1.tar.gz -> mccabe-0.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mccabe-0.2.1/LICENSE new/mccabe-0.3/LICENSE
--- old/mccabe-0.2.1/LICENSE    1970-01-01 01:00:00.000000000 +0100
+++ new/mccabe-0.3/LICENSE      2014-04-25 22:47:01.000000000 +0200
@@ -0,0 +1,25 @@
+Copyright © <year> Ned Batchelder
+Copyright © 2011-2013 Tarek Ziade <ta...@ziade.org>
+Copyright © 2013 Florent Xicluna <florent.xicl...@gmail.com>
+
+Licensed under the terms of the Expat License
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation files
+(the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mccabe-0.2.1/MANIFEST.in new/mccabe-0.3/MANIFEST.in
--- old/mccabe-0.2.1/MANIFEST.in        1970-01-01 01:00:00.000000000 +0100
+++ new/mccabe-0.3/MANIFEST.in  2014-04-25 22:47:01.000000000 +0200
@@ -0,0 +1 @@
+include LICENSE README.rst
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mccabe-0.2.1/PKG-INFO new/mccabe-0.3/PKG-INFO
--- old/mccabe-0.2.1/PKG-INFO   2013-04-03 14:52:28.000000000 +0200
+++ new/mccabe-0.3/PKG-INFO     2014-12-17 02:23:10.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: mccabe
-Version: 0.2.1
+Version: 0.3
 Summary: McCabe checker, plugin for flake8
 Home-page: https://github.com/flintwork/mccabe
 Author: Florent Xicluna
@@ -55,7 +55,7 @@
             ...
             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 to detect over-complex code.  According 
to McCabe,
         anything that goes beyond 10 is too complex.
         
         
@@ -73,6 +73,17 @@
         Changes
         -------
         
+        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
         ``````````````````
         
@@ -83,7 +94,7 @@
         0.2 - 2013-02-22
         ````````````````
         
-        * Rename project ``flint-mccabe`` to ``mccabe``.
+        * Rename project to ``mccabe``.
         
         * Provide ``flake8.extension`` setuptools entry point.
         
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mccabe-0.2.1/README.rst new/mccabe-0.3/README.rst
--- old/mccabe-0.2.1/README.rst 2013-04-03 14:48:12.000000000 +0200
+++ new/mccabe-0.3/README.rst   2014-12-17 01:15:26.000000000 +0100
@@ -47,7 +47,7 @@
     ...
     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 to detect over-complex code.  According to McCabe,
 anything that goes beyond 10 is too complex.
 
 
@@ -65,6 +65,17 @@
 Changes
 -------
 
+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
 ``````````````````
 
@@ -75,7 +86,7 @@
 0.2 - 2013-02-22
 ````````````````
 
-* Rename project ``flint-mccabe`` to ``mccabe``.
+* Rename project to ``mccabe``.
 
 * Provide ``flake8.extension`` setuptools entry point.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mccabe-0.2.1/mccabe.egg-info/PKG-INFO 
new/mccabe-0.3/mccabe.egg-info/PKG-INFO
--- old/mccabe-0.2.1/mccabe.egg-info/PKG-INFO   2013-04-03 14:52:28.000000000 
+0200
+++ new/mccabe-0.3/mccabe.egg-info/PKG-INFO     2014-12-17 02:23:10.000000000 
+0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: mccabe
-Version: 0.2.1
+Version: 0.3
 Summary: McCabe checker, plugin for flake8
 Home-page: https://github.com/flintwork/mccabe
 Author: Florent Xicluna
@@ -55,7 +55,7 @@
             ...
             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 to detect over-complex code.  According 
to McCabe,
         anything that goes beyond 10 is too complex.
         
         
@@ -73,6 +73,17 @@
         Changes
         -------
         
+        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
         ``````````````````
         
@@ -83,7 +94,7 @@
         0.2 - 2013-02-22
         ````````````````
         
-        * Rename project ``flint-mccabe`` to ``mccabe``.
+        * Rename project to ``mccabe``.
         
         * Provide ``flake8.extension`` setuptools entry point.
         
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mccabe-0.2.1/mccabe.egg-info/SOURCES.txt 
new/mccabe-0.3/mccabe.egg-info/SOURCES.txt
--- old/mccabe-0.2.1/mccabe.egg-info/SOURCES.txt        2013-04-03 
14:52:28.000000000 +0200
+++ new/mccabe-0.3/mccabe.egg-info/SOURCES.txt  2014-12-17 02:23:10.000000000 
+0100
@@ -1,5 +1,8 @@
+LICENSE
+MANIFEST.in
 README.rst
 mccabe.py
+setup.cfg
 setup.py
 mccabe.egg-info/PKG-INFO
 mccabe.egg-info/SOURCES.txt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mccabe-0.2.1/mccabe.py new/mccabe-0.3/mccabe.py
--- old/mccabe-0.2.1/mccabe.py  2013-04-03 14:44:29.000000000 +0200
+++ new/mccabe-0.3/mccabe.py    2014-12-17 02:21:04.000000000 +0100
@@ -14,7 +14,7 @@
 except ImportError:   # Python 2.5
     from flake8.util import ast, iter_child_nodes
 
-__version__ = '0.2.1'
+__version__ = '0.3'
 
 
 class ASTVisitor(object):
@@ -67,6 +67,8 @@
 
     def connect(self, n1, n2):
         self.nodes[n1].append(n2)
+        # Ensure that the destination node is always counted.
+        self.nodes[n2] = []
 
     def to_dot(self):
         print('subgraph {')
@@ -160,34 +162,37 @@
 
     def visitLoop(self, node):
         name = "Loop %d" % node.lineno
+        self._subgraph(node, name)
 
+    visitFor = visitWhile = visitLoop
+
+    def visitIf(self, node):
+        name = "If %d" % node.lineno
+        self._subgraph(node, name)
+
+    def _subgraph(self, node, name, extra_blocks=()):
+        """create the subgraphs representing any `if` and `for` statements"""
         if self.graph is None:
             # global loop
             self.graph = PathGraph(name, name, node.lineno)
             pathnode = PathNode(name)
-            self.tail = pathnode
-            self.dispatch_list(node.body)
+            self._subgraph_parse(node, pathnode, extra_blocks)
             self.graphs["%s%s" % (self.classname, name)] = self.graph
             self.reset()
         else:
             pathnode = self.appendPathNode(name)
-            self.tail = pathnode
-            self.dispatch_list(node.body)
-            bottom = PathNode("", look='point')
-            self.graph.connect(self.tail, bottom)
-            self.graph.connect(pathnode, bottom)
-            self.tail = bottom
-
-        # TODO: else clause in node.orelse
-
-    visitFor = visitWhile = visitLoop
+            self._subgraph_parse(node, pathnode, extra_blocks)
 
-    def visitIf(self, node):
-        name = "If %d" % node.lineno
-        pathnode = self.appendPathNode(name)
+    def _subgraph_parse(self, node, pathnode, extra_blocks):
+        """parse the body and any `else` block of `if` and `for` statements"""
         loose_ends = []
+        self.tail = pathnode
         self.dispatch_list(node.body)
         loose_ends.append(self.tail)
+        for extra in extra_blocks:
+            self.tail = pathnode
+            self.dispatch_list(extra.body)
+            loose_ends.append(self.tail)
         if node.orelse:
             self.tail = pathnode
             self.dispatch_list(node.orelse)
@@ -202,19 +207,9 @@
 
     def visitTryExcept(self, node):
         name = "TryExcept %d" % node.lineno
-        pathnode = self.appendPathNode(name)
-        loose_ends = []
-        self.dispatch_list(node.body)
-        loose_ends.append(self.tail)
-        for handler in node.handlers:
-            self.tail = pathnode
-            self.dispatch_list(handler.body)
-            loose_ends.append(self.tail)
-        if pathnode:
-            bottom = PathNode("", look='point')
-            for le in loose_ends:
-                self.graph.connect(le, bottom)
-            self.tail = bottom
+        self._subgraph(node, name, extra_blocks=node.handlers)
+
+    visitTry = visitTryExcept
 
     def visitWith(self, node):
         name = "With %d" % node.lineno
@@ -249,7 +244,7 @@
         visitor = PathGraphingAstVisitor()
         visitor.preorder(self.tree, visitor)
         for graph in visitor.graphs.values():
-            if graph.complexity() >= self.max_complexity:
+            if graph.complexity() > self.max_complexity:
                 text = self._error_tmpl % (graph.entity, graph.complexity())
                 yield graph.lineno, 0, text, type(self)
 
@@ -280,13 +275,15 @@
     return get_code_complexity(code, threshold, filename=module_path)
 
 
-def main(argv):
+def main(argv=None):
+    if argv is None:
+        argv = sys.argv[1:]
     opar = optparse.OptionParser()
     opar.add_option("-d", "--dot", dest="dot",
                     help="output a graphviz dot file", action="store_true")
     opar.add_option("-m", "--min", dest="threshold",
                     help="minimum complexity for output", type="int",
-                    default=2)
+                    default=1)
 
     options, args = opar.parse_args(argv)
 
@@ -299,7 +296,7 @@
     if options.dot:
         print('graph {')
         for graph in visitor.graphs.values():
-            if graph.complexity() >= options.threshold:
+            if not options.threshold or graph.complexity() >= 
options.threshold:
                 graph.to_dot()
         print('}')
     else:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mccabe-0.2.1/setup.cfg new/mccabe-0.3/setup.cfg
--- old/mccabe-0.2.1/setup.cfg  2013-04-03 14:52:28.000000000 +0200
+++ new/mccabe-0.3/setup.cfg    2014-12-17 02:23:10.000000000 +0100
@@ -1,5 +1,8 @@
+[wheel]
+universal = 1
+
 [egg_info]
-tag_build = 
-tag_date = 0
 tag_svn_revision = 0
+tag_date = 0
+tag_build = 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mccabe-0.2.1/setup.py new/mccabe-0.3/setup.py
--- old/mccabe-0.2.1/setup.py   2013-04-03 14:41:57.000000000 +0200
+++ new/mccabe-0.3/setup.py     2014-04-25 23:21:22.000000000 +0200
@@ -1,5 +1,6 @@
 # -*- coding: utf-8 -*-
 from __future__ import with_statement
+
 from setuptools import setup
 
 
@@ -32,6 +33,7 @@
     license='Expat license',
     py_modules=['mccabe'],
     zip_safe=False,
+    test_suite='test_mccabe',
     entry_points={
         'flake8.extension': [
             'C90 = mccabe:McCabeChecker',


Reply via email to