src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py

branch
eric7
changeset 11147
dee6e106b4d3
parent 11142
2f0fb22c1d63
child 11150
73d80859079c
equal deleted inserted replaced
11146:59e04f7003e9 11147:dee6e106b4d3
67 super().__init__(options) 67 super().__init__(options)
68 68
69 self.__repeat = options.repeat 69 self.__repeat = options.repeat
70 self.errors = [] 70 self.errors = []
71 71
72 def error_args(self, line_number, offset, errorCode, check, *args): 72 def error_args(self, line_number, offset, text, _check, *args):
73 """ 73 """
74 Public method to collect the error messages. 74 Public method to collect the error messages.
75 75
76 @param line_number line number of the issue 76 @param line_number line number of the issue
77 @type int 77 @type int
78 @param offset position within line of the issue 78 @param offset position within line of the issue
79 @type int 79 @type int
80 @param errorCode error message code 80 @param text issue message code or issue text
81 @type str 81 @type str
82 @param check reference to the checker function 82 @param _check reference to the checker function
83 @type function 83 @type function
84 @param args arguments for the message 84 @param args arguments for the message
85 @type list 85 @type list
86 @return error code 86 @return error code
87 @rtype str 87 @rtype str
88 """ 88 """
89 errorCode = super().error_args(line_number, offset, errorCode, check, *args) 89 code = text.split(None, 1)[0]
90 errorCode = code[0] + "-" + code[1:]
91 if self._ignore_code(errorCode):
92 return None
93 if errorCode in self.counters:
94 self.counters[errorCode] += 1
95 else:
96 self.counters[errorCode] = 1
97 # Don't care about expected errors or warnings
98 if errorCode in self.expected:
99 return None
90 if errorCode and (self.counters[errorCode] == 1 or self.__repeat): 100 if errorCode and (self.counters[errorCode] == 1 or self.__repeat):
91 self.errors.append( 101 self.errors.append(
92 { 102 {
93 "file": self.filename, 103 "file": self.filename,
94 "line": line_number, 104 "line": line_number,
345 return ( 355 return (
346 { 356 {
347 "file": filename, 357 "file": filename,
348 "line": offset[0], 358 "line": offset[0],
349 "offset": offset[1], 359 "offset": offset[1],
350 "code": "E901", 360 "code": "E-901",
351 "args": [exc_type.__name__, exc.args[0]], 361 "args": [exc_type.__name__, exc.args[0]],
352 }, 362 },
353 { 363 {
354 "E901": 1, 364 "E-901": 1,
355 }, 365 },
356 None, 366 None,
357 ) 367 )
358 368
359 369

eric ide

mercurial