66 (self.__checkCoding, ("M101", "M102")), |
67 (self.__checkCoding, ("M101", "M102")), |
67 (self.__checkCopyright, ("M111", "M112")), |
68 (self.__checkCopyright, ("M111", "M112")), |
68 (self.__checkBlindExcept, ("M121",)), |
69 (self.__checkBlindExcept, ("M121",)), |
69 (self.__checkPep3101, ("M131",)), |
70 (self.__checkPep3101, ("M131",)), |
70 (self.__checkPrintStatements, ("M801",)), |
71 (self.__checkPrintStatements, ("M801",)), |
|
72 (self.__checkTuple, ("M811", )), |
71 ] |
73 ] |
72 |
74 |
73 self.__defaultArgs = { |
75 self.__defaultArgs = { |
74 "CodingChecker": 'latin-1, utf-8', |
76 "CodingChecker": 'latin-1, utf-8', |
75 "CopyrightChecker": { |
77 "CopyrightChecker": { |
251 for node in ast.walk(self.__tree): |
253 for node in ast.walk(self.__tree): |
252 if (isinstance(node, ast.Call) and |
254 if (isinstance(node, ast.Call) and |
253 getattr(node.func, 'id', None) == 'print') or \ |
255 getattr(node.func, 'id', None) == 'print') or \ |
254 (hasattr(ast, 'Print') and isinstance(node, ast.Print)): |
256 (hasattr(ast, 'Print') and isinstance(node, ast.Print)): |
255 self.__error(node.lineno - 1, node.col_offset, "M801") |
257 self.__error(node.lineno - 1, node.col_offset, "M801") |
|
258 |
|
259 def __checkTuple(self): |
|
260 """ |
|
261 Private method to check for one element tuples. |
|
262 """ |
|
263 for node in ast.walk(self.__tree): |
|
264 if isinstance(node, ast.Tuple) and \ |
|
265 len(node.elts) == 1: |
|
266 self.__error(node.lineno - 1, node.col_offset, "M811") |