Plugins/CheckerPlugins/CodeStyleChecker/McCabeChecker.py

branch
6_1_x
changeset 4557
893c9f26a178
parent 4541
e8ddd9d76414
child 4631
5c1a96925da4
equal deleted inserted replaced
4551:31115c8c20fc 4557:893c9f26a178
4 # 4 #
5 5
6 """ 6 """
7 Module implementing a checker for code complexity. 7 Module implementing a checker for code complexity.
8 """ 8 """
9
10 from __future__ import unicode_literals
11 9
12 import sys 10 import sys
13 import ast 11 import ast
14 12
15 from mccabe import PathGraphingAstVisitor 13 from mccabe import PathGraphingAstVisitor
122 visitor.preorder(tree, visitor) 120 visitor.preorder(tree, visitor)
123 for graph in visitor.graphs.values(): 121 for graph in visitor.graphs.values():
124 if graph.complexity() > self.__maxComplexity: 122 if graph.complexity() > self.__maxComplexity:
125 self.__error(graph.lineno, 0, "C101", 123 self.__error(graph.lineno, 0, "C101",
126 graph.entity, graph.complexity()) 124 graph.entity, graph.complexity())
125
126 #
127 # eflag: noqa = M702

eric ide

mercurial