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

branch
eric7
changeset 10052
041d0785dd42
parent 10046
35b27af462ef
child 10059
9e3452188615
equal deleted inserted replaced
10051:1128cb7bbb42 10052:041d0785dd42
23 from NameOrder.NameOrderChecker import NameOrderChecker 23 from NameOrder.NameOrderChecker import NameOrderChecker
24 from Naming.NamingStyleChecker import NamingStyleChecker 24 from Naming.NamingStyleChecker import NamingStyleChecker
25 from PathLib.PathlibChecker import PathlibChecker 25 from PathLib.PathlibChecker import PathlibChecker
26 from Security.SecurityChecker import SecurityChecker 26 from Security.SecurityChecker import SecurityChecker
27 from Simplify.SimplifyChecker import SimplifyChecker 27 from Simplify.SimplifyChecker import SimplifyChecker
28 from Unused.UnusedChecker import UnusedChecker
28 29
29 # register the name checker 30 # register the name checker
30 pycodestyle.register_check(NamingStyleChecker, NamingStyleChecker.Codes) 31 pycodestyle.register_check(NamingStyleChecker, NamingStyleChecker.Codes)
31 32
32 33
190 @type str 191 @type str
191 @param args arguments used by the codeStyleCheck function (list of 192 @param args arguments used by the codeStyleCheck function (list of
192 excludeMessages, includeMessages, repeatMessages, fixCodes, 193 excludeMessages, includeMessages, repeatMessages, fixCodes,
193 noFixCodes, fixIssues, maxLineLength, maxDocLineLength, blankLines, 194 noFixCodes, fixIssues, maxLineLength, maxDocLineLength, blankLines,
194 hangClosing, docType, codeComplexityArgs, miscellaneousArgs, 195 hangClosing, docType, codeComplexityArgs, miscellaneousArgs,
195 annotationArgs, securityArgs, importsArgs, nameOrderArgs, errors, eol, encoding, 196 annotationArgs, securityArgs, importsArgs, nameOrderArgs, unusedArgs, errors,
196 backup) 197 eol, encoding, backup)
197 @type list of (str, str, bool, str, str, bool, int, list of (int, int), 198 @type list of (str, str, bool, str, str, bool, int, list of (int, int),
198 bool, str, dict, dict, dict, dict, dict, list of str, str, str, bool) 199 bool, str, dict, dict, dict, dict, dict, dict, list of str, str, str, bool)
199 @return tuple of statistics (dict) and list of results (tuple for each 200 @return tuple of statistics (dict) and list of results (tuple for each
200 found violation of style (lineno, position, text, ignored, fixed, 201 found violation of style (lineno, position, text, ignored, fixed,
201 autofixing, fixedMsg)) 202 autofixing, fixedMsg))
202 @rtype tuple of (dict, list of tuples of (int, int, str, bool, bool, bool, 203 @rtype tuple of (dict, list of tuples of (int, int, str, bool, bool, bool,
203 str)) 204 str))
354 @type str 355 @type str
355 @param args arguments used by the codeStyleCheck function (list of 356 @param args arguments used by the codeStyleCheck function (list of
356 excludeMessages, includeMessages, repeatMessages, fixCodes, 357 excludeMessages, includeMessages, repeatMessages, fixCodes,
357 noFixCodes, fixIssues, maxLineLength, maxDocLineLength, blankLines, 358 noFixCodes, fixIssues, maxLineLength, maxDocLineLength, blankLines,
358 hangClosing, docType, codeComplexityArgs, miscellaneousArgs, 359 hangClosing, docType, codeComplexityArgs, miscellaneousArgs,
359 annotationArgs, securityArgs, importsArgs, nameOrderArgs, errors, eol, encoding, 360 annotationArgs, securityArgs, importsArgs, nameOrderArgs, unusedArgs, errors,
360 backup) 361 eol, encoding, backup)
361 @type list of (str, str, bool, str, str, bool, int, list of (int, int), 362 @type list of (str, str, bool, str, str, bool, int, list of (int, int),
362 bool, str, dict, dict, dict, dict, dict, list of str, str, str, bool) 363 bool, str, dict, dict, dict, dict, dict, dict, list of str, str, str, bool)
363 @return tuple of statistics data and list of result dictionaries with 364 @return tuple of statistics data and list of result dictionaries with
364 keys: 365 keys:
365 <ul> 366 <ul>
366 <li>file: file name</li> 367 <li>file: file name</li>
367 <li>line: line_number</li> 368 <li>line: line_number</li>
392 miscellaneousArgs, 393 miscellaneousArgs,
393 annotationArgs, 394 annotationArgs,
394 securityArgs, 395 securityArgs,
395 importsArgs, 396 importsArgs,
396 nameOrderArgs, 397 nameOrderArgs,
398 unusedArgs,
397 errors, 399 errors,
398 eol, 400 eol,
399 encoding, 401 encoding,
400 backup, 402 backup,
401 ) = args 403 ) = args
556 nameOrderArgs, 558 nameOrderArgs,
557 ) 559 )
558 nameOrderChecker.run() 560 nameOrderChecker.run()
559 stats.update(nameOrderChecker.counters) 561 stats.update(nameOrderChecker.counters)
560 errors += nameOrderChecker.errors 562 errors += nameOrderChecker.errors
563
564 # check unused arguments and variables
565 # TODO: not yet implemented
566 unusedChecker = UnusedChecker(
567 source,
568 filename,
569 tree,
570 select,
571 ignore,
572 [],
573 repeatMessages,
574 unusedArgs,
575 )
576 unusedChecker.run()
577 stats.update(unusedChecker.counters)
578 errors += unusedChecker.errors
561 579
562 elif syntaxError: 580 elif syntaxError:
563 errors = [syntaxError] 581 errors = [syntaxError]
564 stats.update(syntaxStats) 582 stats.update(syntaxStats)
565 583

eric ide

mercurial