Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py

changeset 6786
701b511ba8f5
parent 6645
ad476851d7e0
child 6789
6bafe4f7d5f0
equal deleted inserted replaced
6783:d8a0d75aaf01 6786:701b511ba8f5
144 @type str 144 @type str
145 @param source string containing the code to check 145 @param source string containing the code to check
146 @type str 146 @type str
147 @param args arguments used by the codeStyleCheck function (list of 147 @param args arguments used by the codeStyleCheck function (list of
148 excludeMessages, includeMessages, repeatMessages, fixCodes, 148 excludeMessages, includeMessages, repeatMessages, fixCodes,
149 noFixCodes, fixIssues, maxLineLength, blankLines, hangClosing, 149 noFixCodes, fixIssues, maxLineLength, maxDocLineLength, blankLines,
150 docType, codeComplexityArgs, miscellaneousArgs, errors, eol, 150 hangClosing, docType, codeComplexityArgs, miscellaneousArgs, errors,
151 encoding, backup) 151 eol, encoding, backup)
152 @type list of (str, str, bool, str, str, bool, int, list of (int, int), 152 @type list of (str, str, bool, str, str, bool, int, list of (int, int),
153 bool, str, dict, dict, list of str, str, str, bool) 153 bool, str, dict, dict, list of str, str, str, bool)
154 @return tuple of statistics (dict) and list of results (tuple for each 154 @return tuple of statistics (dict) and list of results (tuple for each
155 found violation of style (lineno, position, text, ignored, fixed, 155 found violation of style (lineno, position, text, ignored, fixed,
156 autofixing, fixedMsg)) 156 autofixing, fixedMsg))
251 @type str 251 @type str
252 @param source string containing the code to check 252 @param source string containing the code to check
253 @type str 253 @type str
254 @param args arguments used by the codeStyleCheck function (list of 254 @param args arguments used by the codeStyleCheck function (list of
255 excludeMessages, includeMessages, repeatMessages, fixCodes, 255 excludeMessages, includeMessages, repeatMessages, fixCodes,
256 noFixCodes, fixIssues, maxLineLength, blankLines, hangClosing, 256 noFixCodes, fixIssues, maxLineLength, maxDocLineLength, blankLines,
257 docType, codeComplexityArgs, miscellaneousArgs, errors, eol, 257 hangClosing, docType, codeComplexityArgs, miscellaneousArgs, errors,
258 encoding, backup) 258 eol, encoding, backup)
259 @type list of (str, str, bool, str, str, bool, int, list of (int, int), 259 @type list of (str, str, bool, str, str, bool, int, list of (int, int),
260 bool, str, dict, dict, list of str, str, str, bool) 260 bool, str, dict, dict, list of str, str, str, bool)
261 @return tuple of statistics (dict) and list of results (tuple for each 261 @return tuple of statistics (dict) and list of results (tuple for each
262 found violation of style (lineno, position, text, ignored, fixed, 262 found violation of style (lineno, position, text, ignored, fixed,
263 autofixing, fixedMsg)) 263 autofixing, fixedMsg))
264 @rtype tuple of (dict, list of tuples of (int, int, str, bool, bool, bool, 264 @rtype tuple of (dict, list of tuples of (int, int, str, bool, bool, bool,
265 str)) 265 str))
266 """ 266 """
267 (excludeMessages, includeMessages, repeatMessages, fixCodes, noFixCodes, 267 (excludeMessages, includeMessages, repeatMessages, fixCodes, noFixCodes,
268 fixIssues, maxLineLength, blankLines, hangClosing, docType, 268 fixIssues, maxLineLength, maxDocLineLength, blankLines, hangClosing, docType,
269 codeComplexityArgs, miscellaneousArgs, errors, eol, encoding, 269 codeComplexityArgs, miscellaneousArgs, errors, eol, encoding,
270 backup) = args 270 backup) = args
271 271
272 stats = {} 272 stats = {}
273 273
311 reporter=CodeStyleCheckerReport, 311 reporter=CodeStyleCheckerReport,
312 repeat=repeatMessages, 312 repeat=repeatMessages,
313 select=select, 313 select=select,
314 ignore=ignore, 314 ignore=ignore,
315 max_line_length=maxLineLength, 315 max_line_length=maxLineLength,
316 max_doc_length=maxDocLineLength,
316 hang_closing=hangClosing, 317 hang_closing=hangClosing,
317 ) 318 )
318 report = styleGuide.check_files([filename]) 319 report = styleGuide.check_files([filename])
319 stats.update(report.counters) 320 stats.update(report.counters)
320 errors = report.errors 321 errors = report.errors
321 322
322 # check documentation style 323 # check documentation style
323 docStyleChecker = DocStyleChecker( 324 docStyleChecker = DocStyleChecker(
324 source, filename, select, ignore, [], repeatMessages, 325 source, filename, select, ignore, [], repeatMessages,
325 maxLineLength=maxLineLength, docType=docType) 326 maxLineLength=maxDocLineLength, docType=docType)
326 docStyleChecker.run() 327 docStyleChecker.run()
327 stats.update(docStyleChecker.counters) 328 stats.update(docStyleChecker.counters)
328 errors += docStyleChecker.errors 329 errors += docStyleChecker.errors
329 330
330 # miscellaneous additional checks 331 # miscellaneous additional checks

eric ide

mercurial