Commits

Steven Kryskalla committed 1e1a56f

add warning code W901 to mccabe

  • Participants
  • Parent commits b544590

Comments (0)

Files changed (1)

File flake8/mccabe.py

 import sys
 from collections import defaultdict
 
+WARNING_CODE = "W901"
+
 
 class ASTVisitor:
 
 
 
 class PathGraph:
-    def __init__(self, name):
+    def __init__(self, name, entity, lineno):
         self.name = name
+        self.entity = entity
+        self.lineno = lineno
         self.nodes = defaultdict(list)
 
     def connect(self, n1, n2):
             self.graph.connect(pathnode, bottom)
             self.tail = bottom
         else:
-            self.graph = PathGraph(name)
+            self.graph = PathGraph(name, entity, node.lineno)
             pathnode = PathNode(name)
             self.tail = pathnode
             self.default(node)
 
         if self.graph is None:
             # global loop
-            self.graph = PathGraph(name)
+            self.graph = PathGraph(name, name, node.lineno)
             pathnode = PathNode(name)
             self.tail = pathnode
             self.default(node)
             # ?
             continue
         if graph.complexity() >= min:
-            msg = '%s:%s is too complex (%d)' % (filename,
-                    graph.name, graph.complexity())
+            msg = '%s:%d:1 %s %r is too complex (%d)' % (
+                filename,
+                graph.lineno,
+                WARNING_CODE,
+                graph.entity,
+                graph.complexity(),
+            )
             complex.append(msg)
 
     if len(complex) == 0: