Plugins/CheckerPlugins/CodeStyleChecker/McCabeChecker.py

changeset 4555
861e1741985c
parent 4543
2e6a880670e9
child 4631
5c1a96925da4
equal deleted inserted replaced
4554:f3428ddd577c 4555:861e1741985c
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