24 from Logging.LoggingChecker import LoggingChecker |
24 from Logging.LoggingChecker import LoggingChecker |
25 from Miscellaneous.MiscellaneousChecker import MiscellaneousChecker |
25 from Miscellaneous.MiscellaneousChecker import MiscellaneousChecker |
26 from NameOrder.NameOrderChecker import NameOrderChecker |
26 from NameOrder.NameOrderChecker import NameOrderChecker |
27 from Naming.NamingStyleChecker import NamingStyleChecker |
27 from Naming.NamingStyleChecker import NamingStyleChecker |
28 from PathLib.PathlibChecker import PathlibChecker |
28 from PathLib.PathlibChecker import PathlibChecker |
|
29 from Pydantic.PydanticChecker import PydanticChecker |
29 from Security.SecurityChecker import SecurityChecker |
30 from Security.SecurityChecker import SecurityChecker |
30 from Simplify.SimplifyChecker import SimplifyChecker |
31 from Simplify.SimplifyChecker import SimplifyChecker |
31 from Unused.UnusedChecker import UnusedChecker |
32 from Unused.UnusedChecker import UnusedChecker |
32 |
|
33 # register the name checker |
|
34 pycodestyle.register_check(NamingStyleChecker, NamingStyleChecker.Codes) |
|
35 |
33 |
36 |
34 |
37 def initService(): |
35 def initService(): |
38 """ |
36 """ |
39 Initialize the service and return the entry point. |
37 Initialize the service and return the entry point. |
457 "method": blankLines[1], |
455 "method": blankLines[1], |
458 } |
456 } |
459 styleGuide = pycodestyle.StyleGuide( |
457 styleGuide = pycodestyle.StyleGuide( |
460 reporter=CodeStyleCheckerReport, |
458 reporter=CodeStyleCheckerReport, |
461 repeat=repeatMessages, |
459 repeat=repeatMessages, |
462 select=select, |
460 select=[], |
463 ignore=ignore, |
461 ignore=[x for x in ignore if x.startswith(("E", "W"))], |
464 max_line_length=maxLineLength, |
462 max_line_length=maxLineLength, |
465 max_doc_length=maxDocLineLength, |
463 max_doc_length=maxDocLineLength, |
466 hang_closing=hangClosing, |
464 hang_closing=hangClosing, |
467 ) |
465 ) |
468 report = styleGuide.options.report |
466 report = styleGuide.options.report |
553 ) |
551 ) |
554 importsChecker.run() |
552 importsChecker.run() |
555 stats.update(importsChecker.counters) |
553 stats.update(importsChecker.counters) |
556 errors += importsChecker.errors |
554 errors += importsChecker.errors |
557 |
555 |
|
556 # check naming style |
|
557 namingStyleChecker = NamingStyleChecker( |
|
558 source, |
|
559 filename, |
|
560 tree, |
|
561 select, |
|
562 ignore, |
|
563 [], |
|
564 repeatMessages, |
|
565 {}, # no arguments yet |
|
566 ) |
|
567 namingStyleChecker.run() |
|
568 stats.update(namingStyleChecker.counters) |
|
569 errors += namingStyleChecker.errors |
|
570 |
558 # check name ordering |
571 # check name ordering |
559 nameOrderChecker = NameOrderChecker( |
572 nameOrderChecker = NameOrderChecker( |
560 source, |
573 source, |
561 filename, |
574 filename, |
562 tree, |
575 tree, |
612 {}, # no arguments yet |
625 {}, # no arguments yet |
613 ) |
626 ) |
614 loggingChecker.run() |
627 loggingChecker.run() |
615 stats.update(loggingChecker.counters) |
628 stats.update(loggingChecker.counters) |
616 errors += loggingChecker.errors |
629 errors += loggingChecker.errors |
|
630 |
|
631 # check 'pydantic' related topics |
|
632 pydanticChecker = PydanticChecker( |
|
633 source, |
|
634 filename, |
|
635 tree, |
|
636 select, |
|
637 ignore, |
|
638 [], |
|
639 repeatMessages, |
|
640 {}, # no arguments yet |
|
641 ) |
|
642 pydanticChecker.run() |
|
643 stats.update(pydanticChecker.counters) |
|
644 errors += pydanticChecker.errors |
617 |
645 |
618 elif syntaxError: |
646 elif syntaxError: |
619 errors = [syntaxError] |
647 errors = [syntaxError] |
620 stats.update(syntaxStats) |
648 stats.update(syntaxStats) |
621 |
649 |