Thu, 27 Feb 2025 14:42:39 +0100
Code Style Checkers
- Refactored the various code style checkers for better maintainability.
--- a/docs/ThirdParty.md Thu Feb 27 09:22:15 2025 +0100 +++ b/docs/ThirdParty.md Thu Feb 27 14:42:39 2025 +0100 @@ -27,6 +27,7 @@ | flake8-async | 22.11.14 | MIT License (MIT) | | flake8-bugbear | 24.12.12 | MIT License (MIT) | | flake8-comprehensions | 3.16.0 | MIT License (MIT) | +| flake8-datetimez | 20.10.0 | MIT License (MIT) | | flake8-future-annotations | 1.1.0 | MIT License (MIT) | | flake8-implicit-str-concat | 0.5.0 | MIT License (MIT) | | flake8-local-import | 1.0.6 | MIT License (MIT) | @@ -35,6 +36,7 @@ | flake8-pep585 | 0.1.7 | Mozilla Public License Version 2.0 | | flake8-pep604 | 1.1.0 | MIT License (MIT) | | flake8-pydantic | 0.4.0 | MIT License (MIT) | +| flake8-return | 1.2.0 | MIT License (MIT) | | flake8_simplify | 0.21.0 | MIT License (MIT) | | flake8-spm | 0.0.1 | MIT License (MIT) | | flake8-tidy-imports | 4.11.0 | MIT License (MIT) |
--- a/eric7.epj Thu Feb 27 09:22:15 2025 +0100 +++ b/eric7.epj Thu Feb 27 14:42:39 2025 +0100 @@ -1579,6 +1579,7 @@ "src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCodeSelectionDialog.py", "src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleFixer.py", "src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleStatisticsDialog.py", + "src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleTopicChecker.py", "src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Complexity/ComplexityChecker.py", "src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Complexity/__init__.py", "src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Complexity/mccabe.py", @@ -1594,8 +1595,14 @@ "src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Logging/LoggingVisitor.py", "src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Logging/__init__.py", "src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Logging/translations.py", + "src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/BugBearVisitor.py", + "src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/DateTimeVisitor.py", + "src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/DefaultMatchCaseVisitor.py", "src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/MiscellaneousChecker.py", "src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/MiscellaneousDefaults.py", + "src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/ReturnVisitor.py", + "src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/SysVersionVisitor.py", + "src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/TextVisitor.py", "src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/__init__.py", "src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/eradicate.py", "src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/translations.py",
--- a/src/eric7/APIs/Python3/eric7.api Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/APIs/Python3/eric7.api Thu Feb 27 14:42:39 2025 +0100 @@ -4137,8 +4137,8 @@ eric7.Plugins.AboutPlugin.AboutDialog.licenseText?7 eric7.Plugins.AboutPlugin.AboutDialog.thanksText?7 eric7.Plugins.AboutPlugin.AboutDialog.titleText?7 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsChecker.AnnotationsChecker.Category?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsChecker.AnnotationsChecker.Codes?7 -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsChecker.AnnotationsChecker.run?4() eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsChecker.AnnotationsChecker?1(source, filename, tree, select, ignore, expected, repeat, args) eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsCheckerDefaults.AnnotationsCheckerDefaultArgs?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsDeprecationsVisitor.AnnotationsDeprecationsVisitor.NameReplacements?7 @@ -4223,9 +4223,8 @@ eric7.Plugins.CheckerPlugins.CodeStyleChecker.AstUtilities.isNameConstant?4(node) eric7.Plugins.CheckerPlugins.CodeStyleChecker.AstUtilities.isNumber?4(node) eric7.Plugins.CheckerPlugins.CodeStyleChecker.AstUtilities.isString?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Async.AsyncChecker.AsyncChecker.Category?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.Async.AsyncChecker.AsyncChecker.Codes?7 -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Async.AsyncChecker.AsyncChecker.Prefix?7 -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Async.AsyncChecker.AsyncChecker.run?4() eric7.Plugins.CheckerPlugins.CodeStyleChecker.Async.AsyncChecker.AsyncChecker?1(source, filename, tree, select, ignore, expected, repeat, args) eric7.Plugins.CheckerPlugins.CodeStyleChecker.Async.AsyncVisitor.AsyncVisitor.HttpMethods?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.Async.AsyncVisitor.AsyncVisitor.HttpPackages?7 @@ -4242,7 +4241,7 @@ eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleAddBuiltinIgnoreDialog.CodeStyleAddBuiltinIgnoreDialog.on_leftEdit_textChanged?4(_txt) eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleAddBuiltinIgnoreDialog.CodeStyleAddBuiltinIgnoreDialog.on_rightEdit_textChanged?4(_txt) eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleAddBuiltinIgnoreDialog.CodeStyleAddBuiltinIgnoreDialog?1(parent=None) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleChecker.CodeStyleCheckerReport.error_args?4(line_number, offset, errorCode, check, *args) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleChecker.CodeStyleCheckerReport.error_args?4(line_number, offset, text, _check, *args) eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleChecker.CodeStyleCheckerReport?1(options) eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleChecker.codeStyleBatchCheck?4(argumentsList, send, fx, cancelled, maxProcesses=0) eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleChecker.codeStyleCheck?4(filename, source, args) @@ -4316,8 +4315,14 @@ eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleFixer.Reindenter.run?4() eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleFixer.Reindenter?1(sourceLines) eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleStatisticsDialog.CodeStyleStatisticsDialog?1(statisticData, parent=None) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleTopicChecker.CodeStyleTopicChecker._ignoreCode?5(code) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleTopicChecker.CodeStyleTopicChecker._initializeCheckers?5(checkersWithCodes) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleTopicChecker.CodeStyleTopicChecker.addError?4(lineNumber, offset, msgCode, *args) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleTopicChecker.CodeStyleTopicChecker.addErrorFromNode?4(node, msgCode, *args) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleTopicChecker.CodeStyleTopicChecker.run?4() +eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleTopicChecker.CodeStyleTopicChecker?1(category, source, filename, tree, select, ignore, expected, repeat, args) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Complexity.ComplexityChecker.ComplexityChecker.Category?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.Complexity.ComplexityChecker.ComplexityChecker.Codes?7 -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Complexity.ComplexityChecker.ComplexityChecker.run?4() eric7.Plugins.CheckerPlugins.CodeStyleChecker.Complexity.ComplexityChecker.ComplexityChecker?1(source, filename, tree, select, ignore, args) eric7.Plugins.CheckerPlugins.CodeStyleChecker.Complexity.ComplexityChecker.LineComplexityVisitor.score?4() eric7.Plugins.CheckerPlugins.CodeStyleChecker.Complexity.ComplexityChecker.LineComplexityVisitor.sortedList?4() @@ -4354,7 +4359,9 @@ eric7.Plugins.CheckerPlugins.CodeStyleChecker.Complexity.mccabe.PathNode?1(name, look="circle") eric7.Plugins.CheckerPlugins.CodeStyleChecker.Complexity.translations._complexityMessages?8 eric7.Plugins.CheckerPlugins.CodeStyleChecker.Complexity.translations._complexityMessagesSampleArgs?8 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.DocStyleChecker.DocStyleChecker.Category?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.DocStyleChecker.DocStyleChecker.Codes?7 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.DocStyleChecker.DocStyleChecker.addError?4(lineNumber, offset, msgCode, *args) eric7.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.DocStyleChecker.DocStyleChecker.run?4() eric7.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.DocStyleChecker.DocStyleChecker?1(source, filename, select, ignore, expected, repeat, maxLineLength=88, docType="pep257", ) eric7.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.DocStyleChecker.DocStyleContext.contextType?4() @@ -4368,8 +4375,8 @@ eric7.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.DocStyleChecker.DocStyleContext?1(source, startLine, contextType) eric7.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.translations._docStyleMessages?8 eric7.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.translations._docStyleMessagesSampleArgs?8 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Imports.ImportsChecker.ImportsChecker.Category?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.Imports.ImportsChecker.ImportsChecker.Codes?7 -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Imports.ImportsChecker.ImportsChecker.run?4() eric7.Plugins.CheckerPlugins.CodeStyleChecker.Imports.ImportsChecker.ImportsChecker?1(source, filename, tree, select, ignore, expected, repeat, args) eric7.Plugins.CheckerPlugins.CodeStyleChecker.Imports.LocalImportVisitor.LocalImportVisitor.visit?4(node) eric7.Plugins.CheckerPlugins.CodeStyleChecker.Imports.LocalImportVisitor.LocalImportVisitor.visit_FunctionDef?4(node) @@ -4378,8 +4385,8 @@ eric7.Plugins.CheckerPlugins.CodeStyleChecker.Imports.LocalImportVisitor.LocalImportVisitor?1(args, checker) eric7.Plugins.CheckerPlugins.CodeStyleChecker.Imports.translations._importsMessages?8 eric7.Plugins.CheckerPlugins.CodeStyleChecker.Imports.translations._importsMessagesSampleArgs?8 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Logging.LoggingChecker.LoggingChecker.Category?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.Logging.LoggingChecker.LoggingChecker.Codes?7 -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Logging.LoggingChecker.LoggingChecker.run?4() eric7.Plugins.CheckerPlugins.CodeStyleChecker.Logging.LoggingChecker.LoggingChecker?1(source, filename, tree, select, ignore, expected, repeat, args) eric7.Plugins.CheckerPlugins.CodeStyleChecker.Logging.LoggingVisitor.LoggingVisitor.GetLoggerNames?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.Logging.LoggingVisitor.LoggingVisitor.visit?4() @@ -4394,127 +4401,132 @@ eric7.Plugins.CheckerPlugins.CodeStyleChecker.Logging.LoggingVisitor._modposPlaceholderRe?5() eric7.Plugins.CheckerPlugins.CodeStyleChecker.Logging.translations._loggingMessages?8 eric7.Plugins.CheckerPlugins.CodeStyleChecker.Logging.translations._loggingMessagesSampleArgs?8 -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearContext?7 -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.CONTEXTFUL_NODES?7 -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.FUNCTION_NODES?7 -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.NodeWindowSize?7 -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor._loop?5(badNodeTypes) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.check?4(paramName) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.convertToValue?4() -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.emptyBody?4() -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.isAbcClass?4(name="ABC") -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.isAbstractDecorator?4() -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.isOverload?4() -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.isStrOrEllipsis?4() -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.nodeStack?4() -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.superwalk?4() -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.toNameStr?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_AnnAssign?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_Assert?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_Assign?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_AsyncFor?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_AsyncFunctionDef?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_Call?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_ClassDef?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_Compare?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_Dict?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_DictComp?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_ExceptHandler?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_For?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_FunctionDef?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_GeneratorExp?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_Import?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_ImportFrom?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_JoinedStr?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_ListComp?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_Module?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_Raise?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_Return?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_Set?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_SetComp?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_Try?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_TryStar?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_UAdd?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_While?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_With?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_Yield?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor.visit_YieldFrom?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugBearVisitor?1() -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugbearImmutableCalls?7 -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugbearMutableCalls?7 -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugbearMutableComprehensions?7 -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.BugbearMutableLiterals?7 -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.DateTimeVisitor.visit_Call?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.DateTimeVisitor?1() -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.DefaultMatchCaseVisitor.visit_Match?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.DefaultMatchCaseVisitor?1() -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.ExceptBaseExceptionVisitor.reRaised?4() -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.ExceptBaseExceptionVisitor.visit_ExceptHandler?4(node: ast.ExceptHandler) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.ExceptBaseExceptionVisitor.visit_Raise?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.ExceptBaseExceptionVisitor?1(exceptNode) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.FunctionDefDefaultsVisitor.visit?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.FunctionDefDefaultsVisitor.visit_Call?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.FunctionDefDefaultsVisitor.visit_Lambda?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.FunctionDefDefaultsVisitor?1(errorCodeCalls, errorCodeLiterals, ) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.M520NameFinder.visit_DictComp?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.M520NameFinder.visit_GeneratorExp?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.M520NameFinder.visit_Lambda?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.M520NameFinder.visit_ListComp?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.M520NameFinder.visit_comprehension?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.M540CaughtException.hasNote?7 -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.M540CaughtException.name?7 -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.M541VariableKeyType?1(name) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.M569Checker.MUTATING_FUNCTIONS?7 -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.M569Checker.visit?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.M569Checker.visit_Call?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.M569Checker.visit_Delete?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.M569Checker?1(name, bugbear) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearContext?7 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.CONTEXTFUL_NODES?7 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.FUNCTION_NODES?7 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.NodeWindowSize?7 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor._loop?5(badNodeTypes) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.check?4(paramName) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.convertToValue?4() +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.emptyBody?4() +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.isAbcClass?4(name="ABC") +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.isAbstractDecorator?4() +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.isOverload?4() +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.isStrOrEllipsis?4() +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.nodeStack?4() +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.superwalk?4() +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.toNameStr?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_AnnAssign?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_Assert?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_Assign?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_AsyncFor?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_AsyncFunctionDef?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_Call?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_ClassDef?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_Compare?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_Dict?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_DictComp?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_ExceptHandler?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_For?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_FunctionDef?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_GeneratorExp?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_Import?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_ImportFrom?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_JoinedStr?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_ListComp?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_Module?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_Raise?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_Return?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_Set?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_SetComp?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_Try?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_TryStar?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_UAdd?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_While?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_With?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_Yield?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor.visit_YieldFrom?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugBearVisitor?1() +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugbearImmutableCalls?7 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugbearMutableCalls?7 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugbearMutableComprehensions?7 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.BugbearMutableLiterals?7 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.ExceptBaseExceptionVisitor.reRaised?4() +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.ExceptBaseExceptionVisitor.visit_ExceptHandler?4(node: ast.ExceptHandler) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.ExceptBaseExceptionVisitor.visit_Raise?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.ExceptBaseExceptionVisitor?1(exceptNode) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.FunctionDefDefaultsVisitor.visit?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.FunctionDefDefaultsVisitor.visit_Call?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.FunctionDefDefaultsVisitor.visit_Lambda?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.FunctionDefDefaultsVisitor?1(errorCodeCalls, errorCodeLiterals, ) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.M520NameFinder.visit_DictComp?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.M520NameFinder.visit_GeneratorExp?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.M520NameFinder.visit_Lambda?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.M520NameFinder.visit_ListComp?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.M520NameFinder.visit_comprehension?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.M540CaughtException.hasNote?7 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.M540CaughtException.name?7 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.M541VariableKeyType?1(name) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.M569Checker.MUTATING_FUNCTIONS?7 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.M569Checker.visit?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.M569Checker.visit_Call?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.M569Checker.visit_Delete?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.M569Checker?1(name, bugbear) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.NameFinder.getNames?4() +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.NameFinder.visit?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.NameFinder.visit_Name?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.NameFinder?1() +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.NamedExprFinder.getNames?4() +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.NamedExprFinder.visit?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.NamedExprFinder.visit_NamedExpr?4(node: ast.NamedExpr) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.NamedExprFinder?1() +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.composeCallPath?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DateTimeVisitor.DateTimeVisitor.visit_Call?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DateTimeVisitor.DateTimeVisitor?1() +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DefaultMatchCaseVisitor.DefaultMatchCaseVisitor.visit_Match?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DefaultMatchCaseVisitor.DefaultMatchCaseVisitor?1() eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.MiscellaneousChecker.BuiltinsWhiteList?7 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.MiscellaneousChecker.Category?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.MiscellaneousChecker.Codes?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.MiscellaneousChecker.FormatFieldRegex?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.MiscellaneousChecker.Formatter?7 -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.MiscellaneousChecker.run?4() eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.MiscellaneousChecker?1(source, filename, tree, select, ignore, expected, repeat, args) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.NameFinder.getNames?4() -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.NameFinder.visit?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.NameFinder.visit_Name?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.NameFinder?1() -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.NamedExprFinder.getNames?4() -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.NamedExprFinder.visit?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.NamedExprFinder.visit_NamedExpr?4(node: ast.NamedExpr) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.NamedExprFinder?1() -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.ReturnVisitor.Assigns?7 -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.ReturnVisitor.Refs?7 -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.ReturnVisitor.Returns?7 -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.ReturnVisitor.assigns?4() -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.ReturnVisitor.refs?4() -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.ReturnVisitor.returns?4() -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.ReturnVisitor.visit_Assign?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.ReturnVisitor.visit_AsyncFor?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.ReturnVisitor.visit_AsyncFunctionDef?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.ReturnVisitor.visit_For?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.ReturnVisitor.visit_FunctionDef?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.ReturnVisitor.visit_Name?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.ReturnVisitor.visit_Return?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.ReturnVisitor.visit_While?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.ReturnVisitor?1() -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.SysVersionVisitor.visit_Attribute?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.SysVersionVisitor.visit_Compare?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.SysVersionVisitor.visit_ImportFrom?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.SysVersionVisitor.visit_Name?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.SysVersionVisitor.visit_Subscript?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.SysVersionVisitor?1() -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.TextVisitor.visit_AsyncFunctionDef?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.TextVisitor.visit_Call?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.TextVisitor.visit_ClassDef?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.TextVisitor.visit_Constant?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.TextVisitor.visit_FunctionDef?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.TextVisitor.visit_Module?4(node) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.TextVisitor?1() -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.composeCallPath?4(node) eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.pairwise?4(iterable) eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousDefaults.MiscellaneousCheckerDefaultArgs?7 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.ReturnVisitor.Assigns?7 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.ReturnVisitor.Loops?7 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.ReturnVisitor.Refs?7 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.ReturnVisitor.Returns?7 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.ReturnVisitor.Tries?7 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.ReturnVisitor.assigns?4() +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.ReturnVisitor.loops?4() +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.ReturnVisitor.refs?4() +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.ReturnVisitor.returns?4() +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.ReturnVisitor.tries?4() +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.ReturnVisitor.visit_Assign?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.ReturnVisitor.visit_AsyncFor?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.ReturnVisitor.visit_AsyncFunctionDef?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.ReturnVisitor.visit_For?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.ReturnVisitor.visit_FunctionDef?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.ReturnVisitor.visit_Name?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.ReturnVisitor.visit_Return?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.ReturnVisitor.visit_Try?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.ReturnVisitor.visit_While?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.ReturnVisitor?1() +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.SysVersionVisitor.SysVersionVisitor.visit_Attribute?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.SysVersionVisitor.SysVersionVisitor.visit_Compare?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.SysVersionVisitor.SysVersionVisitor.visit_ImportFrom?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.SysVersionVisitor.SysVersionVisitor.visit_Name?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.SysVersionVisitor.SysVersionVisitor.visit_Subscript?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.SysVersionVisitor.SysVersionVisitor?1() +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor.TextVisitor.visit_AsyncFunctionDef?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor.TextVisitor.visit_Call?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor.TextVisitor.visit_ClassDef?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor.TextVisitor.visit_Constant?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor.TextVisitor.visit_FunctionDef?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor.TextVisitor.visit_Module?4(node) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor.TextVisitor?1() eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.eradicate.Eradicator.BRACKET_REGEX?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.eradicate.Eradicator.CODE_INDICATORS?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.eradicate.Eradicator.CODE_KEYWORDS?7 @@ -4550,16 +4562,17 @@ eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.ImportsEnums.GroupEnum.THIRDPARTY?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.ImportsEnums.NodeTypeEnum.IMPORT?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.ImportsEnums.NodeTypeEnum.IMPORT_FROM?7 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.NameOrderChecker.NameOrderChecker.Category?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.NameOrderChecker.NameOrderChecker.Codes?7 -eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.NameOrderChecker.NameOrderChecker.Prefix?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.NameOrderChecker.NameOrderChecker.keyCallback?4() eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.NameOrderChecker.NameOrderChecker.moduleKey?4(moduleName, subImports=False) -eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.NameOrderChecker.NameOrderChecker.run?4() eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.NameOrderChecker.NameOrderChecker.sorted?4(toSort, key=None, reverse=False) eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.NameOrderChecker.NameOrderChecker?1(source, filename, tree, select, ignore, expected, repeat, args) eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.translations._nameOrderMessages?8 eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.translations._nameOrderMessagesSampleArgs?8 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.NamingStyleChecker.NamingStyleChecker.Category?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.NamingStyleChecker.NamingStyleChecker.Codes?7 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.NamingStyleChecker.NamingStyleChecker.addErrorFromNode?4(node, msgCode) eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.NamingStyleChecker.NamingStyleChecker.run?4() eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.NamingStyleChecker.NamingStyleChecker?1(source, filename, tree, select, ignore, expected, repeat, args) eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.translations._namingStyleMessages?8 @@ -4567,18 +4580,17 @@ eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.PathlibChecker.NameResolver.visit_Attribute?4(node) eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.PathlibChecker.NameResolver.visit_Name?4(node) eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.PathlibChecker.NameResolver?1(importAlias) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.PathlibChecker.PathlibChecker.Category?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.PathlibChecker.PathlibChecker.Codes?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.PathlibChecker.PathlibChecker.Function2Code?7 -eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.PathlibChecker.PathlibChecker.run?4() eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.PathlibChecker.PathlibChecker?1(source, filename, tree, selected, ignored, expected, repeat) eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.PathlibChecker.PathlibVisitor.visit_Call?4(node) eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.PathlibChecker.PathlibVisitor.visit_Import?4(node) eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.PathlibChecker.PathlibVisitor.visit_ImportFrom?4(node) eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.PathlibChecker.PathlibVisitor?1(checkCallback) eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.translations._pathlibMessages?8 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Pydantic.PydanticChecker.PydanticChecker.Category?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.Pydantic.PydanticChecker.PydanticChecker.Codes?7 -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Pydantic.PydanticChecker.PydanticChecker.Prefix?7 -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Pydantic.PydanticChecker.PydanticChecker.run?4() eric7.Plugins.CheckerPlugins.CodeStyleChecker.Pydantic.PydanticChecker.PydanticChecker?1(source, filename, tree, select, ignore, expected, repeat, args) eric7.Plugins.CheckerPlugins.CodeStyleChecker.Pydantic.PydanticUtils.PYDANTIC_DECORATORS?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.Pydantic.PydanticUtils.PYDANTIC_FIELD_ARGUMENTS?7 @@ -4709,9 +4721,10 @@ eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.Checks.weakCryptographicKey.getChecks?4() eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.Checks.yamlLoad.checkYamlLoad?4(reportError, context, _config) eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.Checks.yamlLoad.getChecks?4() +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityChecker.SecurityChecker.Category?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityChecker.SecurityChecker.Codes?7 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityChecker.SecurityChecker.addError?4(lineNumber, offset, msgCode, severity, confidence, *args) eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityChecker.SecurityChecker.getConfig?4() -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityChecker.SecurityChecker.reportError?4(lineNumber, offset, code, severity, confidence, *args) eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityChecker.SecurityChecker.run?4() eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityChecker.SecurityChecker?1(source, filename, tree, select, ignore, expected, repeat, args) eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityContext.SecurityContext.bytesVal?4() @@ -4763,8 +4776,8 @@ eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityUtils.namespacePathSplit?4(path) eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.translations._securityMessages?8 eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.translations._securityMessagesSampleArgs?8 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Simplify.SimplifyChecker.SimplifyChecker.Category?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.Simplify.SimplifyChecker.SimplifyChecker.Codes?7 -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Simplify.SimplifyChecker.SimplifyChecker.run?4() eric7.Plugins.CheckerPlugins.CodeStyleChecker.Simplify.SimplifyChecker.SimplifyChecker?1(source, filename, tree, selected, ignored, expected, repeat) eric7.Plugins.CheckerPlugins.CodeStyleChecker.Simplify.SimplifyNodeVisitor.SimplifyNodeVisitor.getOsPathJoinArgs?4() eric7.Plugins.CheckerPlugins.CodeStyleChecker.Simplify.SimplifyNodeVisitor.SimplifyNodeVisitor.visit_Assign?4(node) @@ -4793,8 +4806,8 @@ eric7.Plugins.CheckerPlugins.CodeStyleChecker.Unused.UnusedChecker.GlobalVariableLoadCounter?1() eric7.Plugins.CheckerPlugins.CodeStyleChecker.Unused.UnusedChecker.GlobalVariableStoreInfo?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.Unused.UnusedChecker.NameFinder.visit_Name?4(name) +eric7.Plugins.CheckerPlugins.CodeStyleChecker.Unused.UnusedChecker.UnusedChecker.Category?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.Unused.UnusedChecker.UnusedChecker.Codes?7 -eric7.Plugins.CheckerPlugins.CodeStyleChecker.Unused.UnusedChecker.UnusedChecker.run?4() eric7.Plugins.CheckerPlugins.CodeStyleChecker.Unused.UnusedChecker.UnusedChecker?1(source, filename, tree, select, ignore, expected, repeat, args) eric7.Plugins.CheckerPlugins.CodeStyleChecker.Unused.translations._unusedMessages?8 eric7.Plugins.CheckerPlugins.CodeStyleChecker.Unused.translations._unusedMessagesSampleArgs?8
--- a/src/eric7/APIs/Python3/eric7.bas Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/APIs/Python3/eric7.bas Thu Feb 27 14:42:39 2025 +0100 @@ -25,6 +25,7 @@ AddProjectDialog QDialog Ui_AddProjectDialog AddProjectUrlDialog QDialog Ui_AddProjectUrlDialog AnnotationType enum.Enum +AnnotationsChecker CodeStyleTopicChecker AnnotationsDeprecationsVisitor ast.NodeVisitor AnnotationsFutureImportVisitor ast.NodeVisitor AnnotationsFutureVisitor ast.NodeVisitor @@ -37,6 +38,7 @@ AssociationItem EricArrowItem AssociationPointRegion enum.Enum AssociationType enum.Enum +AsyncChecker CodeStyleTopicChecker AsyncVisitor ast.NodeVisitor Attribute ClbrBaseClasses.Attribute VisibilityMixin AutoSaver QObject @@ -124,6 +126,7 @@ CompleterPython CompleterBase CompleterRuby CompleterBase CompleterYaml CompleterBase +ComplexityChecker CodeStyleTopicChecker Conda QObject CondaExecDialog QDialog Ui_CondaExecDialog CondaExportDialog QDialog Ui_CondaExportDialog @@ -183,6 +186,7 @@ DiffReport StandardReport DiffWindow EricMainWindow DirectorySyncHandler SyncHandler +DocStyleChecker CodeStyleTopicChecker DocstringMenuForEnterOnly QMenu DocumentationViewerWidget QWidget DotDesktopListSelectionDialog QDialog Ui_DotDesktopListSelectionDialog @@ -639,6 +643,7 @@ ImageSearchEngine QObject ImagesIcon StatusBarIcon ImportNodeError Exception +ImportsChecker CodeStyleTopicChecker ImportsDiagramBuilder UMLDiagramBuilder InputDialogWizard QObject InputDialogWizardDialog QDialog Ui_InputDialogWizardDialog @@ -718,6 +723,7 @@ LogViewer QWidget LogViewerEdit QTextEdit LogViewerPage ConfigurationPageBase Ui_LogViewerPage +LoggingChecker CodeStyleTopicChecker LoggingVisitor ast.NodeVisitor M520NameFinder NameFinder M569Checker ast.NodeVisitor @@ -756,6 +762,7 @@ MiniScintilla QsciScintillaCompat MipLocalInstaller QObject MipPackageDialog QDialog Ui_MipPackageDialog +MiscellaneousChecker CodeStyleTopicChecker Module ClbrBaseClasses.Module VisibilityMixin ModuleItem UMLItem ModuleModel UMLModel @@ -767,8 +774,10 @@ MultiValueDictResolver DictResolver MyMemoryEngine TranslationEngine NameFinder ast.NodeVisitor +NameOrderChecker CodeStyleTopicChecker NameResolver ast.NodeVisitor NamedExprFinder ast.NodeVisitor +NamingStyleChecker CodeStyleTopicChecker NavigationBar QWidget NavigationContainer QWidget NdArrayResolver BaseResolver @@ -814,6 +823,7 @@ PasswordWriter QXmlStreamWriter PasswordsDialog QDialog Ui_PasswordsDialog PathGraphingAstVisitor ASTVisitor +PathlibChecker CodeStyleTopicChecker PathlibVisitor ast.NodeVisitor PdfGoToDialog QDialog PdfInfoWidget QWidget @@ -921,6 +931,7 @@ PyRegExpWizardWidget QWidget Ui_PyRegExpWizardDialog PyRegExpWizardWindow EricMainWindow PySvnProjectHelper VcsProjectHelper +PydanticChecker CodeStyleTopicChecker PydanticVisitor ast.NodeVisitor PytestExecutor TestExecutorBase PythonAstViewer QWidget @@ -973,6 +984,7 @@ SearchReplaceSlidingWidget QWidget SearchReplaceWidget QWidget Ui_SearchReplaceWidget SearchWidget QWidget Ui_SearchWidget +SecurityChecker CodeStyleTopicChecker SecurityPage ConfigurationPageBase Ui_SecurityPage SelectAction argparse.Action SendRefererWhitelistDialog QDialog Ui_SendRefererWhitelistDialog @@ -999,6 +1011,7 @@ ShowModulesDialog QDialog Ui_ShowModulesDialog ShowOutdatedDialog QDialog Ui_ShowOutdatedDialog SimplePatternExtension Extension +SimplifyChecker CodeStyleTopicChecker SimplifyNodeVisitor ast.NodeVisitor SingleApplicationServer QLocalServer SiteInfoDialog QDialog Ui_SiteInfoDialog @@ -1152,6 +1165,7 @@ UncommitProjectHelper HgExtensionProjectHelper UnittestExecutor TestExecutorBase UnknownDevicesDialog QDialog Ui_UnknownDevicesDialog +UnusedChecker CodeStyleTopicChecker UrlBar EricClearableLineEdit UrlInterceptor QObject UserAgentManager QObject
--- a/src/eric7/Documentation/Help/source.qhp Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Documentation/Help/source.qhp Thu Feb 27 14:42:39 2025 +0100 @@ -445,8 +445,14 @@ <section title="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Logging.translations" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Logging.translations.html" /> </section> <section title="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous" ref="index-eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.html"> + <section title="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html" /> + <section title="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DateTimeVisitor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DateTimeVisitor.html" /> + <section title="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DefaultMatchCaseVisitor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DefaultMatchCaseVisitor.html" /> <section title="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html" /> <section title="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousDefaults" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousDefaults.html" /> + <section title="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html" /> + <section title="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.SysVersionVisitor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.SysVersionVisitor.html" /> + <section title="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor.html" /> <section title="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.eradicate" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.eradicate.html" /> <section title="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.translations" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.translations.html" /> </section> @@ -529,6 +535,7 @@ <section title="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleCodeSelectionDialog" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleCodeSelectionDialog.html" /> <section title="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleFixer" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleFixer.html" /> <section title="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleStatisticsDialog" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleStatisticsDialog.html" /> + <section title="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleTopicChecker" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleTopicChecker.html" /> <section title="eric7.Plugins.CheckerPlugins.CodeStyleChecker.ast_unparse" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.ast_unparse.html" /> <section title="eric7.Plugins.CheckerPlugins.CodeStyleChecker.pycodestyle" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.pycodestyle.html" /> <section title="eric7.Plugins.CheckerPlugins.CodeStyleChecker.translations" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.translations.html" /> @@ -1988,13 +1995,10 @@ <keyword name="AnnotationsChecker.__checkDeprecatedTypingSymbols" id="AnnotationsChecker.__checkDeprecatedTypingSymbols" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsChecker.html#AnnotationsChecker.__checkDeprecatedTypingSymbols" /> <keyword name="AnnotationsChecker.__checkFunctionAnnotations" id="AnnotationsChecker.__checkFunctionAnnotations" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsChecker.html#AnnotationsChecker.__checkFunctionAnnotations" /> <keyword name="AnnotationsChecker.__classifyError" id="AnnotationsChecker.__classifyError" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsChecker.html#AnnotationsChecker.__classifyError" /> - <keyword name="AnnotationsChecker.__error" id="AnnotationsChecker.__error" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsChecker.html#AnnotationsChecker.__error" /> <keyword name="AnnotationsChecker.__getAnnotationComplexity" id="AnnotationsChecker.__getAnnotationComplexity" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsChecker.html#AnnotationsChecker.__getAnnotationComplexity" /> <keyword name="AnnotationsChecker.__getAnnotationLength" id="AnnotationsChecker.__getAnnotationLength" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsChecker.html#AnnotationsChecker.__getAnnotationLength" /> <keyword name="AnnotationsChecker.__hasTypeAnnotations" id="AnnotationsChecker.__hasTypeAnnotations" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsChecker.html#AnnotationsChecker.__hasTypeAnnotations" /> - <keyword name="AnnotationsChecker.__ignoreCode" id="AnnotationsChecker.__ignoreCode" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsChecker.html#AnnotationsChecker.__ignoreCode" /> <keyword name="AnnotationsChecker.__returnErrorClassifier" id="AnnotationsChecker.__returnErrorClassifier" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsChecker.html#AnnotationsChecker.__returnErrorClassifier" /> - <keyword name="AnnotationsChecker.run" id="AnnotationsChecker.run" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsChecker.html#AnnotationsChecker.run" /> <keyword name="AnnotationsCheckerDefaults (Module)" id="AnnotationsCheckerDefaults (Module)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsCheckerDefaults.html" /> <keyword name="AnnotationsDeprecationsVisitor" id="AnnotationsDeprecationsVisitor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsDeprecationsVisitor.html#AnnotationsDeprecationsVisitor" /> <keyword name="AnnotationsDeprecationsVisitor (Constructor)" id="AnnotationsDeprecationsVisitor (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsDeprecationsVisitor.html#AnnotationsDeprecationsVisitor.__init__" /> @@ -2103,9 +2107,6 @@ <keyword name="AsyncChecker (Constructor)" id="AsyncChecker (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Async.AsyncChecker.html#AsyncChecker.__init__" /> <keyword name="AsyncChecker (Module)" id="AsyncChecker (Module)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Async.AsyncChecker.html" /> <keyword name="AsyncChecker.__checkSyncUses" id="AsyncChecker.__checkSyncUses" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Async.AsyncChecker.html#AsyncChecker.__checkSyncUses" /> - <keyword name="AsyncChecker.__error" id="AsyncChecker.__error" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Async.AsyncChecker.html#AsyncChecker.__error" /> - <keyword name="AsyncChecker.__ignoreCode" id="AsyncChecker.__ignoreCode" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Async.AsyncChecker.html#AsyncChecker.__ignoreCode" /> - <keyword name="AsyncChecker.run" id="AsyncChecker.run" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Async.AsyncChecker.html#AsyncChecker.run" /> <keyword name="AsyncFile" id="AsyncFile" ref="eric7.DebugClients.Python.AsyncFile.html#AsyncFile" /> <keyword name="AsyncFile (Constructor)" id="AsyncFile (Constructor)" ref="eric7.DebugClients.Python.AsyncFile.html#AsyncFile.__init__" /> <keyword name="AsyncFile (Module)" id="AsyncFile (Module)" ref="eric7.DebugClients.Python.AsyncFile.html" /> @@ -2859,89 +2860,90 @@ <keyword name="BrowserSysPathItem" id="BrowserSysPathItem" ref="eric7.UI.BrowserModel.html#BrowserSysPathItem" /> <keyword name="BrowserSysPathItem (Constructor)" id="BrowserSysPathItem (Constructor)" ref="eric7.UI.BrowserModel.html#BrowserSysPathItem.__init__" /> <keyword name="BrowserSysPathItem.name" id="BrowserSysPathItem.name" ref="eric7.UI.BrowserModel.html#BrowserSysPathItem.name" /> - <keyword name="BugBearVisitor" id="BugBearVisitor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor" /> - <keyword name="BugBearVisitor (Constructor)" id="BugBearVisitor (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__init__" /> - <keyword name="BugBearVisitor.__checkForM505" id="BugBearVisitor.__checkForM505" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__checkForM505" /> - <keyword name="BugBearVisitor.__checkForM506_M508" id="BugBearVisitor.__checkForM506_M508" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__checkForM506_M508" /> - <keyword name="BugBearVisitor.__checkForM507" id="BugBearVisitor.__checkForM507" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__checkForM507" /> - <keyword name="BugBearVisitor.__checkForM512" id="BugBearVisitor.__checkForM512" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__checkForM512" /> - <keyword name="BugBearVisitor.__checkForM513_M514_M529_M530" id="BugBearVisitor.__checkForM513_M514_M529_M530" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__checkForM513_M514_M529_M530" /> - <keyword name="BugBearVisitor.__checkForM515" id="BugBearVisitor.__checkForM515" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__checkForM515" /> - <keyword name="BugBearVisitor.__checkForM516" id="BugBearVisitor.__checkForM516" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__checkForM516" /> - <keyword name="BugBearVisitor.__checkForM517" id="BugBearVisitor.__checkForM517" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__checkForM517" /> - <keyword name="BugBearVisitor.__checkForM518" id="BugBearVisitor.__checkForM518" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__checkForM518" /> - <keyword name="BugBearVisitor.__checkForM519" id="BugBearVisitor.__checkForM519" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__checkForM519" /> - <keyword name="BugBearVisitor.__checkForM520" id="BugBearVisitor.__checkForM520" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__checkForM520" /> - <keyword name="BugBearVisitor.__checkForM521" id="BugBearVisitor.__checkForM521" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__checkForM521" /> - <keyword name="BugBearVisitor.__checkForM522" id="BugBearVisitor.__checkForM522" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__checkForM522" /> - <keyword name="BugBearVisitor.__checkForM523" id="BugBearVisitor.__checkForM523" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__checkForM523" /> - <keyword name="BugBearVisitor.__checkForM524_M527" id="BugBearVisitor.__checkForM524_M527" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__checkForM524_M527" /> - <keyword name="BugBearVisitor.__checkForM525" id="BugBearVisitor.__checkForM525" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__checkForM525" /> - <keyword name="BugBearVisitor.__checkForM526" id="BugBearVisitor.__checkForM526" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__checkForM526" /> - <keyword name="BugBearVisitor.__checkForM528" id="BugBearVisitor.__checkForM528" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__checkForM528" /> - <keyword name="BugBearVisitor.__checkForM531" id="BugBearVisitor.__checkForM531" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__checkForM531" /> - <keyword name="BugBearVisitor.__checkForM532" id="BugBearVisitor.__checkForM532" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__checkForM532" /> - <keyword name="BugBearVisitor.__checkForM533" id="BugBearVisitor.__checkForM533" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__checkForM533" /> - <keyword name="BugBearVisitor.__checkForM534" id="BugBearVisitor.__checkForM534" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__checkForM534" /> - <keyword name="BugBearVisitor.__checkForM535" id="BugBearVisitor.__checkForM535" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__checkForM535" /> - <keyword name="BugBearVisitor.__checkForM539" id="BugBearVisitor.__checkForM539" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__checkForM539" /> - <keyword name="BugBearVisitor.__checkForM540AddNote" id="BugBearVisitor.__checkForM540AddNote" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__checkForM540AddNote" /> - <keyword name="BugBearVisitor.__checkForM540Usage" id="BugBearVisitor.__checkForM540Usage" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__checkForM540Usage" /> - <keyword name="BugBearVisitor.__checkForM541" id="BugBearVisitor.__checkForM541" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__checkForM541" /> - <keyword name="BugBearVisitor.__checkForM569" id="BugBearVisitor.__checkForM569" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__checkForM569" /> - <keyword name="BugBearVisitor.__checkRedundantExcepthandlers" id="BugBearVisitor.__checkRedundantExcepthandlers" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__checkRedundantExcepthandlers" /> - <keyword name="BugBearVisitor.__childrenInScope" id="BugBearVisitor.__childrenInScope" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__childrenInScope" /> - <keyword name="BugBearVisitor.__flattenExcepthandler" id="BugBearVisitor.__flattenExcepthandler" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__flattenExcepthandler" /> - <keyword name="BugBearVisitor.__getAssignedNames" id="BugBearVisitor.__getAssignedNames" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__getAssignedNames" /> - <keyword name="BugBearVisitor.__getDictCompLoopAndNamedExprVarNames" id="BugBearVisitor.__getDictCompLoopAndNamedExprVarNames" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__getDictCompLoopAndNamedExprVarNames" /> - <keyword name="BugBearVisitor.__getNamesFromTuple" id="BugBearVisitor.__getNamesFromTuple" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__getNamesFromTuple" /> - <keyword name="BugBearVisitor.__inClassInit" id="BugBearVisitor.__inClassInit" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__inClassInit" /> - <keyword name="BugBearVisitor.__isIdentifier" id="BugBearVisitor.__isIdentifier" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__isIdentifier" /> - <keyword name="BugBearVisitor.__namesFromAssignments" id="BugBearVisitor.__namesFromAssignments" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__namesFromAssignments" /> - <keyword name="BugBearVisitor.__typesafeIssubclass" id="BugBearVisitor.__typesafeIssubclass" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__typesafeIssubclass" /> - <keyword name="BugBearVisitor.__walkList" id="BugBearVisitor.__walkList" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.__walkList" /> - <keyword name="BugBearVisitor._loop" id="BugBearVisitor._loop" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor._loop" /> - <keyword name="BugBearVisitor.check" id="BugBearVisitor.check" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.check" /> - <keyword name="BugBearVisitor.convertToValue" id="BugBearVisitor.convertToValue" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.convertToValue" /> - <keyword name="BugBearVisitor.emptyBody" id="BugBearVisitor.emptyBody" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.emptyBody" /> - <keyword name="BugBearVisitor.isAbcClass" id="BugBearVisitor.isAbcClass" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.isAbcClass" /> - <keyword name="BugBearVisitor.isAbstractDecorator" id="BugBearVisitor.isAbstractDecorator" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.isAbstractDecorator" /> - <keyword name="BugBearVisitor.isOverload" id="BugBearVisitor.isOverload" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.isOverload" /> - <keyword name="BugBearVisitor.isStrOrEllipsis" id="BugBearVisitor.isStrOrEllipsis" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.isStrOrEllipsis" /> - <keyword name="BugBearVisitor.nodeStack" id="BugBearVisitor.nodeStack" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.nodeStack" /> - <keyword name="BugBearVisitor.superwalk" id="BugBearVisitor.superwalk" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.superwalk" /> - <keyword name="BugBearVisitor.toNameStr" id="BugBearVisitor.toNameStr" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.toNameStr" /> - <keyword name="BugBearVisitor.visit" id="BugBearVisitor.visit" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit" /> - <keyword name="BugBearVisitor.visit_AnnAssign" id="BugBearVisitor.visit_AnnAssign" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_AnnAssign" /> - <keyword name="BugBearVisitor.visit_Assert" id="BugBearVisitor.visit_Assert" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_Assert" /> - <keyword name="BugBearVisitor.visit_Assign" id="BugBearVisitor.visit_Assign" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_Assign" /> - <keyword name="BugBearVisitor.visit_AsyncFor" id="BugBearVisitor.visit_AsyncFor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_AsyncFor" /> - <keyword name="BugBearVisitor.visit_AsyncFunctionDef" id="BugBearVisitor.visit_AsyncFunctionDef" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_AsyncFunctionDef" /> - <keyword name="BugBearVisitor.visit_Call" id="BugBearVisitor.visit_Call" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_Call" /> - <keyword name="BugBearVisitor.visit_ClassDef" id="BugBearVisitor.visit_ClassDef" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_ClassDef" /> - <keyword name="BugBearVisitor.visit_Compare" id="BugBearVisitor.visit_Compare" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_Compare" /> - <keyword name="BugBearVisitor.visit_Dict" id="BugBearVisitor.visit_Dict" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_Dict" /> - <keyword name="BugBearVisitor.visit_DictComp" id="BugBearVisitor.visit_DictComp" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_DictComp" /> - <keyword name="BugBearVisitor.visit_ExceptHandler" id="BugBearVisitor.visit_ExceptHandler" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_ExceptHandler" /> - <keyword name="BugBearVisitor.visit_For" id="BugBearVisitor.visit_For" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_For" /> - <keyword name="BugBearVisitor.visit_FunctionDef" id="BugBearVisitor.visit_FunctionDef" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_FunctionDef" /> - <keyword name="BugBearVisitor.visit_GeneratorExp" id="BugBearVisitor.visit_GeneratorExp" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_GeneratorExp" /> - <keyword name="BugBearVisitor.visit_Import" id="BugBearVisitor.visit_Import" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_Import" /> - <keyword name="BugBearVisitor.visit_ImportFrom" id="BugBearVisitor.visit_ImportFrom" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_ImportFrom" /> - <keyword name="BugBearVisitor.visit_JoinedStr" id="BugBearVisitor.visit_JoinedStr" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_JoinedStr" /> - <keyword name="BugBearVisitor.visit_ListComp" id="BugBearVisitor.visit_ListComp" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_ListComp" /> - <keyword name="BugBearVisitor.visit_Module" id="BugBearVisitor.visit_Module" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_Module" /> - <keyword name="BugBearVisitor.visit_Raise" id="BugBearVisitor.visit_Raise" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_Raise" /> - <keyword name="BugBearVisitor.visit_Return" id="BugBearVisitor.visit_Return" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_Return" /> - <keyword name="BugBearVisitor.visit_Set" id="BugBearVisitor.visit_Set" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_Set" /> - <keyword name="BugBearVisitor.visit_SetComp" id="BugBearVisitor.visit_SetComp" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_SetComp" /> - <keyword name="BugBearVisitor.visit_Try" id="BugBearVisitor.visit_Try" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_Try" /> - <keyword name="BugBearVisitor.visit_TryStar" id="BugBearVisitor.visit_TryStar" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_TryStar" /> - <keyword name="BugBearVisitor.visit_UAdd" id="BugBearVisitor.visit_UAdd" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_UAdd" /> - <keyword name="BugBearVisitor.visit_While" id="BugBearVisitor.visit_While" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_While" /> - <keyword name="BugBearVisitor.visit_With" id="BugBearVisitor.visit_With" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_With" /> - <keyword name="BugBearVisitor.visit_Yield" id="BugBearVisitor.visit_Yield" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_Yield" /> - <keyword name="BugBearVisitor.visit_YieldFrom" id="BugBearVisitor.visit_YieldFrom" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#BugBearVisitor.visit_YieldFrom" /> + <keyword name="BugBearVisitor" id="BugBearVisitor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor" /> + <keyword name="BugBearVisitor (Constructor)" id="BugBearVisitor (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__init__" /> + <keyword name="BugBearVisitor (Module)" id="BugBearVisitor (Module)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html" /> + <keyword name="BugBearVisitor.__checkForM505" id="BugBearVisitor.__checkForM505" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__checkForM505" /> + <keyword name="BugBearVisitor.__checkForM506_M508" id="BugBearVisitor.__checkForM506_M508" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__checkForM506_M508" /> + <keyword name="BugBearVisitor.__checkForM507" id="BugBearVisitor.__checkForM507" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__checkForM507" /> + <keyword name="BugBearVisitor.__checkForM512" id="BugBearVisitor.__checkForM512" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__checkForM512" /> + <keyword name="BugBearVisitor.__checkForM513_M514_M529_M530" id="BugBearVisitor.__checkForM513_M514_M529_M530" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__checkForM513_M514_M529_M530" /> + <keyword name="BugBearVisitor.__checkForM515" id="BugBearVisitor.__checkForM515" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__checkForM515" /> + <keyword name="BugBearVisitor.__checkForM516" id="BugBearVisitor.__checkForM516" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__checkForM516" /> + <keyword name="BugBearVisitor.__checkForM517" id="BugBearVisitor.__checkForM517" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__checkForM517" /> + <keyword name="BugBearVisitor.__checkForM518" id="BugBearVisitor.__checkForM518" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__checkForM518" /> + <keyword name="BugBearVisitor.__checkForM519" id="BugBearVisitor.__checkForM519" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__checkForM519" /> + <keyword name="BugBearVisitor.__checkForM520" id="BugBearVisitor.__checkForM520" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__checkForM520" /> + <keyword name="BugBearVisitor.__checkForM521" id="BugBearVisitor.__checkForM521" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__checkForM521" /> + <keyword name="BugBearVisitor.__checkForM522" id="BugBearVisitor.__checkForM522" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__checkForM522" /> + <keyword name="BugBearVisitor.__checkForM523" id="BugBearVisitor.__checkForM523" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__checkForM523" /> + <keyword name="BugBearVisitor.__checkForM524_M527" id="BugBearVisitor.__checkForM524_M527" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__checkForM524_M527" /> + <keyword name="BugBearVisitor.__checkForM525" id="BugBearVisitor.__checkForM525" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__checkForM525" /> + <keyword name="BugBearVisitor.__checkForM526" id="BugBearVisitor.__checkForM526" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__checkForM526" /> + <keyword name="BugBearVisitor.__checkForM528" id="BugBearVisitor.__checkForM528" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__checkForM528" /> + <keyword name="BugBearVisitor.__checkForM531" id="BugBearVisitor.__checkForM531" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__checkForM531" /> + <keyword name="BugBearVisitor.__checkForM532" id="BugBearVisitor.__checkForM532" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__checkForM532" /> + <keyword name="BugBearVisitor.__checkForM533" id="BugBearVisitor.__checkForM533" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__checkForM533" /> + <keyword name="BugBearVisitor.__checkForM534" id="BugBearVisitor.__checkForM534" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__checkForM534" /> + <keyword name="BugBearVisitor.__checkForM535" id="BugBearVisitor.__checkForM535" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__checkForM535" /> + <keyword name="BugBearVisitor.__checkForM539" id="BugBearVisitor.__checkForM539" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__checkForM539" /> + <keyword name="BugBearVisitor.__checkForM540AddNote" id="BugBearVisitor.__checkForM540AddNote" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__checkForM540AddNote" /> + <keyword name="BugBearVisitor.__checkForM540Usage" id="BugBearVisitor.__checkForM540Usage" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__checkForM540Usage" /> + <keyword name="BugBearVisitor.__checkForM541" id="BugBearVisitor.__checkForM541" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__checkForM541" /> + <keyword name="BugBearVisitor.__checkForM569" id="BugBearVisitor.__checkForM569" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__checkForM569" /> + <keyword name="BugBearVisitor.__checkRedundantExcepthandlers" id="BugBearVisitor.__checkRedundantExcepthandlers" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__checkRedundantExcepthandlers" /> + <keyword name="BugBearVisitor.__childrenInScope" id="BugBearVisitor.__childrenInScope" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__childrenInScope" /> + <keyword name="BugBearVisitor.__flattenExcepthandler" id="BugBearVisitor.__flattenExcepthandler" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__flattenExcepthandler" /> + <keyword name="BugBearVisitor.__getAssignedNames" id="BugBearVisitor.__getAssignedNames" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__getAssignedNames" /> + <keyword name="BugBearVisitor.__getDictCompLoopAndNamedExprVarNames" id="BugBearVisitor.__getDictCompLoopAndNamedExprVarNames" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__getDictCompLoopAndNamedExprVarNames" /> + <keyword name="BugBearVisitor.__getNamesFromTuple" id="BugBearVisitor.__getNamesFromTuple" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__getNamesFromTuple" /> + <keyword name="BugBearVisitor.__inClassInit" id="BugBearVisitor.__inClassInit" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__inClassInit" /> + <keyword name="BugBearVisitor.__isIdentifier" id="BugBearVisitor.__isIdentifier" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__isIdentifier" /> + <keyword name="BugBearVisitor.__namesFromAssignments" id="BugBearVisitor.__namesFromAssignments" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__namesFromAssignments" /> + <keyword name="BugBearVisitor.__typesafeIssubclass" id="BugBearVisitor.__typesafeIssubclass" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__typesafeIssubclass" /> + <keyword name="BugBearVisitor.__walkList" id="BugBearVisitor.__walkList" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.__walkList" /> + <keyword name="BugBearVisitor._loop" id="BugBearVisitor._loop" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor._loop" /> + <keyword name="BugBearVisitor.check" id="BugBearVisitor.check" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.check" /> + <keyword name="BugBearVisitor.convertToValue" id="BugBearVisitor.convertToValue" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.convertToValue" /> + <keyword name="BugBearVisitor.emptyBody" id="BugBearVisitor.emptyBody" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.emptyBody" /> + <keyword name="BugBearVisitor.isAbcClass" id="BugBearVisitor.isAbcClass" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.isAbcClass" /> + <keyword name="BugBearVisitor.isAbstractDecorator" id="BugBearVisitor.isAbstractDecorator" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.isAbstractDecorator" /> + <keyword name="BugBearVisitor.isOverload" id="BugBearVisitor.isOverload" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.isOverload" /> + <keyword name="BugBearVisitor.isStrOrEllipsis" id="BugBearVisitor.isStrOrEllipsis" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.isStrOrEllipsis" /> + <keyword name="BugBearVisitor.nodeStack" id="BugBearVisitor.nodeStack" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.nodeStack" /> + <keyword name="BugBearVisitor.superwalk" id="BugBearVisitor.superwalk" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.superwalk" /> + <keyword name="BugBearVisitor.toNameStr" id="BugBearVisitor.toNameStr" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.toNameStr" /> + <keyword name="BugBearVisitor.visit" id="BugBearVisitor.visit" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit" /> + <keyword name="BugBearVisitor.visit_AnnAssign" id="BugBearVisitor.visit_AnnAssign" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_AnnAssign" /> + <keyword name="BugBearVisitor.visit_Assert" id="BugBearVisitor.visit_Assert" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_Assert" /> + <keyword name="BugBearVisitor.visit_Assign" id="BugBearVisitor.visit_Assign" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_Assign" /> + <keyword name="BugBearVisitor.visit_AsyncFor" id="BugBearVisitor.visit_AsyncFor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_AsyncFor" /> + <keyword name="BugBearVisitor.visit_AsyncFunctionDef" id="BugBearVisitor.visit_AsyncFunctionDef" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_AsyncFunctionDef" /> + <keyword name="BugBearVisitor.visit_Call" id="BugBearVisitor.visit_Call" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_Call" /> + <keyword name="BugBearVisitor.visit_ClassDef" id="BugBearVisitor.visit_ClassDef" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_ClassDef" /> + <keyword name="BugBearVisitor.visit_Compare" id="BugBearVisitor.visit_Compare" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_Compare" /> + <keyword name="BugBearVisitor.visit_Dict" id="BugBearVisitor.visit_Dict" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_Dict" /> + <keyword name="BugBearVisitor.visit_DictComp" id="BugBearVisitor.visit_DictComp" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_DictComp" /> + <keyword name="BugBearVisitor.visit_ExceptHandler" id="BugBearVisitor.visit_ExceptHandler" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_ExceptHandler" /> + <keyword name="BugBearVisitor.visit_For" id="BugBearVisitor.visit_For" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_For" /> + <keyword name="BugBearVisitor.visit_FunctionDef" id="BugBearVisitor.visit_FunctionDef" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_FunctionDef" /> + <keyword name="BugBearVisitor.visit_GeneratorExp" id="BugBearVisitor.visit_GeneratorExp" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_GeneratorExp" /> + <keyword name="BugBearVisitor.visit_Import" id="BugBearVisitor.visit_Import" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_Import" /> + <keyword name="BugBearVisitor.visit_ImportFrom" id="BugBearVisitor.visit_ImportFrom" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_ImportFrom" /> + <keyword name="BugBearVisitor.visit_JoinedStr" id="BugBearVisitor.visit_JoinedStr" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_JoinedStr" /> + <keyword name="BugBearVisitor.visit_ListComp" id="BugBearVisitor.visit_ListComp" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_ListComp" /> + <keyword name="BugBearVisitor.visit_Module" id="BugBearVisitor.visit_Module" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_Module" /> + <keyword name="BugBearVisitor.visit_Raise" id="BugBearVisitor.visit_Raise" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_Raise" /> + <keyword name="BugBearVisitor.visit_Return" id="BugBearVisitor.visit_Return" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_Return" /> + <keyword name="BugBearVisitor.visit_Set" id="BugBearVisitor.visit_Set" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_Set" /> + <keyword name="BugBearVisitor.visit_SetComp" id="BugBearVisitor.visit_SetComp" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_SetComp" /> + <keyword name="BugBearVisitor.visit_Try" id="BugBearVisitor.visit_Try" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_Try" /> + <keyword name="BugBearVisitor.visit_TryStar" id="BugBearVisitor.visit_TryStar" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_TryStar" /> + <keyword name="BugBearVisitor.visit_UAdd" id="BugBearVisitor.visit_UAdd" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_UAdd" /> + <keyword name="BugBearVisitor.visit_While" id="BugBearVisitor.visit_While" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_While" /> + <keyword name="BugBearVisitor.visit_With" id="BugBearVisitor.visit_With" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_With" /> + <keyword name="BugBearVisitor.visit_Yield" id="BugBearVisitor.visit_Yield" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_Yield" /> + <keyword name="BugBearVisitor.visit_YieldFrom" id="BugBearVisitor.visit_YieldFrom" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#BugBearVisitor.visit_YieldFrom" /> <keyword name="CallStackViewer" id="CallStackViewer" ref="eric7.Debugger.CallStackViewer.html#CallStackViewer" /> <keyword name="CallStackViewer (Constructor)" id="CallStackViewer (Constructor)" ref="eric7.Debugger.CallStackViewer.html#CallStackViewer.__init__" /> <keyword name="CallStackViewer (Module)" id="CallStackViewer (Module)" ref="eric7.Debugger.CallStackViewer.html" /> @@ -3279,6 +3281,7 @@ <keyword name="CodeStyleCheckerDialog.__initCommentedCodeCheckerWhiteList" id="CodeStyleCheckerDialog.__initCommentedCodeCheckerWhiteList" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleCheckerDialog.html#CodeStyleCheckerDialog.__initCommentedCodeCheckerWhiteList" /> <keyword name="CodeStyleCheckerDialog.__initFuturesList" id="CodeStyleCheckerDialog.__initFuturesList" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleCheckerDialog.html#CodeStyleCheckerDialog.__initFuturesList" /> <keyword name="CodeStyleCheckerDialog.__itemFixable" id="CodeStyleCheckerDialog.__itemFixable" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleCheckerDialog.html#CodeStyleCheckerDialog.__itemFixable" /> + <keyword name="CodeStyleCheckerDialog.__migrateIssueCodes" id="CodeStyleCheckerDialog.__migrateIssueCodes" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleCheckerDialog.html#CodeStyleCheckerDialog.__migrateIssueCodes" /> <keyword name="CodeStyleCheckerDialog.__modifyFixedResultItem" id="CodeStyleCheckerDialog.__modifyFixedResultItem" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleCheckerDialog.html#CodeStyleCheckerDialog.__modifyFixedResultItem" /> <keyword name="CodeStyleCheckerDialog.__modifyOptions" id="CodeStyleCheckerDialog.__modifyOptions" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleCheckerDialog.html#CodeStyleCheckerDialog.__modifyOptions" /> <keyword name="CodeStyleCheckerDialog.__prepareProgress" id="CodeStyleCheckerDialog.__prepareProgress" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleCheckerDialog.html#CodeStyleCheckerDialog.__prepareProgress" /> @@ -3408,6 +3411,14 @@ <keyword name="CodeStyleStatisticsDialog (Constructor)" id="CodeStyleStatisticsDialog (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleStatisticsDialog.html#CodeStyleStatisticsDialog.__init__" /> <keyword name="CodeStyleStatisticsDialog (Module)" id="CodeStyleStatisticsDialog (Module)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleStatisticsDialog.html" /> <keyword name="CodeStyleStatisticsDialog.__createItem" id="CodeStyleStatisticsDialog.__createItem" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleStatisticsDialog.html#CodeStyleStatisticsDialog.__createItem" /> + <keyword name="CodeStyleTopicChecker" id="CodeStyleTopicChecker" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleTopicChecker.html#CodeStyleTopicChecker" /> + <keyword name="CodeStyleTopicChecker (Constructor)" id="CodeStyleTopicChecker (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleTopicChecker.html#CodeStyleTopicChecker.__init__" /> + <keyword name="CodeStyleTopicChecker (Module)" id="CodeStyleTopicChecker (Module)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleTopicChecker.html" /> + <keyword name="CodeStyleTopicChecker._ignoreCode" id="CodeStyleTopicChecker._ignoreCode" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleTopicChecker.html#CodeStyleTopicChecker._ignoreCode" /> + <keyword name="CodeStyleTopicChecker._initializeCheckers" id="CodeStyleTopicChecker._initializeCheckers" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleTopicChecker.html#CodeStyleTopicChecker._initializeCheckers" /> + <keyword name="CodeStyleTopicChecker.addError" id="CodeStyleTopicChecker.addError" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleTopicChecker.html#CodeStyleTopicChecker.addError" /> + <keyword name="CodeStyleTopicChecker.addErrorFromNode" id="CodeStyleTopicChecker.addErrorFromNode" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleTopicChecker.html#CodeStyleTopicChecker.addErrorFromNode" /> + <keyword name="CodeStyleTopicChecker.run" id="CodeStyleTopicChecker.run" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleTopicChecker.html#CodeStyleTopicChecker.run" /> <keyword name="Coding" id="Coding" ref="eric7.Utilities.ClassBrowsers.ClbrBaseClasses.html#Coding" /> <keyword name="Coding (Constructor)" id="Coding (Constructor)" ref="eric7.Utilities.ClassBrowsers.ClbrBaseClasses.html#Coding.__init__" /> <keyword name="CodingError" id="CodingError" ref="eric7.Utilities.__init__.html#CodingError" /> @@ -3515,9 +3526,6 @@ <keyword name="ComplexityChecker (Module)" id="ComplexityChecker (Module)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Complexity.ComplexityChecker.html" /> <keyword name="ComplexityChecker.__checkLineComplexity" id="ComplexityChecker.__checkLineComplexity" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Complexity.ComplexityChecker.html#ComplexityChecker.__checkLineComplexity" /> <keyword name="ComplexityChecker.__checkMcCabeComplexity" id="ComplexityChecker.__checkMcCabeComplexity" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Complexity.ComplexityChecker.html#ComplexityChecker.__checkMcCabeComplexity" /> - <keyword name="ComplexityChecker.__error" id="ComplexityChecker.__error" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Complexity.ComplexityChecker.html#ComplexityChecker.__error" /> - <keyword name="ComplexityChecker.__ignoreCode" id="ComplexityChecker.__ignoreCode" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Complexity.ComplexityChecker.html#ComplexityChecker.__ignoreCode" /> - <keyword name="ComplexityChecker.run" id="ComplexityChecker.run" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Complexity.ComplexityChecker.html#ComplexityChecker.run" /> <keyword name="Conda" id="Conda" ref="eric7.CondaInterface.Conda.html#Conda" /> <keyword name="Conda (Constructor)" id="Conda (Constructor)" ref="eric7.CondaInterface.Conda.html#Conda.__init__" /> <keyword name="Conda (Module)" id="Conda (Module)" ref="eric7.CondaInterface.Conda.html" /> @@ -3879,10 +3887,11 @@ <keyword name="CycloneDXMetaDataDialog.getMetaData" id="CycloneDXMetaDataDialog.getMetaData" ref="eric7.CycloneDXInterface.CycloneDXMetaDataDialog.html#CycloneDXMetaDataDialog.getMetaData" /> <keyword name="CycloneDXUtilities (Module)" id="CycloneDXUtilities (Module)" ref="eric7.CycloneDXInterface.CycloneDXUtilities.html" /> <keyword name="DataViews (Package)" id="DataViews (Package)" ref="index-eric7.DataViews.html" /> - <keyword name="DateTimeVisitor" id="DateTimeVisitor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#DateTimeVisitor" /> - <keyword name="DateTimeVisitor (Constructor)" id="DateTimeVisitor (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#DateTimeVisitor.__init__" /> - <keyword name="DateTimeVisitor.__getFromKeywords" id="DateTimeVisitor.__getFromKeywords" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#DateTimeVisitor.__getFromKeywords" /> - <keyword name="DateTimeVisitor.visit_Call" id="DateTimeVisitor.visit_Call" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#DateTimeVisitor.visit_Call" /> + <keyword name="DateTimeVisitor" id="DateTimeVisitor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DateTimeVisitor.html#DateTimeVisitor" /> + <keyword name="DateTimeVisitor (Constructor)" id="DateTimeVisitor (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DateTimeVisitor.html#DateTimeVisitor.__init__" /> + <keyword name="DateTimeVisitor (Module)" id="DateTimeVisitor (Module)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DateTimeVisitor.html" /> + <keyword name="DateTimeVisitor.__getFromKeywords" id="DateTimeVisitor.__getFromKeywords" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DateTimeVisitor.html#DateTimeVisitor.__getFromKeywords" /> + <keyword name="DateTimeVisitor.visit_Call" id="DateTimeVisitor.visit_Call" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DateTimeVisitor.html#DateTimeVisitor.visit_Call" /> <keyword name="DebugBase" id="DebugBase" ref="eric7.DebugClients.Python.DebugBase.html#DebugBase" /> <keyword name="DebugBase (Constructor)" id="DebugBase (Constructor)" ref="eric7.DebugClients.Python.DebugBase.html#DebugBase.__init__" /> <keyword name="DebugBase (Module)" id="DebugBase (Module)" ref="eric7.DebugClients.Python.DebugBase.html" /> @@ -4368,14 +4377,15 @@ <keyword name="DeepLEngine.engineName" id="DeepLEngine.engineName" ref="eric7.Plugins.UiExtensionPlugins.Translator.TranslatorEngines.DeepLEngine.html#DeepLEngine.engineName" /> <keyword name="DeepLEngine.getTranslation" id="DeepLEngine.getTranslation" ref="eric7.Plugins.UiExtensionPlugins.Translator.TranslatorEngines.DeepLEngine.html#DeepLEngine.getTranslation" /> <keyword name="DeepLEngine.supportedLanguages" id="DeepLEngine.supportedLanguages" ref="eric7.Plugins.UiExtensionPlugins.Translator.TranslatorEngines.DeepLEngine.html#DeepLEngine.supportedLanguages" /> - <keyword name="DefaultMatchCaseVisitor" id="DefaultMatchCaseVisitor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#DefaultMatchCaseVisitor" /> - <keyword name="DefaultMatchCaseVisitor (Constructor)" id="DefaultMatchCaseVisitor (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#DefaultMatchCaseVisitor.__init__" /> - <keyword name="DefaultMatchCaseVisitor.__badNodes" id="DefaultMatchCaseVisitor.__badNodes" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#DefaultMatchCaseVisitor.__badNodes" /> - <keyword name="DefaultMatchCaseVisitor.__emptyMatchDefault" id="DefaultMatchCaseVisitor.__emptyMatchDefault" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#DefaultMatchCaseVisitor.__emptyMatchDefault" /> - <keyword name="DefaultMatchCaseVisitor.__findBadNode" id="DefaultMatchCaseVisitor.__findBadNode" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#DefaultMatchCaseVisitor.__findBadNode" /> - <keyword name="DefaultMatchCaseVisitor.__lastStatementDoesNotRaise" id="DefaultMatchCaseVisitor.__lastStatementDoesNotRaise" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#DefaultMatchCaseVisitor.__lastStatementDoesNotRaise" /> - <keyword name="DefaultMatchCaseVisitor.__returnPrecedesExceptionRaising" id="DefaultMatchCaseVisitor.__returnPrecedesExceptionRaising" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#DefaultMatchCaseVisitor.__returnPrecedesExceptionRaising" /> - <keyword name="DefaultMatchCaseVisitor.visit_Match" id="DefaultMatchCaseVisitor.visit_Match" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#DefaultMatchCaseVisitor.visit_Match" /> + <keyword name="DefaultMatchCaseVisitor" id="DefaultMatchCaseVisitor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DefaultMatchCaseVisitor.html#DefaultMatchCaseVisitor" /> + <keyword name="DefaultMatchCaseVisitor (Constructor)" id="DefaultMatchCaseVisitor (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DefaultMatchCaseVisitor.html#DefaultMatchCaseVisitor.__init__" /> + <keyword name="DefaultMatchCaseVisitor (Module)" id="DefaultMatchCaseVisitor (Module)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DefaultMatchCaseVisitor.html" /> + <keyword name="DefaultMatchCaseVisitor.__badNodes" id="DefaultMatchCaseVisitor.__badNodes" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DefaultMatchCaseVisitor.html#DefaultMatchCaseVisitor.__badNodes" /> + <keyword name="DefaultMatchCaseVisitor.__emptyMatchDefault" id="DefaultMatchCaseVisitor.__emptyMatchDefault" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DefaultMatchCaseVisitor.html#DefaultMatchCaseVisitor.__emptyMatchDefault" /> + <keyword name="DefaultMatchCaseVisitor.__findBadNode" id="DefaultMatchCaseVisitor.__findBadNode" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DefaultMatchCaseVisitor.html#DefaultMatchCaseVisitor.__findBadNode" /> + <keyword name="DefaultMatchCaseVisitor.__lastStatementDoesNotRaise" id="DefaultMatchCaseVisitor.__lastStatementDoesNotRaise" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DefaultMatchCaseVisitor.html#DefaultMatchCaseVisitor.__lastStatementDoesNotRaise" /> + <keyword name="DefaultMatchCaseVisitor.__returnPrecedesExceptionRaising" id="DefaultMatchCaseVisitor.__returnPrecedesExceptionRaising" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DefaultMatchCaseVisitor.html#DefaultMatchCaseVisitor.__returnPrecedesExceptionRaising" /> + <keyword name="DefaultMatchCaseVisitor.visit_Match" id="DefaultMatchCaseVisitor.visit_Match" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DefaultMatchCaseVisitor.html#DefaultMatchCaseVisitor.visit_Match" /> <keyword name="DefaultResolver" id="DefaultResolver" ref="eric7.DebugClients.Python.DebugVariables.html#DefaultResolver" /> <keyword name="DefaultResolver.getVariableList" id="DefaultResolver.getVariableList" ref="eric7.DebugClients.Python.DebugVariables.html#DefaultResolver.getVariableList" /> <keyword name="DefaultSearchEngines (Package)" id="DefaultSearchEngines (Package)" ref="index-eric7.WebBrowser.OpenSearch.DefaultSearchEngines.html" /> @@ -4479,11 +4489,9 @@ <keyword name="DocStyleChecker.__checkReturnType" id="DocStyleChecker.__checkReturnType" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.DocStyleChecker.html#DocStyleChecker.__checkReturnType" /> <keyword name="DocStyleChecker.__checkSummary" id="DocStyleChecker.__checkSummary" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.DocStyleChecker.html#DocStyleChecker.__checkSummary" /> <keyword name="DocStyleChecker.__checkTripleDoubleQuotes" id="DocStyleChecker.__checkTripleDoubleQuotes" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.DocStyleChecker.html#DocStyleChecker.__checkTripleDoubleQuotes" /> - <keyword name="DocStyleChecker.__error" id="DocStyleChecker.__error" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.DocStyleChecker.html#DocStyleChecker.__error" /> <keyword name="DocStyleChecker.__getArgNames" id="DocStyleChecker.__getArgNames" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.DocStyleChecker.html#DocStyleChecker.__getArgNames" /> <keyword name="DocStyleChecker.__getSummaryLine" id="DocStyleChecker.__getSummaryLine" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.DocStyleChecker.html#DocStyleChecker.__getSummaryLine" /> <keyword name="DocStyleChecker.__getSummaryLines" id="DocStyleChecker.__getSummaryLines" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.DocStyleChecker.html#DocStyleChecker.__getSummaryLines" /> - <keyword name="DocStyleChecker.__ignoreCode" id="DocStyleChecker.__ignoreCode" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.DocStyleChecker.html#DocStyleChecker.__ignoreCode" /> <keyword name="DocStyleChecker.__parseClasses" id="DocStyleChecker.__parseClasses" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.DocStyleChecker.html#DocStyleChecker.__parseClasses" /> <keyword name="DocStyleChecker.__parseContexts" id="DocStyleChecker.__parseContexts" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.DocStyleChecker.html#DocStyleChecker.__parseContexts" /> <keyword name="DocStyleChecker.__parseDocstring" id="DocStyleChecker.__parseDocstring" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.DocStyleChecker.html#DocStyleChecker.__parseDocstring" /> @@ -4494,6 +4502,7 @@ <keyword name="DocStyleChecker.__readline" id="DocStyleChecker.__readline" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.DocStyleChecker.html#DocStyleChecker.__readline" /> <keyword name="DocStyleChecker.__resetReadline" id="DocStyleChecker.__resetReadline" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.DocStyleChecker.html#DocStyleChecker.__resetReadline" /> <keyword name="DocStyleChecker.__skipIndentedBlock" id="DocStyleChecker.__skipIndentedBlock" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.DocStyleChecker.html#DocStyleChecker.__skipIndentedBlock" /> + <keyword name="DocStyleChecker.addError" id="DocStyleChecker.addError" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.DocStyleChecker.html#DocStyleChecker.addError" /> <keyword name="DocStyleChecker.run" id="DocStyleChecker.run" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.DocStyleChecker.html#DocStyleChecker.run" /> <keyword name="DocStyleContext" id="DocStyleContext" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.DocStyleChecker.html#DocStyleContext" /> <keyword name="DocStyleContext (Constructor)" id="DocStyleContext (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.DocStyleChecker.html#DocStyleContext.__init__" /> @@ -6939,11 +6948,11 @@ <keyword name="EthernetStatusDialog" id="EthernetStatusDialog" ref="eric7.MicroPython.EthernetDialogs.EthernetStatusDialog.html#EthernetStatusDialog" /> <keyword name="EthernetStatusDialog (Constructor)" id="EthernetStatusDialog (Constructor)" ref="eric7.MicroPython.EthernetDialogs.EthernetStatusDialog.html#EthernetStatusDialog.__init__" /> <keyword name="EthernetStatusDialog (Module)" id="EthernetStatusDialog (Module)" ref="eric7.MicroPython.EthernetDialogs.EthernetStatusDialog.html" /> - <keyword name="ExceptBaseExceptionVisitor" id="ExceptBaseExceptionVisitor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ExceptBaseExceptionVisitor" /> - <keyword name="ExceptBaseExceptionVisitor (Constructor)" id="ExceptBaseExceptionVisitor (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ExceptBaseExceptionVisitor.__init__" /> - <keyword name="ExceptBaseExceptionVisitor.reRaised" id="ExceptBaseExceptionVisitor.reRaised" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ExceptBaseExceptionVisitor.reRaised" /> - <keyword name="ExceptBaseExceptionVisitor.visit_ExceptHandler" id="ExceptBaseExceptionVisitor.visit_ExceptHandler" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ExceptBaseExceptionVisitor.visit_ExceptHandler" /> - <keyword name="ExceptBaseExceptionVisitor.visit_Raise" id="ExceptBaseExceptionVisitor.visit_Raise" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ExceptBaseExceptionVisitor.visit_Raise" /> + <keyword name="ExceptBaseExceptionVisitor" id="ExceptBaseExceptionVisitor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#ExceptBaseExceptionVisitor" /> + <keyword name="ExceptBaseExceptionVisitor (Constructor)" id="ExceptBaseExceptionVisitor (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#ExceptBaseExceptionVisitor.__init__" /> + <keyword name="ExceptBaseExceptionVisitor.reRaised" id="ExceptBaseExceptionVisitor.reRaised" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#ExceptBaseExceptionVisitor.reRaised" /> + <keyword name="ExceptBaseExceptionVisitor.visit_ExceptHandler" id="ExceptBaseExceptionVisitor.visit_ExceptHandler" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#ExceptBaseExceptionVisitor.visit_ExceptHandler" /> + <keyword name="ExceptBaseExceptionVisitor.visit_Raise" id="ExceptBaseExceptionVisitor.visit_Raise" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#ExceptBaseExceptionVisitor.visit_Raise" /> <keyword name="ExceptionLogger" id="ExceptionLogger" ref="eric7.Debugger.ExceptionLogger.html#ExceptionLogger" /> <keyword name="ExceptionLogger (Constructor)" id="ExceptionLogger (Constructor)" ref="eric7.Debugger.ExceptionLogger.html#ExceptionLogger.__init__" /> <keyword name="ExceptionLogger (Module)" id="ExceptionLogger (Module)" ref="eric7.Debugger.ExceptionLogger.html" /> @@ -7389,12 +7398,12 @@ <keyword name="Function.isDynamicallyTyped" id="Function.isDynamicallyTyped" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsFunctionVisitor.html#Function.isDynamicallyTyped" /> <keyword name="Function.isFullyAnnotated" id="Function.isFullyAnnotated" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsFunctionVisitor.html#Function.isFullyAnnotated" /> <keyword name="Function.setEndLine" id="Function.setEndLine" ref="eric7.Utilities.ModuleParser.html#Function.setEndLine" /> - <keyword name="FunctionDefDefaultsVisitor" id="FunctionDefDefaultsVisitor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#FunctionDefDefaultsVisitor" /> - <keyword name="FunctionDefDefaultsVisitor (Constructor)" id="FunctionDefDefaultsVisitor (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#FunctionDefDefaultsVisitor.__init__" /> - <keyword name="FunctionDefDefaultsVisitor.__visitMutableLiteralOrComprehension" id="FunctionDefDefaultsVisitor.__visitMutableLiteralOrComprehension" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#FunctionDefDefaultsVisitor.__visitMutableLiteralOrComprehension" /> - <keyword name="FunctionDefDefaultsVisitor.visit" id="FunctionDefDefaultsVisitor.visit" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#FunctionDefDefaultsVisitor.visit" /> - <keyword name="FunctionDefDefaultsVisitor.visit_Call" id="FunctionDefDefaultsVisitor.visit_Call" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#FunctionDefDefaultsVisitor.visit_Call" /> - <keyword name="FunctionDefDefaultsVisitor.visit_Lambda" id="FunctionDefDefaultsVisitor.visit_Lambda" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#FunctionDefDefaultsVisitor.visit_Lambda" /> + <keyword name="FunctionDefDefaultsVisitor" id="FunctionDefDefaultsVisitor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#FunctionDefDefaultsVisitor" /> + <keyword name="FunctionDefDefaultsVisitor (Constructor)" id="FunctionDefDefaultsVisitor (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#FunctionDefDefaultsVisitor.__init__" /> + <keyword name="FunctionDefDefaultsVisitor.__visitMutableLiteralOrComprehension" id="FunctionDefDefaultsVisitor.__visitMutableLiteralOrComprehension" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#FunctionDefDefaultsVisitor.__visitMutableLiteralOrComprehension" /> + <keyword name="FunctionDefDefaultsVisitor.visit" id="FunctionDefDefaultsVisitor.visit" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#FunctionDefDefaultsVisitor.visit" /> + <keyword name="FunctionDefDefaultsVisitor.visit_Call" id="FunctionDefDefaultsVisitor.visit_Call" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#FunctionDefDefaultsVisitor.visit_Call" /> + <keyword name="FunctionDefDefaultsVisitor.visit_Lambda" id="FunctionDefDefaultsVisitor.visit_Lambda" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#FunctionDefDefaultsVisitor.visit_Lambda" /> <keyword name="FunctionFinder" id="FunctionFinder" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Unused.UnusedChecker.html#FunctionFinder" /> <keyword name="FunctionFinder (Constructor)" id="FunctionFinder (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Unused.UnusedChecker.html#FunctionFinder.__init__" /> <keyword name="FunctionFinder.__visitFunctionTypes" id="FunctionFinder.__visitFunctionTypes" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Unused.UnusedChecker.html#FunctionFinder.__visitFunctionTypes" /> @@ -10368,11 +10377,8 @@ <keyword name="ImportsChecker.__checkLocalImports" id="ImportsChecker.__checkLocalImports" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Imports.ImportsChecker.html#ImportsChecker.__checkLocalImports" /> <keyword name="ImportsChecker.__checkUnnecessaryAlias" id="ImportsChecker.__checkUnnecessaryAlias" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Imports.ImportsChecker.html#ImportsChecker.__checkUnnecessaryAlias" /> <keyword name="ImportsChecker.__compileUnstructuredGlob" id="ImportsChecker.__compileUnstructuredGlob" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Imports.ImportsChecker.html#ImportsChecker.__compileUnstructuredGlob" /> - <keyword name="ImportsChecker.__error" id="ImportsChecker.__error" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Imports.ImportsChecker.html#ImportsChecker.__error" /> - <keyword name="ImportsChecker.__ignoreCode" id="ImportsChecker.__ignoreCode" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Imports.ImportsChecker.html#ImportsChecker.__ignoreCode" /> <keyword name="ImportsChecker.__isModuleBanned" id="ImportsChecker.__isModuleBanned" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Imports.ImportsChecker.html#ImportsChecker.__isModuleBanned" /> <keyword name="ImportsChecker.__tidyImports" id="ImportsChecker.__tidyImports" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Imports.ImportsChecker.html#ImportsChecker.__tidyImports" /> - <keyword name="ImportsChecker.run" id="ImportsChecker.run" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Imports.ImportsChecker.html#ImportsChecker.run" /> <keyword name="ImportsDiagramBuilder" id="ImportsDiagramBuilder" ref="eric7.Graphics.ImportsDiagramBuilder.html#ImportsDiagramBuilder" /> <keyword name="ImportsDiagramBuilder (Constructor)" id="ImportsDiagramBuilder (Constructor)" ref="eric7.Graphics.ImportsDiagramBuilder.html#ImportsDiagramBuilder.__init__" /> <keyword name="ImportsDiagramBuilder (Module)" id="ImportsDiagramBuilder (Module)" ref="eric7.Graphics.ImportsDiagramBuilder.html" /> @@ -11380,9 +11386,6 @@ <keyword name="LoggingChecker (Constructor)" id="LoggingChecker (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Logging.LoggingChecker.html#LoggingChecker.__init__" /> <keyword name="LoggingChecker (Module)" id="LoggingChecker (Module)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Logging.LoggingChecker.html" /> <keyword name="LoggingChecker.__checkLogging" id="LoggingChecker.__checkLogging" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Logging.LoggingChecker.html#LoggingChecker.__checkLogging" /> - <keyword name="LoggingChecker.__error" id="LoggingChecker.__error" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Logging.LoggingChecker.html#LoggingChecker.__error" /> - <keyword name="LoggingChecker.__ignoreCode" id="LoggingChecker.__ignoreCode" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Logging.LoggingChecker.html#LoggingChecker.__ignoreCode" /> - <keyword name="LoggingChecker.run" id="LoggingChecker.run" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Logging.LoggingChecker.html#LoggingChecker.run" /> <keyword name="LoggingVisitor" id="LoggingVisitor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Logging.LoggingVisitor.html#LoggingVisitor" /> <keyword name="LoggingVisitor (Constructor)" id="LoggingVisitor (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Logging.LoggingVisitor.html#LoggingVisitor.__init__" /> <keyword name="LoggingVisitor (Module)" id="LoggingVisitor (Module)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Logging.LoggingVisitor.html" /> @@ -11400,21 +11403,21 @@ <keyword name="LoginForm (Constructor)" id="LoginForm (Constructor)" ref="eric7.WebBrowser.Passwords.LoginForm.html#LoginForm.__init__" /> <keyword name="LoginForm (Module)" id="LoginForm (Module)" ref="eric7.WebBrowser.Passwords.LoginForm.html" /> <keyword name="LoginForm.isValid" id="LoginForm.isValid" ref="eric7.WebBrowser.Passwords.LoginForm.html#LoginForm.isValid" /> - <keyword name="M520NameFinder" id="M520NameFinder" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#M520NameFinder" /> - <keyword name="M520NameFinder.visit_DictComp" id="M520NameFinder.visit_DictComp" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#M520NameFinder.visit_DictComp" /> - <keyword name="M520NameFinder.visit_GeneratorExp" id="M520NameFinder.visit_GeneratorExp" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#M520NameFinder.visit_GeneratorExp" /> - <keyword name="M520NameFinder.visit_Lambda" id="M520NameFinder.visit_Lambda" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#M520NameFinder.visit_Lambda" /> - <keyword name="M520NameFinder.visit_ListComp" id="M520NameFinder.visit_ListComp" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#M520NameFinder.visit_ListComp" /> - <keyword name="M520NameFinder.visit_comprehension" id="M520NameFinder.visit_comprehension" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#M520NameFinder.visit_comprehension" /> - <keyword name="M540CaughtException" id="M540CaughtException" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#M540CaughtException" /> - <keyword name="M541UnhandledKeyType" id="M541UnhandledKeyType" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#M541UnhandledKeyType" /> - <keyword name="M541VariableKeyType" id="M541VariableKeyType" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#M541VariableKeyType" /> - <keyword name="M541VariableKeyType (Constructor)" id="M541VariableKeyType (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#M541VariableKeyType.__init__" /> - <keyword name="M569Checker" id="M569Checker" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#M569Checker" /> - <keyword name="M569Checker (Constructor)" id="M569Checker (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#M569Checker.__init__" /> - <keyword name="M569Checker.visit" id="M569Checker.visit" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#M569Checker.visit" /> - <keyword name="M569Checker.visit_Call" id="M569Checker.visit_Call" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#M569Checker.visit_Call" /> - <keyword name="M569Checker.visit_Delete" id="M569Checker.visit_Delete" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#M569Checker.visit_Delete" /> + <keyword name="M520NameFinder" id="M520NameFinder" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#M520NameFinder" /> + <keyword name="M520NameFinder.visit_DictComp" id="M520NameFinder.visit_DictComp" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#M520NameFinder.visit_DictComp" /> + <keyword name="M520NameFinder.visit_GeneratorExp" id="M520NameFinder.visit_GeneratorExp" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#M520NameFinder.visit_GeneratorExp" /> + <keyword name="M520NameFinder.visit_Lambda" id="M520NameFinder.visit_Lambda" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#M520NameFinder.visit_Lambda" /> + <keyword name="M520NameFinder.visit_ListComp" id="M520NameFinder.visit_ListComp" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#M520NameFinder.visit_ListComp" /> + <keyword name="M520NameFinder.visit_comprehension" id="M520NameFinder.visit_comprehension" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#M520NameFinder.visit_comprehension" /> + <keyword name="M540CaughtException" id="M540CaughtException" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#M540CaughtException" /> + <keyword name="M541UnhandledKeyType" id="M541UnhandledKeyType" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#M541UnhandledKeyType" /> + <keyword name="M541VariableKeyType" id="M541VariableKeyType" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#M541VariableKeyType" /> + <keyword name="M541VariableKeyType (Constructor)" id="M541VariableKeyType (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#M541VariableKeyType.__init__" /> + <keyword name="M569Checker" id="M569Checker" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#M569Checker" /> + <keyword name="M569Checker (Constructor)" id="M569Checker (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#M569Checker.__init__" /> + <keyword name="M569Checker.visit" id="M569Checker.visit" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#M569Checker.visit" /> + <keyword name="M569Checker.visit_Call" id="M569Checker.visit_Call" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#M569Checker.visit_Call" /> + <keyword name="M569Checker.visit_Delete" id="M569Checker.visit_Delete" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#M569Checker.visit_Delete" /> <keyword name="MainPasswordEntryDialog" id="MainPasswordEntryDialog" ref="eric7.Preferences.ConfigurationPages.MainPasswordEntryDialog.html#MainPasswordEntryDialog" /> <keyword name="MainPasswordEntryDialog (Constructor)" id="MainPasswordEntryDialog (Constructor)" ref="eric7.Preferences.ConfigurationPages.MainPasswordEntryDialog.html#MainPasswordEntryDialog.__init__" /> <keyword name="MainPasswordEntryDialog (Module)" id="MainPasswordEntryDialog (Module)" ref="eric7.Preferences.ConfigurationPages.MainPasswordEntryDialog.html" /> @@ -12047,12 +12050,9 @@ <keyword name="MiscellaneousChecker.__checkSysVersion" id="MiscellaneousChecker.__checkSysVersion" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#MiscellaneousChecker.__checkSysVersion" /> <keyword name="MiscellaneousChecker.__checkTuple" id="MiscellaneousChecker.__checkTuple" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#MiscellaneousChecker.__checkTuple" /> <keyword name="MiscellaneousChecker.__dictShouldBeChecked" id="MiscellaneousChecker.__dictShouldBeChecked" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#MiscellaneousChecker.__dictShouldBeChecked" /> - <keyword name="MiscellaneousChecker.__error" id="MiscellaneousChecker.__error" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#MiscellaneousChecker.__error" /> <keyword name="MiscellaneousChecker.__getCoding" id="MiscellaneousChecker.__getCoding" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#MiscellaneousChecker.__getCoding" /> <keyword name="MiscellaneousChecker.__getFields" id="MiscellaneousChecker.__getFields" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#MiscellaneousChecker.__getFields" /> - <keyword name="MiscellaneousChecker.__ignoreCode" id="MiscellaneousChecker.__ignoreCode" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#MiscellaneousChecker.__ignoreCode" /> <keyword name="MiscellaneousChecker.__isImplicitStringConcat" id="MiscellaneousChecker.__isImplicitStringConcat" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#MiscellaneousChecker.__isImplicitStringConcat" /> - <keyword name="MiscellaneousChecker.run" id="MiscellaneousChecker.run" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#MiscellaneousChecker.run" /> <keyword name="MiscellaneousDefaults (Module)" id="MiscellaneousDefaults (Module)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousDefaults.html" /> <keyword name="Module" id="Module" ref="eric7.Utilities.ClassBrowsers.ClbrBaseClasses.html#Module" /> <keyword name="Module" id="Module" ref="eric7.Utilities.ClassBrowsers.rbclbr.html#Module" /> @@ -12237,12 +12237,12 @@ <keyword name="MyMemoryEngine.engineName" id="MyMemoryEngine.engineName" ref="eric7.Plugins.UiExtensionPlugins.Translator.TranslatorEngines.MyMemoryEngine.html#MyMemoryEngine.engineName" /> <keyword name="MyMemoryEngine.getTranslation" id="MyMemoryEngine.getTranslation" ref="eric7.Plugins.UiExtensionPlugins.Translator.TranslatorEngines.MyMemoryEngine.html#MyMemoryEngine.getTranslation" /> <keyword name="MyMemoryEngine.supportedLanguages" id="MyMemoryEngine.supportedLanguages" ref="eric7.Plugins.UiExtensionPlugins.Translator.TranslatorEngines.MyMemoryEngine.html#MyMemoryEngine.supportedLanguages" /> - <keyword name="NameFinder" id="NameFinder" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#NameFinder" /> + <keyword name="NameFinder" id="NameFinder" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#NameFinder" /> <keyword name="NameFinder" id="NameFinder" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Unused.UnusedChecker.html#NameFinder" /> - <keyword name="NameFinder (Constructor)" id="NameFinder (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#NameFinder.__init__" /> - <keyword name="NameFinder.getNames" id="NameFinder.getNames" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#NameFinder.getNames" /> - <keyword name="NameFinder.visit" id="NameFinder.visit" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#NameFinder.visit" /> - <keyword name="NameFinder.visit_Name" id="NameFinder.visit_Name" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#NameFinder.visit_Name" /> + <keyword name="NameFinder (Constructor)" id="NameFinder (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#NameFinder.__init__" /> + <keyword name="NameFinder.getNames" id="NameFinder.getNames" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#NameFinder.getNames" /> + <keyword name="NameFinder.visit" id="NameFinder.visit" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#NameFinder.visit" /> + <keyword name="NameFinder.visit_Name" id="NameFinder.visit_Name" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#NameFinder.visit_Name" /> <keyword name="NameFinder.visit_Name" id="NameFinder.visit_Name" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Unused.UnusedChecker.html#NameFinder.visit_Name" /> <keyword name="NameOrder (Package)" id="NameOrder (Package)" ref="index-eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.html" /> <keyword name="NameOrderChecker" id="NameOrderChecker" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.NameOrderChecker.html#NameOrderChecker" /> @@ -12250,29 +12250,26 @@ <keyword name="NameOrderChecker (Module)" id="NameOrderChecker (Module)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.NameOrderChecker.html" /> <keyword name="NameOrderChecker.__atoi" id="NameOrderChecker.__atoi" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.NameOrderChecker.html#NameOrderChecker.__atoi" /> <keyword name="NameOrderChecker.__checkNameOrder" id="NameOrderChecker.__checkNameOrder" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.NameOrderChecker.html#NameOrderChecker.__checkNameOrder" /> - <keyword name="NameOrderChecker.__error" id="NameOrderChecker.__error" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.NameOrderChecker.html#NameOrderChecker.__error" /> <keyword name="NameOrderChecker.__findErrorInAll" id="NameOrderChecker.__findErrorInAll" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.NameOrderChecker.html#NameOrderChecker.__findErrorInAll" /> <keyword name="NameOrderChecker.__findExceptionListErrors" id="NameOrderChecker.__findExceptionListErrors" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.NameOrderChecker.html#NameOrderChecker.__findExceptionListErrors" /> <keyword name="NameOrderChecker.__findExceptionListNodes" id="NameOrderChecker.__findExceptionListNodes" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.NameOrderChecker.html#NameOrderChecker.__findExceptionListNodes" /> <keyword name="NameOrderChecker.__findExceptionListStr" id="NameOrderChecker.__findExceptionListStr" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.NameOrderChecker.html#NameOrderChecker.__findExceptionListStr" /> <keyword name="NameOrderChecker.__findNodes" id="NameOrderChecker.__findNodes" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.NameOrderChecker.html#NameOrderChecker.__findNodes" /> - <keyword name="NameOrderChecker.__ignoreCode" id="NameOrderChecker.__ignoreCode" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.NameOrderChecker.html#NameOrderChecker.__ignoreCode" /> <keyword name="NameOrderChecker.__naturalKeys" id="NameOrderChecker.__naturalKeys" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.NameOrderChecker.html#NameOrderChecker.__naturalKeys" /> <keyword name="NameOrderChecker.__naturally" id="NameOrderChecker.__naturally" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.NameOrderChecker.html#NameOrderChecker.__naturally" /> <keyword name="NameOrderChecker.keyCallback" id="NameOrderChecker.keyCallback" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.NameOrderChecker.html#NameOrderChecker.keyCallback" /> <keyword name="NameOrderChecker.moduleKey" id="NameOrderChecker.moduleKey" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.NameOrderChecker.html#NameOrderChecker.moduleKey" /> - <keyword name="NameOrderChecker.run" id="NameOrderChecker.run" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.NameOrderChecker.html#NameOrderChecker.run" /> <keyword name="NameOrderChecker.sorted" id="NameOrderChecker.sorted" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.NameOrderChecker.html#NameOrderChecker.sorted" /> <keyword name="NameResolver" id="NameResolver" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.PathlibChecker.html#NameResolver" /> <keyword name="NameResolver (Constructor)" id="NameResolver (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.PathlibChecker.html#NameResolver.__init__" /> <keyword name="NameResolver.name" id="NameResolver.name" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.PathlibChecker.html#NameResolver.name" /> <keyword name="NameResolver.visit_Attribute" id="NameResolver.visit_Attribute" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.PathlibChecker.html#NameResolver.visit_Attribute" /> <keyword name="NameResolver.visit_Name" id="NameResolver.visit_Name" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.PathlibChecker.html#NameResolver.visit_Name" /> - <keyword name="NamedExprFinder" id="NamedExprFinder" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#NamedExprFinder" /> - <keyword name="NamedExprFinder (Constructor)" id="NamedExprFinder (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#NamedExprFinder.__init__" /> - <keyword name="NamedExprFinder.getNames" id="NamedExprFinder.getNames" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#NamedExprFinder.getNames" /> - <keyword name="NamedExprFinder.visit" id="NamedExprFinder.visit" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#NamedExprFinder.visit" /> - <keyword name="NamedExprFinder.visit_NamedExpr" id="NamedExprFinder.visit_NamedExpr" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#NamedExprFinder.visit_NamedExpr" /> + <keyword name="NamedExprFinder" id="NamedExprFinder" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#NamedExprFinder" /> + <keyword name="NamedExprFinder (Constructor)" id="NamedExprFinder (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#NamedExprFinder.__init__" /> + <keyword name="NamedExprFinder.getNames" id="NamedExprFinder.getNames" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#NamedExprFinder.getNames" /> + <keyword name="NamedExprFinder.visit" id="NamedExprFinder.visit" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#NamedExprFinder.visit" /> + <keyword name="NamedExprFinder.visit_NamedExpr" id="NamedExprFinder.visit_NamedExpr" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#NamedExprFinder.visit_NamedExpr" /> <keyword name="Naming (Package)" id="Naming (Package)" ref="index-eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.html" /> <keyword name="NamingStyleChecker" id="NamingStyleChecker" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.NamingStyleChecker.html#NamingStyleChecker" /> <keyword name="NamingStyleChecker (Constructor)" id="NamingStyleChecker (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.NamingStyleChecker.html#NamingStyleChecker.__init__" /> @@ -12285,7 +12282,6 @@ <keyword name="NamingStyleChecker.__checkNameToBeAvoided" id="NamingStyleChecker.__checkNameToBeAvoided" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.NamingStyleChecker.html#NamingStyleChecker.__checkNameToBeAvoided" /> <keyword name="NamingStyleChecker.__checkVariableNames" id="NamingStyleChecker.__checkVariableNames" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.NamingStyleChecker.html#NamingStyleChecker.__checkVariableNames" /> <keyword name="NamingStyleChecker.__classVariableCheck" id="NamingStyleChecker.__classVariableCheck" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.NamingStyleChecker.html#NamingStyleChecker.__classVariableCheck" /> - <keyword name="NamingStyleChecker.__error" id="NamingStyleChecker.__error" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.NamingStyleChecker.html#NamingStyleChecker.__error" /> <keyword name="NamingStyleChecker.__extractNames" id="NamingStyleChecker.__extractNames" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.NamingStyleChecker.html#NamingStyleChecker.__extractNames" /> <keyword name="NamingStyleChecker.__findGlobalDefs" id="NamingStyleChecker.__findGlobalDefs" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.NamingStyleChecker.html#NamingStyleChecker.__findGlobalDefs" /> <keyword name="NamingStyleChecker.__findVariableNameErrors" id="NamingStyleChecker.__findVariableNameErrors" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.NamingStyleChecker.html#NamingStyleChecker.__findVariableNameErrors" /> @@ -12293,7 +12289,6 @@ <keyword name="NamingStyleChecker.__getArgNames" id="NamingStyleChecker.__getArgNames" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.NamingStyleChecker.html#NamingStyleChecker.__getArgNames" /> <keyword name="NamingStyleChecker.__getClassdef" id="NamingStyleChecker.__getClassdef" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.NamingStyleChecker.html#NamingStyleChecker.__getClassdef" /> <keyword name="NamingStyleChecker.__globalVariableCheck" id="NamingStyleChecker.__globalVariableCheck" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.NamingStyleChecker.html#NamingStyleChecker.__globalVariableCheck" /> - <keyword name="NamingStyleChecker.__ignoreCode" id="NamingStyleChecker.__ignoreCode" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.NamingStyleChecker.html#NamingStyleChecker.__ignoreCode" /> <keyword name="NamingStyleChecker.__isMixedCase" id="NamingStyleChecker.__isMixedCase" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.NamingStyleChecker.html#NamingStyleChecker.__isMixedCase" /> <keyword name="NamingStyleChecker.__isNameToBeAvoided" id="NamingStyleChecker.__isNameToBeAvoided" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.NamingStyleChecker.html#NamingStyleChecker.__isNameToBeAvoided" /> <keyword name="NamingStyleChecker.__isNamedTupel" id="NamingStyleChecker.__isNamedTupel" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.NamingStyleChecker.html#NamingStyleChecker.__isNamedTupel" /> @@ -12301,6 +12296,7 @@ <keyword name="NamingStyleChecker.__tagClassFunctions" id="NamingStyleChecker.__tagClassFunctions" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.NamingStyleChecker.html#NamingStyleChecker.__tagClassFunctions" /> <keyword name="NamingStyleChecker.__visitNode" id="NamingStyleChecker.__visitNode" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.NamingStyleChecker.html#NamingStyleChecker.__visitNode" /> <keyword name="NamingStyleChecker.__visitTree" id="NamingStyleChecker.__visitTree" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.NamingStyleChecker.html#NamingStyleChecker.__visitTree" /> + <keyword name="NamingStyleChecker.addErrorFromNode" id="NamingStyleChecker.addErrorFromNode" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.NamingStyleChecker.html#NamingStyleChecker.addErrorFromNode" /> <keyword name="NamingStyleChecker.run" id="NamingStyleChecker.run" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.NamingStyleChecker.html#NamingStyleChecker.run" /> <keyword name="Navigation (Package)" id="Navigation (Package)" ref="index-eric7.WebBrowser.Navigation.html" /> <keyword name="NavigationBar" id="NavigationBar" ref="eric7.WebBrowser.Navigation.NavigationBar.html#NavigationBar" /> @@ -12774,9 +12770,7 @@ <keyword name="PathlibChecker (Constructor)" id="PathlibChecker (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.PathlibChecker.html#PathlibChecker.__init__" /> <keyword name="PathlibChecker (Module)" id="PathlibChecker (Module)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.PathlibChecker.html" /> <keyword name="PathlibChecker.__checkForReplacement" id="PathlibChecker.__checkForReplacement" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.PathlibChecker.html#PathlibChecker.__checkForReplacement" /> - <keyword name="PathlibChecker.__error" id="PathlibChecker.__error" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.PathlibChecker.html#PathlibChecker.__error" /> - <keyword name="PathlibChecker.__ignoreCode" id="PathlibChecker.__ignoreCode" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.PathlibChecker.html#PathlibChecker.__ignoreCode" /> - <keyword name="PathlibChecker.run" id="PathlibChecker.run" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.PathlibChecker.html#PathlibChecker.run" /> + <keyword name="PathlibChecker.__checkPathlibReplacement" id="PathlibChecker.__checkPathlibReplacement" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.PathlibChecker.html#PathlibChecker.__checkPathlibReplacement" /> <keyword name="PathlibVisitor" id="PathlibVisitor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.PathlibChecker.html#PathlibVisitor" /> <keyword name="PathlibVisitor (Constructor)" id="PathlibVisitor (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.PathlibChecker.html#PathlibVisitor.__init__" /> <keyword name="PathlibVisitor.visit_Call" id="PathlibVisitor.visit_Call" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.PathlibChecker.html#PathlibVisitor.visit_Call" /> @@ -14372,9 +14366,6 @@ <keyword name="PydanticChecker (Constructor)" id="PydanticChecker (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Pydantic.PydanticChecker.html#PydanticChecker.__init__" /> <keyword name="PydanticChecker (Module)" id="PydanticChecker (Module)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Pydantic.PydanticChecker.html" /> <keyword name="PydanticChecker.__checkPydantic" id="PydanticChecker.__checkPydantic" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Pydantic.PydanticChecker.html#PydanticChecker.__checkPydantic" /> - <keyword name="PydanticChecker.__error" id="PydanticChecker.__error" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Pydantic.PydanticChecker.html#PydanticChecker.__error" /> - <keyword name="PydanticChecker.__ignoreCode" id="PydanticChecker.__ignoreCode" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Pydantic.PydanticChecker.html#PydanticChecker.__ignoreCode" /> - <keyword name="PydanticChecker.run" id="PydanticChecker.run" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Pydantic.PydanticChecker.html#PydanticChecker.run" /> <keyword name="PydanticUtils (Module)" id="PydanticUtils (Module)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Pydantic.PydanticUtils.html" /> <keyword name="PydanticVisitor" id="PydanticVisitor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Pydantic.PydanticVisitor.html#PydanticVisitor" /> <keyword name="PydanticVisitor (Constructor)" id="PydanticVisitor (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Pydantic.PydanticVisitor.html#PydanticVisitor.__init__" /> @@ -15011,35 +15002,40 @@ <keyword name="RestructuredTextProvider.numberedList" id="RestructuredTextProvider.numberedList" ref="eric7.QScintilla.MarkupProviders.RestructuredTextProvider.html#RestructuredTextProvider.numberedList" /> <keyword name="RestructuredTextProvider.quote" id="RestructuredTextProvider.quote" ref="eric7.QScintilla.MarkupProviders.RestructuredTextProvider.html#RestructuredTextProvider.quote" /> <keyword name="ReturnVisitor" id="ReturnVisitor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsFunctionVisitor.html#ReturnVisitor" /> - <keyword name="ReturnVisitor" id="ReturnVisitor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ReturnVisitor" /> + <keyword name="ReturnVisitor" id="ReturnVisitor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html#ReturnVisitor" /> <keyword name="ReturnVisitor (Constructor)" id="ReturnVisitor (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsFunctionVisitor.html#ReturnVisitor.__init__" /> - <keyword name="ReturnVisitor (Constructor)" id="ReturnVisitor (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ReturnVisitor.__init__" /> - <keyword name="ReturnVisitor.__checkFunction" id="ReturnVisitor.__checkFunction" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ReturnVisitor.__checkFunction" /> - <keyword name="ReturnVisitor.__checkImplicitReturn" id="ReturnVisitor.__checkImplicitReturn" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ReturnVisitor.__checkImplicitReturn" /> - <keyword name="ReturnVisitor.__checkImplicitReturnValue" id="ReturnVisitor.__checkImplicitReturnValue" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ReturnVisitor.__checkImplicitReturnValue" /> - <keyword name="ReturnVisitor.__checkUnnecessaryAssign" id="ReturnVisitor.__checkUnnecessaryAssign" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ReturnVisitor.__checkUnnecessaryAssign" /> - <keyword name="ReturnVisitor.__checkUnnecessaryReturnNone" id="ReturnVisitor.__checkUnnecessaryReturnNone" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ReturnVisitor.__checkUnnecessaryReturnNone" /> - <keyword name="ReturnVisitor.__hasRefsBeforeNextAssign" id="ReturnVisitor.__hasRefsBeforeNextAssign" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ReturnVisitor.__hasRefsBeforeNextAssign" /> - <keyword name="ReturnVisitor.__isFalse" id="ReturnVisitor.__isFalse" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ReturnVisitor.__isFalse" /> - <keyword name="ReturnVisitor.__isNone" id="ReturnVisitor.__isNone" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ReturnVisitor.__isNone" /> - <keyword name="ReturnVisitor.__resultExists" id="ReturnVisitor.__resultExists" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ReturnVisitor.__resultExists" /> - <keyword name="ReturnVisitor.__visitAssignTarget" id="ReturnVisitor.__visitAssignTarget" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ReturnVisitor.__visitAssignTarget" /> - <keyword name="ReturnVisitor.__visitLoop" id="ReturnVisitor.__visitLoop" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ReturnVisitor.__visitLoop" /> - <keyword name="ReturnVisitor.__visitWithStack" id="ReturnVisitor.__visitWithStack" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ReturnVisitor.__visitWithStack" /> - <keyword name="ReturnVisitor.assigns" id="ReturnVisitor.assigns" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ReturnVisitor.assigns" /> + <keyword name="ReturnVisitor (Constructor)" id="ReturnVisitor (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html#ReturnVisitor.__init__" /> + <keyword name="ReturnVisitor (Module)" id="ReturnVisitor (Module)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html" /> + <keyword name="ReturnVisitor.__checkFunction" id="ReturnVisitor.__checkFunction" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html#ReturnVisitor.__checkFunction" /> + <keyword name="ReturnVisitor.__checkImplicitReturn" id="ReturnVisitor.__checkImplicitReturn" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html#ReturnVisitor.__checkImplicitReturn" /> + <keyword name="ReturnVisitor.__checkImplicitReturnValue" id="ReturnVisitor.__checkImplicitReturnValue" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html#ReturnVisitor.__checkImplicitReturnValue" /> + <keyword name="ReturnVisitor.__checkUnnecessaryAssign" id="ReturnVisitor.__checkUnnecessaryAssign" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html#ReturnVisitor.__checkUnnecessaryAssign" /> + <keyword name="ReturnVisitor.__checkUnnecessaryReturnNone" id="ReturnVisitor.__checkUnnecessaryReturnNone" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html#ReturnVisitor.__checkUnnecessaryReturnNone" /> + <keyword name="ReturnVisitor.__hasRefsBeforeNextAssign" id="ReturnVisitor.__hasRefsBeforeNextAssign" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html#ReturnVisitor.__hasRefsBeforeNextAssign" /> + <keyword name="ReturnVisitor.__hasRefsOrAssignsWithinTryOrLoop" id="ReturnVisitor.__hasRefsOrAssignsWithinTryOrLoop" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html#ReturnVisitor.__hasRefsOrAssignsWithinTryOrLoop" /> + <keyword name="ReturnVisitor.__isFalse" id="ReturnVisitor.__isFalse" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html#ReturnVisitor.__isFalse" /> + <keyword name="ReturnVisitor.__isNone" id="ReturnVisitor.__isNone" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html#ReturnVisitor.__isNone" /> + <keyword name="ReturnVisitor.__resultExists" id="ReturnVisitor.__resultExists" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html#ReturnVisitor.__resultExists" /> + <keyword name="ReturnVisitor.__visitAssignTarget" id="ReturnVisitor.__visitAssignTarget" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html#ReturnVisitor.__visitAssignTarget" /> + <keyword name="ReturnVisitor.__visitLoop" id="ReturnVisitor.__visitLoop" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html#ReturnVisitor.__visitLoop" /> + <keyword name="ReturnVisitor.__visitWithStack" id="ReturnVisitor.__visitWithStack" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html#ReturnVisitor.__visitWithStack" /> + <keyword name="ReturnVisitor.assigns" id="ReturnVisitor.assigns" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html#ReturnVisitor.assigns" /> <keyword name="ReturnVisitor.hasOnlyNoneReturns" id="ReturnVisitor.hasOnlyNoneReturns" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsFunctionVisitor.html#ReturnVisitor.hasOnlyNoneReturns" /> - <keyword name="ReturnVisitor.refs" id="ReturnVisitor.refs" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ReturnVisitor.refs" /> - <keyword name="ReturnVisitor.returns" id="ReturnVisitor.returns" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ReturnVisitor.returns" /> + <keyword name="ReturnVisitor.loops" id="ReturnVisitor.loops" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html#ReturnVisitor.loops" /> + <keyword name="ReturnVisitor.refs" id="ReturnVisitor.refs" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html#ReturnVisitor.refs" /> + <keyword name="ReturnVisitor.returns" id="ReturnVisitor.returns" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html#ReturnVisitor.returns" /> <keyword name="ReturnVisitor.switchContext" id="ReturnVisitor.switchContext" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsFunctionVisitor.html#ReturnVisitor.switchContext" /> - <keyword name="ReturnVisitor.visit_Assign" id="ReturnVisitor.visit_Assign" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ReturnVisitor.visit_Assign" /> - <keyword name="ReturnVisitor.visit_AsyncFor" id="ReturnVisitor.visit_AsyncFor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ReturnVisitor.visit_AsyncFor" /> - <keyword name="ReturnVisitor.visit_AsyncFunctionDef" id="ReturnVisitor.visit_AsyncFunctionDef" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ReturnVisitor.visit_AsyncFunctionDef" /> - <keyword name="ReturnVisitor.visit_For" id="ReturnVisitor.visit_For" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ReturnVisitor.visit_For" /> - <keyword name="ReturnVisitor.visit_FunctionDef" id="ReturnVisitor.visit_FunctionDef" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ReturnVisitor.visit_FunctionDef" /> - <keyword name="ReturnVisitor.visit_Name" id="ReturnVisitor.visit_Name" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ReturnVisitor.visit_Name" /> + <keyword name="ReturnVisitor.tries" id="ReturnVisitor.tries" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html#ReturnVisitor.tries" /> + <keyword name="ReturnVisitor.visit_Assign" id="ReturnVisitor.visit_Assign" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html#ReturnVisitor.visit_Assign" /> + <keyword name="ReturnVisitor.visit_AsyncFor" id="ReturnVisitor.visit_AsyncFor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html#ReturnVisitor.visit_AsyncFor" /> + <keyword name="ReturnVisitor.visit_AsyncFunctionDef" id="ReturnVisitor.visit_AsyncFunctionDef" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html#ReturnVisitor.visit_AsyncFunctionDef" /> + <keyword name="ReturnVisitor.visit_For" id="ReturnVisitor.visit_For" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html#ReturnVisitor.visit_For" /> + <keyword name="ReturnVisitor.visit_FunctionDef" id="ReturnVisitor.visit_FunctionDef" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html#ReturnVisitor.visit_FunctionDef" /> + <keyword name="ReturnVisitor.visit_Name" id="ReturnVisitor.visit_Name" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html#ReturnVisitor.visit_Name" /> <keyword name="ReturnVisitor.visit_Return" id="ReturnVisitor.visit_Return" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsFunctionVisitor.html#ReturnVisitor.visit_Return" /> - <keyword name="ReturnVisitor.visit_Return" id="ReturnVisitor.visit_Return" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ReturnVisitor.visit_Return" /> - <keyword name="ReturnVisitor.visit_While" id="ReturnVisitor.visit_While" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#ReturnVisitor.visit_While" /> + <keyword name="ReturnVisitor.visit_Return" id="ReturnVisitor.visit_Return" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html#ReturnVisitor.visit_Return" /> + <keyword name="ReturnVisitor.visit_Try" id="ReturnVisitor.visit_Try" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html#ReturnVisitor.visit_Try" /> + <keyword name="ReturnVisitor.visit_While" id="ReturnVisitor.visit_While" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html#ReturnVisitor.visit_While" /> <keyword name="STLinkDevice" id="STLinkDevice" ref="eric7.MicroPython.Devices.STLinkDevices.html#STLinkDevice" /> <keyword name="STLinkDevice (Constructor)" id="STLinkDevice (Constructor)" ref="eric7.MicroPython.Devices.STLinkDevices.html#STLinkDevice.__init__" /> <keyword name="STLinkDevice.__createSTLinkMenu" id="STLinkDevice.__createSTLinkMenu" ref="eric7.MicroPython.Devices.STLinkDevices.html#STLinkDevice.__createSTLinkMenu" /> @@ -15281,9 +15277,8 @@ <keyword name="SecurityChecker" id="SecurityChecker" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityChecker.html#SecurityChecker" /> <keyword name="SecurityChecker (Constructor)" id="SecurityChecker (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityChecker.html#SecurityChecker.__init__" /> <keyword name="SecurityChecker (Module)" id="SecurityChecker (Module)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityChecker.html" /> - <keyword name="SecurityChecker.__ignoreCode" id="SecurityChecker.__ignoreCode" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityChecker.html#SecurityChecker.__ignoreCode" /> + <keyword name="SecurityChecker.addError" id="SecurityChecker.addError" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityChecker.html#SecurityChecker.addError" /> <keyword name="SecurityChecker.getConfig" id="SecurityChecker.getConfig" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityChecker.html#SecurityChecker.getConfig" /> - <keyword name="SecurityChecker.reportError" id="SecurityChecker.reportError" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityChecker.html#SecurityChecker.reportError" /> <keyword name="SecurityChecker.run" id="SecurityChecker.run" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityChecker.html#SecurityChecker.run" /> <keyword name="SecurityContext" id="SecurityContext" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityContext.html#SecurityContext" /> <keyword name="SecurityContext (Constructor)" id="SecurityContext (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityContext.html#SecurityContext.__init__" /> @@ -15719,9 +15714,7 @@ <keyword name="SimplifyChecker (Constructor)" id="SimplifyChecker (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Simplify.SimplifyChecker.html#SimplifyChecker.__init__" /> <keyword name="SimplifyChecker (Module)" id="SimplifyChecker (Module)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Simplify.SimplifyChecker.html" /> <keyword name="SimplifyChecker.__addMeta" id="SimplifyChecker.__addMeta" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Simplify.SimplifyChecker.html#SimplifyChecker.__addMeta" /> - <keyword name="SimplifyChecker.__error" id="SimplifyChecker.__error" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Simplify.SimplifyChecker.html#SimplifyChecker.__error" /> - <keyword name="SimplifyChecker.__ignoreCode" id="SimplifyChecker.__ignoreCode" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Simplify.SimplifyChecker.html#SimplifyChecker.__ignoreCode" /> - <keyword name="SimplifyChecker.run" id="SimplifyChecker.run" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Simplify.SimplifyChecker.html#SimplifyChecker.run" /> + <keyword name="SimplifyChecker.__checkCodeSimplifications" id="SimplifyChecker.__checkCodeSimplifications" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Simplify.SimplifyChecker.html#SimplifyChecker.__checkCodeSimplifications" /> <keyword name="SimplifyNodeVisitor" id="SimplifyNodeVisitor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Simplify.SimplifyNodeVisitor.html#SimplifyNodeVisitor" /> <keyword name="SimplifyNodeVisitor (Constructor)" id="SimplifyNodeVisitor (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Simplify.SimplifyNodeVisitor.html#SimplifyNodeVisitor.__init__" /> <keyword name="SimplifyNodeVisitor (Module)" id="SimplifyNodeVisitor (Module)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Simplify.SimplifyNodeVisitor.html" /> @@ -17280,15 +17273,16 @@ <keyword name="SyntaxCheckerPlugin.activate" id="SyntaxCheckerPlugin.activate" ref="eric7.Plugins.PluginSyntaxChecker.html#SyntaxCheckerPlugin.activate" /> <keyword name="SyntaxCheckerPlugin.deactivate" id="SyntaxCheckerPlugin.deactivate" ref="eric7.Plugins.PluginSyntaxChecker.html#SyntaxCheckerPlugin.deactivate" /> <keyword name="SysUtilities (Module)" id="SysUtilities (Module)" ref="eric7.SystemUtilities.SysUtilities.html" /> - <keyword name="SysVersionVisitor" id="SysVersionVisitor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#SysVersionVisitor" /> - <keyword name="SysVersionVisitor (Constructor)" id="SysVersionVisitor (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#SysVersionVisitor.__init__" /> - <keyword name="SysVersionVisitor.__isSys" id="SysVersionVisitor.__isSys" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#SysVersionVisitor.__isSys" /> - <keyword name="SysVersionVisitor.__isSysVersionUpperSlice" id="SysVersionVisitor.__isSysVersionUpperSlice" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#SysVersionVisitor.__isSysVersionUpperSlice" /> - <keyword name="SysVersionVisitor.visit_Attribute" id="SysVersionVisitor.visit_Attribute" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#SysVersionVisitor.visit_Attribute" /> - <keyword name="SysVersionVisitor.visit_Compare" id="SysVersionVisitor.visit_Compare" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#SysVersionVisitor.visit_Compare" /> - <keyword name="SysVersionVisitor.visit_ImportFrom" id="SysVersionVisitor.visit_ImportFrom" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#SysVersionVisitor.visit_ImportFrom" /> - <keyword name="SysVersionVisitor.visit_Name" id="SysVersionVisitor.visit_Name" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#SysVersionVisitor.visit_Name" /> - <keyword name="SysVersionVisitor.visit_Subscript" id="SysVersionVisitor.visit_Subscript" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#SysVersionVisitor.visit_Subscript" /> + <keyword name="SysVersionVisitor" id="SysVersionVisitor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.SysVersionVisitor.html#SysVersionVisitor" /> + <keyword name="SysVersionVisitor (Constructor)" id="SysVersionVisitor (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.SysVersionVisitor.html#SysVersionVisitor.__init__" /> + <keyword name="SysVersionVisitor (Module)" id="SysVersionVisitor (Module)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.SysVersionVisitor.html" /> + <keyword name="SysVersionVisitor.__isSys" id="SysVersionVisitor.__isSys" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.SysVersionVisitor.html#SysVersionVisitor.__isSys" /> + <keyword name="SysVersionVisitor.__isSysVersionUpperSlice" id="SysVersionVisitor.__isSysVersionUpperSlice" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.SysVersionVisitor.html#SysVersionVisitor.__isSysVersionUpperSlice" /> + <keyword name="SysVersionVisitor.visit_Attribute" id="SysVersionVisitor.visit_Attribute" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.SysVersionVisitor.html#SysVersionVisitor.visit_Attribute" /> + <keyword name="SysVersionVisitor.visit_Compare" id="SysVersionVisitor.visit_Compare" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.SysVersionVisitor.html#SysVersionVisitor.visit_Compare" /> + <keyword name="SysVersionVisitor.visit_ImportFrom" id="SysVersionVisitor.visit_ImportFrom" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.SysVersionVisitor.html#SysVersionVisitor.visit_ImportFrom" /> + <keyword name="SysVersionVisitor.visit_Name" id="SysVersionVisitor.visit_Name" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.SysVersionVisitor.html#SysVersionVisitor.visit_Name" /> + <keyword name="SysVersionVisitor.visit_Subscript" id="SysVersionVisitor.visit_Subscript" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.SysVersionVisitor.html#SysVersionVisitor.visit_Subscript" /> <keyword name="SystemUtilities (Package)" id="SystemUtilities (Package)" ref="index-eric7.SystemUtilities.html" /> <keyword name="TERMINAL" id="TERMINAL" ref="eric7.EricGui.EricGenericDiffHighlighter.html#TERMINAL" /> <keyword name="TRPreviewer" id="TRPreviewer" ref="eric7.Tools.TRPreviewer.html#TRPreviewer" /> @@ -17760,17 +17754,18 @@ <keyword name="TestingWindow" id="TestingWindow" ref="eric7.Testing.TestingWidget.html#TestingWindow" /> <keyword name="TestingWindow (Constructor)" id="TestingWindow (Constructor)" ref="eric7.Testing.TestingWidget.html#TestingWindow.__init__" /> <keyword name="TestingWindow.eventFilter" id="TestingWindow.eventFilter" ref="eric7.Testing.TestingWidget.html#TestingWindow.eventFilter" /> - <keyword name="TextVisitor" id="TextVisitor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#TextVisitor" /> - <keyword name="TextVisitor (Constructor)" id="TextVisitor (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#TextVisitor.__init__" /> - <keyword name="TextVisitor.__addNode" id="TextVisitor.__addNode" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#TextVisitor.__addNode" /> - <keyword name="TextVisitor.__visitBody" id="TextVisitor.__visitBody" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#TextVisitor.__visitBody" /> - <keyword name="TextVisitor.__visitDefinition" id="TextVisitor.__visitDefinition" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#TextVisitor.__visitDefinition" /> - <keyword name="TextVisitor.visit_AsyncFunctionDef" id="TextVisitor.visit_AsyncFunctionDef" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#TextVisitor.visit_AsyncFunctionDef" /> - <keyword name="TextVisitor.visit_Call" id="TextVisitor.visit_Call" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#TextVisitor.visit_Call" /> - <keyword name="TextVisitor.visit_ClassDef" id="TextVisitor.visit_ClassDef" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#TextVisitor.visit_ClassDef" /> - <keyword name="TextVisitor.visit_Constant" id="TextVisitor.visit_Constant" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#TextVisitor.visit_Constant" /> - <keyword name="TextVisitor.visit_FunctionDef" id="TextVisitor.visit_FunctionDef" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#TextVisitor.visit_FunctionDef" /> - <keyword name="TextVisitor.visit_Module" id="TextVisitor.visit_Module" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#TextVisitor.visit_Module" /> + <keyword name="TextVisitor" id="TextVisitor" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor.html#TextVisitor" /> + <keyword name="TextVisitor (Constructor)" id="TextVisitor (Constructor)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor.html#TextVisitor.__init__" /> + <keyword name="TextVisitor (Module)" id="TextVisitor (Module)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor.html" /> + <keyword name="TextVisitor.__addNode" id="TextVisitor.__addNode" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor.html#TextVisitor.__addNode" /> + <keyword name="TextVisitor.__visitBody" id="TextVisitor.__visitBody" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor.html#TextVisitor.__visitBody" /> + <keyword name="TextVisitor.__visitDefinition" id="TextVisitor.__visitDefinition" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor.html#TextVisitor.__visitDefinition" /> + <keyword name="TextVisitor.visit_AsyncFunctionDef" id="TextVisitor.visit_AsyncFunctionDef" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor.html#TextVisitor.visit_AsyncFunctionDef" /> + <keyword name="TextVisitor.visit_Call" id="TextVisitor.visit_Call" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor.html#TextVisitor.visit_Call" /> + <keyword name="TextVisitor.visit_ClassDef" id="TextVisitor.visit_ClassDef" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor.html#TextVisitor.visit_ClassDef" /> + <keyword name="TextVisitor.visit_Constant" id="TextVisitor.visit_Constant" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor.html#TextVisitor.visit_Constant" /> + <keyword name="TextVisitor.visit_FunctionDef" id="TextVisitor.visit_FunctionDef" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor.html#TextVisitor.visit_FunctionDef" /> + <keyword name="TextVisitor.visit_Module" id="TextVisitor.visit_Module" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor.html#TextVisitor.visit_Module" /> <keyword name="ThemeManager" id="ThemeManager" ref="eric7.Preferences.ThemeManager.html#ThemeManager" /> <keyword name="ThemeManager (Constructor)" id="ThemeManager (Constructor)" ref="eric7.Preferences.ThemeManager.html#ThemeManager.__init__" /> <keyword name="ThemeManager (Module)" id="ThemeManager (Module)" ref="eric7.Preferences.ThemeManager.html" /> @@ -18190,16 +18185,13 @@ <keyword name="UnusedChecker (Module)" id="UnusedChecker (Module)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Unused.UnusedChecker.html" /> <keyword name="UnusedChecker.__checkUnusedArguments" id="UnusedChecker.__checkUnusedArguments" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Unused.UnusedChecker.html#UnusedChecker.__checkUnusedArguments" /> <keyword name="UnusedChecker.__checkUnusedGlobals" id="UnusedChecker.__checkUnusedGlobals" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Unused.UnusedChecker.html#UnusedChecker.__checkUnusedGlobals" /> - <keyword name="UnusedChecker.__error" id="UnusedChecker.__error" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Unused.UnusedChecker.html#UnusedChecker.__error" /> <keyword name="UnusedChecker.__extractGlobalVariables" id="UnusedChecker.__extractGlobalVariables" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Unused.UnusedChecker.html#UnusedChecker.__extractGlobalVariables" /> <keyword name="UnusedChecker.__getArguments" id="UnusedChecker.__getArguments" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Unused.UnusedChecker.html#UnusedChecker.__getArguments" /> <keyword name="UnusedChecker.__getDecoratorNames" id="UnusedChecker.__getDecoratorNames" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Unused.UnusedChecker.html#UnusedChecker.__getDecoratorNames" /> <keyword name="UnusedChecker.__getUnusedArguments" id="UnusedChecker.__getUnusedArguments" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Unused.UnusedChecker.html#UnusedChecker.__getUnusedArguments" /> - <keyword name="UnusedChecker.__ignoreCode" id="UnusedChecker.__ignoreCode" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Unused.UnusedChecker.html#UnusedChecker.__ignoreCode" /> <keyword name="UnusedChecker.__isDunderMethod" id="UnusedChecker.__isDunderMethod" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Unused.UnusedChecker.html#UnusedChecker.__isDunderMethod" /> <keyword name="UnusedChecker.__isEventHandlerMethod" id="UnusedChecker.__isEventHandlerMethod" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Unused.UnusedChecker.html#UnusedChecker.__isEventHandlerMethod" /> <keyword name="UnusedChecker.__isStubFunction" id="UnusedChecker.__isStubFunction" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Unused.UnusedChecker.html#UnusedChecker.__isStubFunction" /> - <keyword name="UnusedChecker.run" id="UnusedChecker.run" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Unused.UnusedChecker.html#UnusedChecker.run" /> <keyword name="UrlBar" id="UrlBar" ref="eric7.WebBrowser.UrlBar.UrlBar.html#UrlBar" /> <keyword name="UrlBar (Constructor)" id="UrlBar (Constructor)" ref="eric7.WebBrowser.UrlBar.UrlBar.html#UrlBar.__init__" /> <keyword name="UrlBar (Module)" id="UrlBar (Module)" ref="eric7.WebBrowser.UrlBar.UrlBar.html" /> @@ -20357,7 +20349,7 @@ <keyword name="compileRegExp" id="compileRegExp" ref="eric7.CodeFormatting.BlackUtilities.html#compileRegExp" /> <keyword name="compileUiFiles" id="compileUiFiles" ref="eric7.Utilities.uic.html#compileUiFiles" /> <keyword name="completeFormData" id="completeFormData" ref="eric7.WebBrowser.Tools.Scripts.html#completeFormData" /> - <keyword name="composeCallPath" id="composeCallPath" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html#composeCallPath" /> + <keyword name="composeCallPath" id="composeCallPath" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html#composeCallPath" /> <keyword name="compound_statements" id="compound_statements" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.pycodestyle.html#compound_statements" /> <keyword name="concatString" id="concatString" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityUtils.html#concatString" /> <keyword name="condaVersion" id="condaVersion" ref="eric7.CondaInterface.__init__.html#condaVersion" /> @@ -21806,6 +21798,7 @@ <file>eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleCodeSelectionDialog.html</file> <file>eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleFixer.html</file> <file>eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleStatisticsDialog.html</file> + <file>eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleTopicChecker.html</file> <file>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Complexity.ComplexityChecker.html</file> <file>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Complexity.mccabe.html</file> <file>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Complexity.translations.html</file> @@ -21819,8 +21812,14 @@ <file>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Logging.LoggingChecker.html</file> <file>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Logging.LoggingVisitor.html</file> <file>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Logging.translations.html</file> + <file>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html</file> + <file>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DateTimeVisitor.html</file> + <file>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DefaultMatchCaseVisitor.html</file> <file>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html</file> <file>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousDefaults.html</file> + <file>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html</file> + <file>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.SysVersionVisitor.html</file> + <file>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor.html</file> <file>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.eradicate.html</file> <file>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.translations.html</file> <file>eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.ImportNode.html</file>
--- a/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsChecker.html Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsChecker.html Thu Feb 27 14:42:39 2025 +0100 @@ -38,9 +38,10 @@ </p> <h3>Derived from</h3> -None +CodeStyleTopicChecker <h3>Class Attributes</h3> <table> +<tr><td>Category</td></tr> <tr><td>Codes</td></tr> </table> @@ -88,10 +89,6 @@ <td>Private method to classify the missing type annotation based on the Function & Argument metadata.</td> </tr> <tr> -<td><a href="#AnnotationsChecker.__error">__error</a></td> -<td>Private method to record an issue.</td> -</tr> -<tr> <td><a href="#AnnotationsChecker.__getAnnotationComplexity">__getAnnotationComplexity</a></td> <td>Private method to determine the annotation complexity.</td> </tr> @@ -104,17 +101,9 @@ <td>Private method to check for type annotations.</td> </tr> <tr> -<td><a href="#AnnotationsChecker.__ignoreCode">__ignoreCode</a></td> -<td>Private method to check if the message code should be ignored.</td> -</tr> -<tr> <td><a href="#AnnotationsChecker.__returnErrorClassifier">__returnErrorClassifier</a></td> <td>Private method to classify a return type annotation issue.</td> </tr> -<tr> -<td><a href="#AnnotationsChecker.run">run</a></td> -<td>Public method to check the given source against annotation issues.</td> -</tr> </table> <h3>Static Methods</h3> @@ -273,32 +262,6 @@ reference to the Argument object </dd> </dl> -<a NAME="AnnotationsChecker.__error" ID="AnnotationsChecker.__error"></a> -<h4>AnnotationsChecker.__error</h4> -<b>__error</b>(<i>lineNumber, offset, code, *args</i>) -<p> - Private method to record an issue. -</p> - -<dl> - -<dt><i>lineNumber</i> (int)</dt> -<dd> -line number of the issue -</dd> -<dt><i>offset</i> (int)</dt> -<dd> -position within line of the issue -</dd> -<dt><i>code</i> (str)</dt> -<dd> -message code -</dd> -<dt><i>args</i> (list)</dt> -<dd> -arguments for the message -</dd> -</dl> <a NAME="AnnotationsChecker.__getAnnotationComplexity" ID="AnnotationsChecker.__getAnnotationComplexity"></a> <h4>AnnotationsChecker.__getAnnotationComplexity</h4> <b>__getAnnotationComplexity</b>(<i>annotationNode, defaultComplexity=1</i>) @@ -383,32 +346,6 @@ bool </dd> </dl> -<a NAME="AnnotationsChecker.__ignoreCode" ID="AnnotationsChecker.__ignoreCode"></a> -<h4>AnnotationsChecker.__ignoreCode</h4> -<b>__ignoreCode</b>(<i>code</i>) -<p> - Private method to check if the message code should be ignored. -</p> - -<dl> - -<dt><i>code</i> (str)</dt> -<dd> -message code to check for -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -flag indicating to ignore the given code -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> <a NAME="AnnotationsChecker.__returnErrorClassifier" ID="AnnotationsChecker.__returnErrorClassifier"></a> <h4>AnnotationsChecker.__returnErrorClassifier</h4> <b>__returnErrorClassifier</b>(<i>isClassMethod, classDecoratorType, functionType</i>) @@ -443,13 +380,6 @@ str </dd> </dl> -<a NAME="AnnotationsChecker.run" ID="AnnotationsChecker.run"></a> -<h4>AnnotationsChecker.run</h4> -<b>run</b>(<i></i>) -<p> - Public method to check the given source against annotation issues. -</p> - <div align="right"><a href="#top">Up</a></div> <hr /> </body></html>
--- a/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Async.AsyncChecker.html Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Async.AsyncChecker.html Thu Feb 27 14:42:39 2025 +0100 @@ -38,11 +38,11 @@ </p> <h3>Derived from</h3> -None +CodeStyleTopicChecker <h3>Class Attributes</h3> <table> +<tr><td>Category</td></tr> <tr><td>Codes</td></tr> -<tr><td>Prefix</td></tr> </table> <h3>Class Methods</h3> @@ -60,18 +60,6 @@ <td><a href="#AsyncChecker.__checkSyncUses">__checkSyncUses</a></td> <td>Private method to check for use of synchroneous functions in async methods.</td> </tr> -<tr> -<td><a href="#AsyncChecker.__error">__error</a></td> -<td>Private method to record an issue.</td> -</tr> -<tr> -<td><a href="#AsyncChecker.__ignoreCode">__ignoreCode</a></td> -<td>Private method to check if the message code should be ignored.</td> -</tr> -<tr> -<td><a href="#AsyncChecker.run">run</a></td> -<td>Public method to check the given source against miscellaneous conditions.</td> -</tr> </table> <h3>Static Methods</h3> @@ -129,66 +117,6 @@ Private method to check for use of synchroneous functions in async methods. </p> -<a NAME="AsyncChecker.__error" ID="AsyncChecker.__error"></a> -<h4>AsyncChecker.__error</h4> -<b>__error</b>(<i>lineNumber, offset, code, *args</i>) -<p> - Private method to record an issue. -</p> - -<dl> - -<dt><i>lineNumber</i> (int)</dt> -<dd> -line number of the issue -</dd> -<dt><i>offset</i> (int)</dt> -<dd> -position within line of the issue -</dd> -<dt><i>code</i> (str)</dt> -<dd> -message code -</dd> -<dt><i>args</i> (list)</dt> -<dd> -arguments for the message -</dd> -</dl> -<a NAME="AsyncChecker.__ignoreCode" ID="AsyncChecker.__ignoreCode"></a> -<h4>AsyncChecker.__ignoreCode</h4> -<b>__ignoreCode</b>(<i>code</i>) -<p> - Private method to check if the message code should be ignored. -</p> - -<dl> - -<dt><i>code</i> (str)</dt> -<dd> -message code to check for -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -flag indicating to ignore the given code -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<a NAME="AsyncChecker.run" ID="AsyncChecker.run"></a> -<h4>AsyncChecker.run</h4> -<b>run</b>(<i></i>) -<p> - Public method to check the given source against miscellaneous - conditions. -</p> - <div align="right"><a href="#top">Up</a></div> <hr /> </body></html>
--- a/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleChecker.html Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleChecker.html Thu Feb 27 14:42:39 2025 +0100 @@ -122,7 +122,7 @@ </dl> <a NAME="CodeStyleCheckerReport.error_args" ID="CodeStyleCheckerReport.error_args"></a> <h4>CodeStyleCheckerReport.error_args</h4> -<b>error_args</b>(<i>line_number, offset, errorCode, check, *args</i>) +<b>error_args</b>(<i>line_number, offset, text, _check, *args</i>) <p> Public method to collect the error messages. </p> @@ -137,11 +137,11 @@ <dd> position within line of the issue </dd> -<dt><i>errorCode</i> (str)</dt> +<dt><i>text</i> (str)</dt> <dd> -error message code +issue message code or issue text </dd> -<dt><i>check</i> (function)</dt> +<dt><i>_check</i> (function)</dt> <dd> reference to the checker function </dd>
--- a/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleCheckerDialog.html Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleCheckerDialog.html Thu Feb 27 14:42:39 2025 +0100 @@ -154,6 +154,10 @@ <td>Private method to check, if an item has a fixable issue.</td> </tr> <tr> +<td><a href="#CodeStyleCheckerDialog.__migrateIssueCodes">__migrateIssueCodes</a></td> +<td>Private method to migrate the issue codes to the form 'category'-'number'.</td> +</tr> +<tr> <td><a href="#CodeStyleCheckerDialog.__modifyFixedResultItem">__modifyFixedResultItem</a></td> <td>Private method to modify a result list entry to show its positive fixed state.</td> </tr> @@ -739,6 +743,13 @@ bool </dd> </dl> +<a NAME="CodeStyleCheckerDialog.__migrateIssueCodes" ID="CodeStyleCheckerDialog.__migrateIssueCodes"></a> +<h4>CodeStyleCheckerDialog.__migrateIssueCodes</h4> +<b>__migrateIssueCodes</b>(<i></i>) +<p> + Private method to migrate the issue codes to the form 'category'-'number'. +</p> + <a NAME="CodeStyleCheckerDialog.__modifyFixedResultItem" ID="CodeStyleCheckerDialog.__modifyFixedResultItem"></a> <h4>CodeStyleCheckerDialog.__modifyFixedResultItem</h4> <b>__modifyFixedResultItem</b>(<i>itm, result</i>) @@ -765,7 +776,7 @@ Private method to modify the options based on eflag: entries. </p> <p> - This method looks for comment lines like '# eflag: noqa = M601' + This method looks for comment lines like '# eflag: noqa = M-601' at the end of the source in order to extend the list of excluded messages for one file only. </p>
--- a/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleFixer.html Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleFixer.html Thu Feb 27 14:42:39 2025 +0100 @@ -1616,7 +1616,7 @@ Private method to fix the long lines by breaking them. </p> <p> - Codes: E501 + Codes: E-501 </p> <dl>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleTopicChecker.html Thu Feb 27 14:42:39 2025 +0100 @@ -0,0 +1,233 @@ +<!DOCTYPE html> +<html><head> +<title>eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleTopicChecker</title> +<meta charset="UTF-8"> +<link rel="stylesheet" href="styles.css"> +</head> +<body> +<a NAME="top" ID="top"></a> +<h1>eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleTopicChecker</h1> +<p> +Module implementing the topic checker base class containing common methods. +</p> + +<h3>Global Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Classes</h3> +<table> +<tr> +<td><a href="#CodeStyleTopicChecker">CodeStyleTopicChecker</a></td> +<td>Class implementing the topic checker base class.</td> +</tr> +</table> + +<h3>Functions</h3> +<table> +<tr><td>None</td></tr> +</table> + +<hr /> +<hr /> +<a NAME="CodeStyleTopicChecker" ID="CodeStyleTopicChecker"></a> +<h2>CodeStyleTopicChecker</h2> +<p> + Class implementing the topic checker base class. +</p> + +<h3>Derived from</h3> +None +<h3>Class Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Class Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Methods</h3> +<table> +<tr> +<td><a href="#CodeStyleTopicChecker.__init__">CodeStyleTopicChecker</a></td> +<td>Constructor</td> +</tr> +<tr> +<td><a href="#CodeStyleTopicChecker._ignoreCode">_ignoreCode</a></td> +<td>Protected method to check if the message code should be ignored.</td> +</tr> +<tr> +<td><a href="#CodeStyleTopicChecker._initializeCheckers">_initializeCheckers</a></td> +<td>Protected method to determine the list of check methods to be run.</td> +</tr> +<tr> +<td><a href="#CodeStyleTopicChecker.addError">addError</a></td> +<td>Public method to record an issue.</td> +</tr> +<tr> +<td><a href="#CodeStyleTopicChecker.addErrorFromNode">addErrorFromNode</a></td> +<td>Public method to record an issue given the faulty ast node.</td> +</tr> +<tr> +<td><a href="#CodeStyleTopicChecker.run">run</a></td> +<td>Public method to execute the relevant checks.</td> +</tr> +</table> + +<h3>Static Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + + +<a NAME="CodeStyleTopicChecker.__init__" ID="CodeStyleTopicChecker.__init__"></a> +<h4>CodeStyleTopicChecker (Constructor)</h4> +<b>CodeStyleTopicChecker</b>(<i>category, source, filename, tree, select, ignore, expected, repeat, args</i>) +<p> + Constructor +</p> + +<dl> + +<dt><i>category</i> (str)</dt> +<dd> +checker category code (one to three uppercase characters +</dd> +<dt><i>source</i> (list of str)</dt> +<dd> +source code to be checked +</dd> +<dt><i>filename</i> (str)</dt> +<dd> +name of the source file +</dd> +<dt><i>tree</i> (ast.Module)</dt> +<dd> +AST tree of the source code +</dd> +<dt><i>select</i> (list of str)</dt> +<dd> +list of selected codes +</dd> +<dt><i>ignore</i> (list of str)</dt> +<dd> +list of codes to be ignored +</dd> +<dt><i>expected</i> (list of str)</dt> +<dd> +list of expected codes +</dd> +<dt><i>repeat</i> (bool)</dt> +<dd> +flag indicating to report each occurrence of a code +</dd> +<dt><i>args</i> (dict)</dt> +<dd> +dictionary of arguments for the various checks +</dd> +</dl> +<a NAME="CodeStyleTopicChecker._ignoreCode" ID="CodeStyleTopicChecker._ignoreCode"></a> +<h4>CodeStyleTopicChecker._ignoreCode</h4> +<b>_ignoreCode</b>(<i>code</i>) +<p> + Protected method to check if the message code should be ignored. +</p> + +<dl> + +<dt><i>code</i> (str)</dt> +<dd> +message code to check for +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +flag indicating to ignore the given code +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<a NAME="CodeStyleTopicChecker._initializeCheckers" ID="CodeStyleTopicChecker._initializeCheckers"></a> +<h4>CodeStyleTopicChecker._initializeCheckers</h4> +<b>_initializeCheckers</b>(<i>checkersWithCodes</i>) +<p> + Protected method to determine the list of check methods to be run. +</p> +<p> + This list is determined considering the list if selected and ignored issue + codes. +</p> + +<dl> + +<dt><i>checkersWithCodes</i> (TYPE)</dt> +<dd> +DESCRIPTION +</dd> +</dl> +<a NAME="CodeStyleTopicChecker.addError" ID="CodeStyleTopicChecker.addError"></a> +<h4>CodeStyleTopicChecker.addError</h4> +<b>addError</b>(<i>lineNumber, offset, msgCode, *args</i>) +<p> + Public method to record an issue. +</p> + +<dl> + +<dt><i>lineNumber</i> (int)</dt> +<dd> +line number of the issue (one based) +</dd> +<dt><i>offset</i> (int)</dt> +<dd> +position within line of the issue +</dd> +<dt><i>msgCode</i> (str)</dt> +<dd> +message code +</dd> +<dt><i>args</i> (list)</dt> +<dd> +arguments for the message +</dd> +</dl> +<a NAME="CodeStyleTopicChecker.addErrorFromNode" ID="CodeStyleTopicChecker.addErrorFromNode"></a> +<h4>CodeStyleTopicChecker.addErrorFromNode</h4> +<b>addErrorFromNode</b>(<i>node, msgCode, *args</i>) +<p> + Public method to record an issue given the faulty ast node. +</p> + +<dl> + +<dt><i>node</i> (ast.AST)</dt> +<dd> +reference to the node containing the issue +</dd> +<dt><i>msgCode</i> (str)</dt> +<dd> +message code +</dd> +<dt><i>args</i> (list)</dt> +<dd> +arguments for the message +</dd> +</dl> +<a NAME="CodeStyleTopicChecker.run" ID="CodeStyleTopicChecker.run"></a> +<h4>CodeStyleTopicChecker.run</h4> +<b>run</b>(<i></i>) +<p> + Public method to execute the relevant checks. +</p> + +<div align="right"><a href="#top">Up</a></div> +<hr /> +</body></html>
--- a/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Complexity.ComplexityChecker.html Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Complexity.ComplexityChecker.html Thu Feb 27 14:42:39 2025 +0100 @@ -42,9 +42,10 @@ </p> <h3>Derived from</h3> -None +CodeStyleTopicChecker <h3>Class Attributes</h3> <table> +<tr><td>Category</td></tr> <tr><td>Codes</td></tr> </table> @@ -67,18 +68,6 @@ <td><a href="#ComplexityChecker.__checkMcCabeComplexity">__checkMcCabeComplexity</a></td> <td>Private method to check the McCabe code complexity.</td> </tr> -<tr> -<td><a href="#ComplexityChecker.__error">__error</a></td> -<td>Private method to record an issue.</td> -</tr> -<tr> -<td><a href="#ComplexityChecker.__ignoreCode">__ignoreCode</a></td> -<td>Private method to check if the message code should be ignored.</td> -</tr> -<tr> -<td><a href="#ComplexityChecker.run">run</a></td> -<td>Public method to check the given source for code complexity.</td> -</tr> </table> <h3>Static Methods</h3> @@ -140,65 +129,6 @@ Private method to check the McCabe code complexity. </p> -<a NAME="ComplexityChecker.__error" ID="ComplexityChecker.__error"></a> -<h4>ComplexityChecker.__error</h4> -<b>__error</b>(<i>lineNumber, offset, code, *args</i>) -<p> - Private method to record an issue. -</p> - -<dl> - -<dt><i>lineNumber</i> (int)</dt> -<dd> -line number of the issue -</dd> -<dt><i>offset</i> (int)</dt> -<dd> -position within line of the issue -</dd> -<dt><i>code</i> (str)</dt> -<dd> -message code -</dd> -<dt><i>args</i> (list)</dt> -<dd> -arguments for the message -</dd> -</dl> -<a NAME="ComplexityChecker.__ignoreCode" ID="ComplexityChecker.__ignoreCode"></a> -<h4>ComplexityChecker.__ignoreCode</h4> -<b>__ignoreCode</b>(<i>code</i>) -<p> - Private method to check if the message code should be ignored. -</p> - -<dl> - -<dt><i>code</i> (str)</dt> -<dd> -message code to check for -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -flag indicating to ignore the given code -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<a NAME="ComplexityChecker.run" ID="ComplexityChecker.run"></a> -<h4>ComplexityChecker.run</h4> -<b>run</b>(<i></i>) -<p> - Public method to check the given source for code complexity. -</p> - <div align="right"><a href="#top">Up</a></div> <hr /> <hr />
--- a/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.DocStyleChecker.html Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.DocStyleChecker.html Thu Feb 27 14:42:39 2025 +0100 @@ -42,9 +42,10 @@ </p> <h3>Derived from</h3> -None +CodeStyleTopicChecker <h3>Class Attributes</h3> <table> +<tr><td>Category</td></tr> <tr><td>Codes</td></tr> </table> @@ -180,10 +181,6 @@ <td>Private method to check, that all docstrings are surrounded by triple double quotes.</td> </tr> <tr> -<td><a href="#DocStyleChecker.__error">__error</a></td> -<td>Private method to record an issue.</td> -</tr> -<tr> <td><a href="#DocStyleChecker.__getArgNames">__getArgNames</a></td> <td>Private method to get the argument names of a function node.</td> </tr> @@ -196,10 +193,6 @@ <td>Private method to extract the summary lines.</td> </tr> <tr> -<td><a href="#DocStyleChecker.__ignoreCode">__ignoreCode</a></td> -<td>Private method to check if the error code should be ignored.</td> -</tr> -<tr> <td><a href="#DocStyleChecker.__parseClasses">__parseClasses</a></td> <td>Private method to extract top-level classes.</td> </tr> @@ -240,6 +233,10 @@ <td>Private method to skip over an indented block of source code.</td> </tr> <tr> +<td><a href="#DocStyleChecker.addError">addError</a></td> +<td>Public method to record an issue.</td> +</tr> +<tr> <td><a href="#DocStyleChecker.run">run</a></td> <td>Public method to check the given source for violations of doc string conventions.</td> </tr> @@ -865,32 +862,6 @@ context of the docstring (unused) </dd> </dl> -<a NAME="DocStyleChecker.__error" ID="DocStyleChecker.__error"></a> -<h4>DocStyleChecker.__error</h4> -<b>__error</b>(<i>lineNumber, offset, code, *args</i>) -<p> - Private method to record an issue. -</p> - -<dl> - -<dt><i>lineNumber</i> (int)</dt> -<dd> -line number of the issue -</dd> -<dt><i>offset</i> (int)</dt> -<dd> -position within line of the issue -</dd> -<dt><i>code</i> (str)</dt> -<dd> -message code -</dd> -<dt><i>args</i> (list)</dt> -<dd> -arguments for the message -</dd> -</dl> <a NAME="DocStyleChecker.__getArgNames" ID="DocStyleChecker.__getArgNames"></a> <h4>DocStyleChecker.__getArgNames</h4> <b>__getArgNames</b>(<i>node</i>) @@ -970,32 +941,6 @@ int </dd> </dl> -<a NAME="DocStyleChecker.__ignoreCode" ID="DocStyleChecker.__ignoreCode"></a> -<h4>DocStyleChecker.__ignoreCode</h4> -<b>__ignoreCode</b>(<i>code</i>) -<p> - Private method to check if the error code should be ignored. -</p> - -<dl> - -<dt><i>code</i> (str)</dt> -<dd> -message code to check for -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -flag indicating to ignore the given code -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> <a NAME="DocStyleChecker.__parseClasses" ID="DocStyleChecker.__parseClasses"></a> <h4>DocStyleChecker.__parseClasses</h4> <b>__parseClasses</b>(<i></i>) @@ -1213,6 +1158,32 @@ tuple </dd> </dl> +<a NAME="DocStyleChecker.addError" ID="DocStyleChecker.addError"></a> +<h4>DocStyleChecker.addError</h4> +<b>addError</b>(<i>lineNumber, offset, msgCode, *args</i>) +<p> + Public method to record an issue. +</p> + +<dl> + +<dt><i>lineNumber</i> (int)</dt> +<dd> +line number of the issue (zero based) +</dd> +<dt><i>offset</i> (int)</dt> +<dd> +position within line of the issue +</dd> +<dt><i>msgCode</i> (str)</dt> +<dd> +message code +</dd> +<dt><i>args</i> (list)</dt> +<dd> +arguments for the message +</dd> +</dl> <a NAME="DocStyleChecker.run" ID="DocStyleChecker.run"></a> <h4>DocStyleChecker.run</h4> <b>run</b>(<i></i>)
--- a/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Imports.ImportsChecker.html Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Imports.ImportsChecker.html Thu Feb 27 14:42:39 2025 +0100 @@ -38,9 +38,10 @@ </p> <h3>Derived from</h3> -None +CodeStyleTopicChecker <h3>Class Attributes</h3> <table> +<tr><td>Category</td></tr> <tr><td>Codes</td></tr> </table> @@ -76,14 +77,6 @@ <td>Private method to convert a pattern to a regex such that ".*" matches zero or more modules.</td> </tr> <tr> -<td><a href="#ImportsChecker.__error">__error</a></td> -<td>Private method to record an issue.</td> -</tr> -<tr> -<td><a href="#ImportsChecker.__ignoreCode">__ignoreCode</a></td> -<td>Private method to check if the message code should be ignored.</td> -</tr> -<tr> <td><a href="#ImportsChecker.__isModuleBanned">__isModuleBanned</a></td> <td>Private method to check, if the given module name banned.</td> </tr> @@ -91,10 +84,6 @@ <td><a href="#ImportsChecker.__tidyImports">__tidyImports</a></td> <td>Private method to check various other import related topics.</td> </tr> -<tr> -<td><a href="#ImportsChecker.run">run</a></td> -<td>Public method to check the given source against miscellaneous conditions.</td> -</tr> </table> <h3>Static Methods</h3> @@ -221,58 +210,6 @@ re.regex object </dd> </dl> -<a NAME="ImportsChecker.__error" ID="ImportsChecker.__error"></a> -<h4>ImportsChecker.__error</h4> -<b>__error</b>(<i>lineNumber, offset, code, *args</i>) -<p> - Private method to record an issue. -</p> - -<dl> - -<dt><i>lineNumber</i> (int)</dt> -<dd> -line number of the issue -</dd> -<dt><i>offset</i> (int)</dt> -<dd> -position within line of the issue -</dd> -<dt><i>code</i> (str)</dt> -<dd> -message code -</dd> -<dt><i>args</i> (list)</dt> -<dd> -arguments for the message -</dd> -</dl> -<a NAME="ImportsChecker.__ignoreCode" ID="ImportsChecker.__ignoreCode"></a> -<h4>ImportsChecker.__ignoreCode</h4> -<b>__ignoreCode</b>(<i>code</i>) -<p> - Private method to check if the message code should be ignored. -</p> - -<dl> - -<dt><i>code</i> (str)</dt> -<dd> -message code to check for -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -flag indicating to ignore the given code -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> <a NAME="ImportsChecker.__isModuleBanned" ID="ImportsChecker.__isModuleBanned"></a> <h4>ImportsChecker.__isModuleBanned</h4> <b>__isModuleBanned</b>(<i>moduleName</i>) @@ -306,14 +243,6 @@ Private method to check various other import related topics. </p> -<a NAME="ImportsChecker.run" ID="ImportsChecker.run"></a> -<h4>ImportsChecker.run</h4> -<b>run</b>(<i></i>) -<p> - Public method to check the given source against miscellaneous - conditions. -</p> - <div align="right"><a href="#top">Up</a></div> <hr /> </body></html>
--- a/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Logging.LoggingChecker.html Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Logging.LoggingChecker.html Thu Feb 27 14:42:39 2025 +0100 @@ -38,9 +38,10 @@ </p> <h3>Derived from</h3> -None +CodeStyleTopicChecker <h3>Class Attributes</h3> <table> +<tr><td>Category</td></tr> <tr><td>Codes</td></tr> </table> @@ -59,18 +60,6 @@ <td><a href="#LoggingChecker.__checkLogging">__checkLogging</a></td> <td>Private method to check logging statements.</td> </tr> -<tr> -<td><a href="#LoggingChecker.__error">__error</a></td> -<td>Private method to record an issue.</td> -</tr> -<tr> -<td><a href="#LoggingChecker.__ignoreCode">__ignoreCode</a></td> -<td>Private method to check if the message code should be ignored.</td> -</tr> -<tr> -<td><a href="#LoggingChecker.run">run</a></td> -<td>Public method to check the given source against miscellaneous conditions.</td> -</tr> </table> <h3>Static Methods</h3> @@ -128,66 +117,6 @@ Private method to check logging statements. </p> -<a NAME="LoggingChecker.__error" ID="LoggingChecker.__error"></a> -<h4>LoggingChecker.__error</h4> -<b>__error</b>(<i>lineNumber, offset, code, *args</i>) -<p> - Private method to record an issue. -</p> - -<dl> - -<dt><i>lineNumber</i> (int)</dt> -<dd> -line number of the issue -</dd> -<dt><i>offset</i> (int)</dt> -<dd> -position within line of the issue -</dd> -<dt><i>code</i> (str)</dt> -<dd> -message code -</dd> -<dt><i>args</i> (list)</dt> -<dd> -arguments for the message -</dd> -</dl> -<a NAME="LoggingChecker.__ignoreCode" ID="LoggingChecker.__ignoreCode"></a> -<h4>LoggingChecker.__ignoreCode</h4> -<b>__ignoreCode</b>(<i>code</i>) -<p> - Private method to check if the message code should be ignored. -</p> - -<dl> - -<dt><i>code</i> (str)</dt> -<dd> -message code to check for -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -flag indicating to ignore the given code -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<a NAME="LoggingChecker.run" ID="LoggingChecker.run"></a> -<h4>LoggingChecker.run</h4> -<b>run</b>(<i></i>) -<p> - Public method to check the given source against miscellaneous - conditions. -</p> - <div align="right"><a href="#top">Up</a></div> <hr /> </body></html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html Thu Feb 27 14:42:39 2025 +0100 @@ -0,0 +1,2589 @@ +<!DOCTYPE html> +<html><head> +<title>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor</title> +<meta charset="UTF-8"> +<link rel="stylesheet" href="styles.css"> +</head> +<body> +<a NAME="top" ID="top"></a> +<h1>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor</h1> +<p> +Module implementing a visitor to check for various potential issues. +</p> + +<h3>Global Attributes</h3> +<table> +<tr><td>BugBearContext</td></tr> +<tr><td>BugbearImmutableCalls</td></tr> +<tr><td>BugbearMutableCalls</td></tr> +<tr><td>BugbearMutableComprehensions</td></tr> +<tr><td>BugbearMutableLiterals</td></tr> +</table> + +<h3>Classes</h3> +<table> +<tr> +<td><a href="#BugBearVisitor">BugBearVisitor</a></td> +<td>Class implementing a node visitor to check for various topics.</td> +</tr> +<tr> +<td><a href="#ExceptBaseExceptionVisitor">ExceptBaseExceptionVisitor</a></td> +<td>Class to determine, if a 'BaseException' is re-raised.</td> +</tr> +<tr> +<td><a href="#FunctionDefDefaultsVisitor">FunctionDefDefaultsVisitor</a></td> +<td>Class used by M506, M508 and M539.</td> +</tr> +<tr> +<td><a href="#M520NameFinder">M520NameFinder</a></td> +<td>Class to extract a name out of a tree of nodes ignoring names defined within the local scope of a comprehension.</td> +</tr> +<tr> +<td><a href="#M540CaughtException">M540CaughtException</a></td> +<td>Class to hold the data for a caught exception.</td> +</tr> +<tr> +<td><a href="#M541UnhandledKeyType">M541UnhandledKeyType</a></td> +<td>Class to hold a dictionary key of a type that we do not check for duplicates.</td> +</tr> +<tr> +<td><a href="#M541VariableKeyType">M541VariableKeyType</a></td> +<td>Class to hold the name of a variable key type.</td> +</tr> +<tr> +<td><a href="#M569Checker">M569Checker</a></td> +<td>Class traversing a 'for' loop body to check for modifications to a loop's mutable iterable.</td> +</tr> +<tr> +<td><a href="#NameFinder">NameFinder</a></td> +<td>Class to extract a name out of a tree of nodes.</td> +</tr> +<tr> +<td><a href="#NamedExprFinder">NamedExprFinder</a></td> +<td>Class to extract names defined through an ast.NamedExpr.</td> +</tr> +</table> + +<h3>Functions</h3> +<table> +<tr> +<td><a href="#composeCallPath">composeCallPath</a></td> +<td>Generator function to assemble the call path of a given node.</td> +</tr> +</table> + +<hr /> +<hr /> +<a NAME="BugBearVisitor" ID="BugBearVisitor"></a> +<h2>BugBearVisitor</h2> +<p> + Class implementing a node visitor to check for various topics. +</p> + +<h3>Derived from</h3> +ast.NodeVisitor +<h3>Class Attributes</h3> +<table> +<tr><td>CONTEXTFUL_NODES</td></tr> +<tr><td>FUNCTION_NODES</td></tr> +<tr><td>NodeWindowSize</td></tr> +</table> + +<h3>Class Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Methods</h3> +<table> +<tr> +<td><a href="#BugBearVisitor.__init__">BugBearVisitor</a></td> +<td>Constructor</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__checkForM505">__checkForM505</a></td> +<td>Private method to check the use of *strip().</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__checkForM506_M508">__checkForM506_M508</a></td> +<td>Private method to check the use of mutable literals, comprehensions and calls.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__checkForM507">__checkForM507</a></td> +<td>Private method to check for unused loop variables.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__checkForM512">__checkForM512</a></td> +<td>Private method to check for return/continue/break inside finally blocks.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__checkForM513_M514_M529_M530">__checkForM513_M514_M529_M530</a></td> +<td>Private method to check various exception handler situations.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__checkForM515">__checkForM515</a></td> +<td>Private method to check for pointless comparisons.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__checkForM516">__checkForM516</a></td> +<td>Private method to check for raising a literal instead of an exception.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__checkForM517">__checkForM517</a></td> +<td>Private method to check for use of the evil syntax 'with assertRaises(Exception): or 'with pytest.raises(Exception):'.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__checkForM518">__checkForM518</a></td> +<td>Private method to check for useless expressions.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__checkForM519">__checkForM519</a></td> +<td>Private method to check for use of 'functools.lru_cache' or 'functools.cache'.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__checkForM520">__checkForM520</a></td> +<td>Private method to check for a loop that modifies its iterable.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__checkForM521">__checkForM521</a></td> +<td>Private method to check for use of an f-string as docstring.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__checkForM522">__checkForM522</a></td> +<td>Private method to check for use of an f-string as docstring.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__checkForM523">__checkForM523</a></td> +<td>Private method to check that functions (including lambdas) do not use loop variables.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__checkForM524_M527">__checkForM524_M527</a></td> +<td>Private method to check for inheritance from abstract classes in abc and lack of any methods decorated with abstract*.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__checkForM525">__checkForM525</a></td> +<td>Private method to check for exceptions being handled multiple times.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__checkForM526">__checkForM526</a></td> +<td>Private method to check for Star-arg unpacking after keyword argument.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__checkForM528">__checkForM528</a></td> +<td>Private method to check for warn without stacklevel.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__checkForM531">__checkForM531</a></td> +<td>Private method to check that 'itertools.groupby' isn't iterated over more than once.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__checkForM532">__checkForM532</a></td> +<td>Private method to check for possible unintentional typing annotation.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__checkForM533">__checkForM533</a></td> +<td>Private method to check a set for duplicate items.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__checkForM534">__checkForM534</a></td> +<td>Private method to check that re.sub/subn/split arguments flags/count/maxsplit are passed as keyword arguments.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__checkForM535">__checkForM535</a></td> +<td>Private method to check that a static key isn't used in a dict comprehension.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__checkForM539">__checkForM539</a></td> +<td>Private method to check for correct ContextVar usage.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__checkForM540AddNote">__checkForM540AddNote</a></td> +<td>Private method to check add_note usage.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__checkForM540Usage">__checkForM540Usage</a></td> +<td>Private method to check the usage of exceptions with added note.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__checkForM541">__checkForM541</a></td> +<td>Private method to check for duplicate key value pairs in a dictionary literal.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__checkForM569">__checkForM569</a></td> +<td>Private method to check for changes to a loop's mutable iterable.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__checkRedundantExcepthandlers">__checkRedundantExcepthandlers</a></td> +<td>Private method to check for redundant exception types in an exception handler.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__childrenInScope">__childrenInScope</a></td> +<td>Private method to get all child nodes in the given scope.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__flattenExcepthandler">__flattenExcepthandler</a></td> +<td>Private method to flatten the list of exceptions handled by an except handler.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__getAssignedNames">__getAssignedNames</a></td> +<td>Private method to get the names of a for loop.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__getDictCompLoopAndNamedExprVarNames">__getDictCompLoopAndNamedExprVarNames</a></td> +<td>Private method to get the names of comprehension loop variables.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__getNamesFromTuple">__getNamesFromTuple</a></td> +<td>Private method to get the names from an ast.Tuple node.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__inClassInit">__inClassInit</a></td> +<td>Private method to check, if we are inside an '__init__' method.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__isIdentifier">__isIdentifier</a></td> +<td>Private method to check if arg is a valid identifier.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__namesFromAssignments">__namesFromAssignments</a></td> +<td>Private method to get names of an assignment.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__typesafeIssubclass">__typesafeIssubclass</a></td> +<td>Private method implementing a type safe issubclass() function.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.__walkList">__walkList</a></td> +<td>Private method to walk a given list of nodes.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor._loop">_loop</a></td> +<td></td> +</tr> +<tr> +<td><a href="#BugBearVisitor.check">check</a></td> +<td></td> +</tr> +<tr> +<td><a href="#BugBearVisitor.convertToValue">convertToValue</a></td> +<td>Function to extract the value of a given item.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.emptyBody">emptyBody</a></td> +<td></td> +</tr> +<tr> +<td><a href="#BugBearVisitor.isAbcClass">isAbcClass</a></td> +<td></td> +</tr> +<tr> +<td><a href="#BugBearVisitor.isAbstractDecorator">isAbstractDecorator</a></td> +<td></td> +</tr> +<tr> +<td><a href="#BugBearVisitor.isOverload">isOverload</a></td> +<td></td> +</tr> +<tr> +<td><a href="#BugBearVisitor.isStrOrEllipsis">isStrOrEllipsis</a></td> +<td></td> +</tr> +<tr> +<td><a href="#BugBearVisitor.nodeStack">nodeStack</a></td> +<td>Public method to get a reference to the most recent node stack.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.superwalk">superwalk</a></td> +<td>Function to walk an AST node or a list of AST nodes.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.toNameStr">toNameStr</a></td> +<td>Public method to turn Name and Attribute nodes to strings, handling any depth of attribute accesses.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit">visit</a></td> +<td>Public method to traverse a given AST node.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_AnnAssign">visit_AnnAssign</a></td> +<td>Public method to check annotated assign statements.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_Assert">visit_Assert</a></td> +<td>Public method to handle 'assert' statements.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_Assign">visit_Assign</a></td> +<td>Public method to handle assignments.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_AsyncFor">visit_AsyncFor</a></td> +<td>Public method to handle 'for' statements.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_AsyncFunctionDef">visit_AsyncFunctionDef</a></td> +<td>Public method to handle async function definitions.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_Call">visit_Call</a></td> +<td>Public method to handle a function call.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_ClassDef">visit_ClassDef</a></td> +<td>Public method to handle class definitions.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_Compare">visit_Compare</a></td> +<td>Public method to handle comparison statements.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_Dict">visit_Dict</a></td> +<td>Public method to check a dictionary.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_DictComp">visit_DictComp</a></td> +<td>Public method to handle dictionary comprehensions.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_ExceptHandler">visit_ExceptHandler</a></td> +<td>Public method to handle exception handlers.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_For">visit_For</a></td> +<td>Public method to handle 'for' statements.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_FunctionDef">visit_FunctionDef</a></td> +<td>Public method to handle function definitions.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_GeneratorExp">visit_GeneratorExp</a></td> +<td>Public method to handle generator expressions.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_Import">visit_Import</a></td> +<td>Public method to check imports.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_ImportFrom">visit_ImportFrom</a></td> +<td>Public method to check from imports.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_JoinedStr">visit_JoinedStr</a></td> +<td>Public method to handle f-string arguments.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_ListComp">visit_ListComp</a></td> +<td>Public method to handle list comprehensions.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_Module">visit_Module</a></td> +<td>Public method to handle a module node.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_Raise">visit_Raise</a></td> +<td>Public method to handle 'raise' statements.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_Return">visit_Return</a></td> +<td>Public method to handle 'Return' nodes.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_Set">visit_Set</a></td> +<td>Public method to check a set.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_SetComp">visit_SetComp</a></td> +<td>Public method to handle set comprehensions.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_Try">visit_Try</a></td> +<td>Public method to handle 'try' statements.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_TryStar">visit_TryStar</a></td> +<td>Public method to handle 'except*' statements.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_UAdd">visit_UAdd</a></td> +<td>Public method to handle unary additions.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_While">visit_While</a></td> +<td>Public method to handle 'while' statements.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_With">visit_With</a></td> +<td>Public method to handle 'with' statements.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_Yield">visit_Yield</a></td> +<td>Public method to handle 'Yield' nodes.</td> +</tr> +<tr> +<td><a href="#BugBearVisitor.visit_YieldFrom">visit_YieldFrom</a></td> +<td>Public method to handle 'YieldFrom' nodes.</td> +</tr> +</table> + +<h3>Static Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + + +<a NAME="BugBearVisitor.__init__" ID="BugBearVisitor.__init__"></a> +<h4>BugBearVisitor (Constructor)</h4> +<b>BugBearVisitor</b>(<i></i>) +<p> + Constructor +</p> + +<a NAME="BugBearVisitor.__checkForM505" ID="BugBearVisitor.__checkForM505"></a> +<h4>BugBearVisitor.__checkForM505</h4> +<b>__checkForM505</b>(<i>node</i>) +<p> + Private method to check the use of *strip(). +</p> + +<dl> + +<dt><i>node</i> (ast.Call)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.__checkForM506_M508" ID="BugBearVisitor.__checkForM506_M508"></a> +<h4>BugBearVisitor.__checkForM506_M508</h4> +<b>__checkForM506_M508</b>(<i>node</i>) +<p> + Private method to check the use of mutable literals, comprehensions and calls. +</p> + +<dl> + +<dt><i>node</i> (ast.AsyncFunctionDef or ast.FunctionDef)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.__checkForM507" ID="BugBearVisitor.__checkForM507"></a> +<h4>BugBearVisitor.__checkForM507</h4> +<b>__checkForM507</b>(<i>node</i>) +<p> + Private method to check for unused loop variables. +</p> + +<dl> + +<dt><i>node</i> (ast.For or ast.AsyncFor)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.__checkForM512" ID="BugBearVisitor.__checkForM512"></a> +<h4>BugBearVisitor.__checkForM512</h4> +<b>__checkForM512</b>(<i>node</i>) +<p> + Private method to check for return/continue/break inside finally blocks. +</p> + +<dl> + +<dt><i>node</i> (ast.Try)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.__checkForM513_M514_M529_M530" ID="BugBearVisitor.__checkForM513_M514_M529_M530"></a> +<h4>BugBearVisitor.__checkForM513_M514_M529_M530</h4> +<b>__checkForM513_M514_M529_M530</b>(<i>node</i>) +<p> + Private method to check various exception handler situations. +</p> + +<dl> + +<dt><i>node</i> (ast.ExceptHandler)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +list of exception handler names +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +list of str +</dd> +</dl> +<a NAME="BugBearVisitor.__checkForM515" ID="BugBearVisitor.__checkForM515"></a> +<h4>BugBearVisitor.__checkForM515</h4> +<b>__checkForM515</b>(<i>node</i>) +<p> + Private method to check for pointless comparisons. +</p> + +<dl> + +<dt><i>node</i> (ast.Compare)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.__checkForM516" ID="BugBearVisitor.__checkForM516"></a> +<h4>BugBearVisitor.__checkForM516</h4> +<b>__checkForM516</b>(<i>node</i>) +<p> + Private method to check for raising a literal instead of an exception. +</p> + +<dl> + +<dt><i>node</i> (ast.Raise)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.__checkForM517" ID="BugBearVisitor.__checkForM517"></a> +<h4>BugBearVisitor.__checkForM517</h4> +<b>__checkForM517</b>(<i>node</i>) +<p> + Private method to check for use of the evil syntax + 'with assertRaises(Exception): or 'with pytest.raises(Exception):'. +</p> + +<dl> + +<dt><i>node</i> (ast.With)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.__checkForM518" ID="BugBearVisitor.__checkForM518"></a> +<h4>BugBearVisitor.__checkForM518</h4> +<b>__checkForM518</b>(<i>node</i>) +<p> + Private method to check for useless expressions. +</p> + +<dl> + +<dt><i>node</i> (ast.FunctionDef)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.__checkForM519" ID="BugBearVisitor.__checkForM519"></a> +<h4>BugBearVisitor.__checkForM519</h4> +<b>__checkForM519</b>(<i>node</i>) +<p> + Private method to check for use of 'functools.lru_cache' or 'functools.cache'. +</p> + +<dl> + +<dt><i>node</i> (ast.FunctionDef)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.__checkForM520" ID="BugBearVisitor.__checkForM520"></a> +<h4>BugBearVisitor.__checkForM520</h4> +<b>__checkForM520</b>(<i>node</i>) +<p> + Private method to check for a loop that modifies its iterable. +</p> + +<dl> + +<dt><i>node</i> (ast.For or ast.AsyncFor)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.__checkForM521" ID="BugBearVisitor.__checkForM521"></a> +<h4>BugBearVisitor.__checkForM521</h4> +<b>__checkForM521</b>(<i>node</i>) +<p> + Private method to check for use of an f-string as docstring. +</p> + +<dl> + +<dt><i>node</i> (ast.FunctionDef or ast.ClassDef)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.__checkForM522" ID="BugBearVisitor.__checkForM522"></a> +<h4>BugBearVisitor.__checkForM522</h4> +<b>__checkForM522</b>(<i>node</i>) +<p> + Private method to check for use of an f-string as docstring. +</p> + +<dl> + +<dt><i>node</i> (ast.With)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.__checkForM523" ID="BugBearVisitor.__checkForM523"></a> +<h4>BugBearVisitor.__checkForM523</h4> +<b>__checkForM523</b>(<i>loopNode</i>) +<p> + Private method to check that functions (including lambdas) do not use loop + variables. +</p> + +<dl> + +<dt><i>loopNode</i> (ast.For, ast.AsyncFor, ast.While, ast.ListComp, ast.SetComp,ast.DictComp,)</dt> +<dd> +reference to the node to be processed + or ast.GeneratorExp +</dd> +</dl> +<a NAME="BugBearVisitor.__checkForM524_M527" ID="BugBearVisitor.__checkForM524_M527"></a> +<h4>BugBearVisitor.__checkForM524_M527</h4> +<b>__checkForM524_M527</b>(<i>node</i>) +<p> + Private method to check for inheritance from abstract classes in abc and lack of + any methods decorated with abstract*. +</p> + +<dl> + +<dt><i>node</i> (ast.ClassDef)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.__checkForM525" ID="BugBearVisitor.__checkForM525"></a> +<h4>BugBearVisitor.__checkForM525</h4> +<b>__checkForM525</b>(<i>node</i>) +<p> + Private method to check for exceptions being handled multiple times. +</p> + +<dl> + +<dt><i>node</i> (ast.Try)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.__checkForM526" ID="BugBearVisitor.__checkForM526"></a> +<h4>BugBearVisitor.__checkForM526</h4> +<b>__checkForM526</b>(<i>node</i>) +<p> + Private method to check for Star-arg unpacking after keyword argument. +</p> + +<dl> + +<dt><i>node</i> (ast.Call)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.__checkForM528" ID="BugBearVisitor.__checkForM528"></a> +<h4>BugBearVisitor.__checkForM528</h4> +<b>__checkForM528</b>(<i>node</i>) +<p> + Private method to check for warn without stacklevel. +</p> + +<dl> + +<dt><i>node</i> (ast.Call)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.__checkForM531" ID="BugBearVisitor.__checkForM531"></a> +<h4>BugBearVisitor.__checkForM531</h4> +<b>__checkForM531</b>(<i>loopNode</i>) +<p> + Private method to check that 'itertools.groupby' isn't iterated over more than + once. +</p> +<p> + A warning is emitted when the generator returned by 'groupby()' is used + more than once inside a loop body or when it's used in a nested loop. +</p> + +<dl> + +<dt><i>loopNode</i> (ast.For or ast.AsyncFor)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.__checkForM532" ID="BugBearVisitor.__checkForM532"></a> +<h4>BugBearVisitor.__checkForM532</h4> +<b>__checkForM532</b>(<i>node</i>) +<p> + Private method to check for possible unintentional typing annotation. +</p> + +<dl> + +<dt><i>node</i> (ast.AnnAssign)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.__checkForM533" ID="BugBearVisitor.__checkForM533"></a> +<h4>BugBearVisitor.__checkForM533</h4> +<b>__checkForM533</b>(<i>node</i>) +<p> + Private method to check a set for duplicate items. +</p> + +<dl> + +<dt><i>node</i> (ast.Set)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.__checkForM534" ID="BugBearVisitor.__checkForM534"></a> +<h4>BugBearVisitor.__checkForM534</h4> +<b>__checkForM534</b>(<i>node</i>) +<p> + Private method to check that re.sub/subn/split arguments flags/count/maxsplit + are passed as keyword arguments. +</p> + +<dl> + +<dt><i>node</i> (ast.Call)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.__checkForM535" ID="BugBearVisitor.__checkForM535"></a> +<h4>BugBearVisitor.__checkForM535</h4> +<b>__checkForM535</b>(<i>node</i>) +<p> + Private method to check that a static key isn't used in a dict comprehension. +</p> +<p> + Record a warning if a likely unchanging key is used - either a constant, + or a variable that isn't coming from the generator expression. +</p> + +<dl> + +<dt><i>node</i> (ast.DictComp)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.__checkForM539" ID="BugBearVisitor.__checkForM539"></a> +<h4>BugBearVisitor.__checkForM539</h4> +<b>__checkForM539</b>(<i>node</i>) +<p> + Private method to check for correct ContextVar usage. +</p> + +<dl> + +<dt><i>node</i> (ast.Call)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.__checkForM540AddNote" ID="BugBearVisitor.__checkForM540AddNote"></a> +<h4>BugBearVisitor.__checkForM540AddNote</h4> +<b>__checkForM540AddNote</b>(<i>node</i>) +<p> + Private method to check add_note usage. +</p> + +<dl> + +<dt><i>node</i> (ast.Attribute)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +flag +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<a NAME="BugBearVisitor.__checkForM540Usage" ID="BugBearVisitor.__checkForM540Usage"></a> +<h4>BugBearVisitor.__checkForM540Usage</h4> +<b>__checkForM540Usage</b>(<i>node</i>) +<p> + Private method to check the usage of exceptions with added note. +</p> + +<dl> + +<dt><i>node</i> (ast.expr or None)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.__checkForM541" ID="BugBearVisitor.__checkForM541"></a> +<h4>BugBearVisitor.__checkForM541</h4> +<b>__checkForM541</b>(<i>node</i>) +<p> + Private method to check for duplicate key value pairs in a dictionary literal. +</p> + +<dl> + +<dt><i>node</i> (ast.Dict)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.__checkForM569" ID="BugBearVisitor.__checkForM569"></a> +<h4>BugBearVisitor.__checkForM569</h4> +<b>__checkForM569</b>(<i>node</i>) +<p> + Private method to check for changes to a loop's mutable iterable. +</p> + +<dl> + +<dt><i>node</i> (ast.For)</dt> +<dd> +loop node to be checked +</dd> +</dl> +<a NAME="BugBearVisitor.__checkRedundantExcepthandlers" ID="BugBearVisitor.__checkRedundantExcepthandlers"></a> +<h4>BugBearVisitor.__checkRedundantExcepthandlers</h4> +<b>__checkRedundantExcepthandlers</b>(<i>names, node, inTryStar</i>) +<p> + Private method to check for redundant exception types in an exception handler. +</p> + +<dl> + +<dt><i>names</i> (list of ast.Name)</dt> +<dd> +list of exception types to be checked +</dd> +<dt><i>node</i> (ast.ExceptionHandler)</dt> +<dd> +reference to the exception handler node +</dd> +<dt><i>inTryStar</i> (str)</dt> +<dd> +character indicating an 'except*' handler +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +tuple containing the error data +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (ast.Node, str, str, str, str) +</dd> +</dl> +<a NAME="BugBearVisitor.__childrenInScope" ID="BugBearVisitor.__childrenInScope"></a> +<h4>BugBearVisitor.__childrenInScope</h4> +<b>__childrenInScope</b>(<i>node</i>) +<p> + Private method to get all child nodes in the given scope. +</p> + +<dl> + +<dt><i>node</i> (ast.Node)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<dl> +<dt>Yield:</dt> +<dd> +reference to a child node +</dd> +</dl> +<dl> +<dt>Yield Type:</dt> +<dd> +ast.Node +</dd> +</dl> +<a NAME="BugBearVisitor.__flattenExcepthandler" ID="BugBearVisitor.__flattenExcepthandler"></a> +<h4>BugBearVisitor.__flattenExcepthandler</h4> +<b>__flattenExcepthandler</b>(<i>node</i>) +<p> + Private method to flatten the list of exceptions handled by an except handler. +</p> + +<dl> + +<dt><i>node</i> (ast.Node)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<dl> +<dt>Yield:</dt> +<dd> +reference to the exception type node +</dd> +</dl> +<dl> +<dt>Yield Type:</dt> +<dd> +ast.Node +</dd> +</dl> +<a NAME="BugBearVisitor.__getAssignedNames" ID="BugBearVisitor.__getAssignedNames"></a> +<h4>BugBearVisitor.__getAssignedNames</h4> +<b>__getAssignedNames</b>(<i>loopNode</i>) +<p> + Private method to get the names of a for loop. +</p> + +<dl> + +<dt><i>loopNode</i> (ast.For)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<dl> +<dt>Yield:</dt> +<dd> +DESCRIPTION +</dd> +</dl> +<dl> +<dt>Yield Type:</dt> +<dd> +TYPE +</dd> +</dl> +<a NAME="BugBearVisitor.__getDictCompLoopAndNamedExprVarNames" ID="BugBearVisitor.__getDictCompLoopAndNamedExprVarNames"></a> +<h4>BugBearVisitor.__getDictCompLoopAndNamedExprVarNames</h4> +<b>__getDictCompLoopAndNamedExprVarNames</b>(<i>node</i>) +<p> + Private method to get the names of comprehension loop variables. +</p> + +<dl> + +<dt><i>node</i> (ast.DictComp)</dt> +<dd> +ast node to be processed +</dd> +</dl> +<dl> +<dt>Yield:</dt> +<dd> +loop variable names +</dd> +</dl> +<dl> +<dt>Yield Type:</dt> +<dd> +str +</dd> +</dl> +<a NAME="BugBearVisitor.__getNamesFromTuple" ID="BugBearVisitor.__getNamesFromTuple"></a> +<h4>BugBearVisitor.__getNamesFromTuple</h4> +<b>__getNamesFromTuple</b>(<i>node</i>) +<p> + Private method to get the names from an ast.Tuple node. +</p> + +<dl> + +<dt><i>node</i> (ast.Tuple)</dt> +<dd> +ast node to be processed +</dd> +</dl> +<dl> +<dt>Yield:</dt> +<dd> +names +</dd> +</dl> +<dl> +<dt>Yield Type:</dt> +<dd> +str +</dd> +</dl> +<a NAME="BugBearVisitor.__inClassInit" ID="BugBearVisitor.__inClassInit"></a> +<h4>BugBearVisitor.__inClassInit</h4> +<b>__inClassInit</b>(<i></i>) +<p> + Private method to check, if we are inside an '__init__' method. +</p> + +<dl> +<dt>Return:</dt> +<dd> +flag indicating being within the '__init__' method +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<a NAME="BugBearVisitor.__isIdentifier" ID="BugBearVisitor.__isIdentifier"></a> +<h4>BugBearVisitor.__isIdentifier</h4> +<b>__isIdentifier</b>(<i>arg</i>) +<p> + Private method to check if arg is a valid identifier. +</p> +<p> + See https://docs.python.org/2/reference/lexical_analysis.html#identifiers +</p> + +<dl> + +<dt><i>arg</i> (ast.Node)</dt> +<dd> +reference to an argument node +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +flag indicating a valid identifier +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +TYPE +</dd> +</dl> +<a NAME="BugBearVisitor.__namesFromAssignments" ID="BugBearVisitor.__namesFromAssignments"></a> +<h4>BugBearVisitor.__namesFromAssignments</h4> +<b>__namesFromAssignments</b>(<i>assignTarget</i>) +<p> + Private method to get names of an assignment. +</p> + +<dl> + +<dt><i>assignTarget</i> (ast.Node)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<dl> +<dt>Yield:</dt> +<dd> +name of the assignment +</dd> +</dl> +<dl> +<dt>Yield Type:</dt> +<dd> +str +</dd> +</dl> +<a NAME="BugBearVisitor.__typesafeIssubclass" ID="BugBearVisitor.__typesafeIssubclass"></a> +<h4>BugBearVisitor.__typesafeIssubclass</h4> +<b>__typesafeIssubclass</b>(<i>obj, classOrTuple</i>) +<p> + Private method implementing a type safe issubclass() function. +</p> + +<dl> + +<dt><i>obj</i> (Any)</dt> +<dd> +reference to the object to be tested +</dd> +<dt><i>classOrTuple</i> (type)</dt> +<dd> +type to check against +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +flag indicating a subclass +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<a NAME="BugBearVisitor.__walkList" ID="BugBearVisitor.__walkList"></a> +<h4>BugBearVisitor.__walkList</h4> +<b>__walkList</b>(<i>nodes</i>) +<p> + Private method to walk a given list of nodes. +</p> + +<dl> + +<dt><i>nodes</i> (list of ast.Node)</dt> +<dd> +list of nodes to walk +</dd> +</dl> +<dl> +<dt>Yield:</dt> +<dd> +node references as determined by the ast.walk() function +</dd> +</dl> +<dl> +<dt>Yield Type:</dt> +<dd> +ast.Node +</dd> +</dl> +<a NAME="BugBearVisitor._loop" ID="BugBearVisitor._loop"></a> +<h4>BugBearVisitor._loop</h4> +<b>_loop</b>(<i>badNodeTypes</i>) + +<a NAME="BugBearVisitor.check" ID="BugBearVisitor.check"></a> +<h4>BugBearVisitor.check</h4> +<b>check</b>(<i>paramName</i>) + +<a NAME="BugBearVisitor.convertToValue" ID="BugBearVisitor.convertToValue"></a> +<h4>BugBearVisitor.convertToValue</h4> +<b>convertToValue</b>(<i></i>) +<p> + Function to extract the value of a given item. +</p> + +<dl> + +<dt><i>item</i> (ast.Ast)</dt> +<dd> +node to extract value from +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +value of the node +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +Any +</dd> +</dl> +<a NAME="BugBearVisitor.emptyBody" ID="BugBearVisitor.emptyBody"></a> +<h4>BugBearVisitor.emptyBody</h4> +<b>emptyBody</b>(<i></i>) + +<a NAME="BugBearVisitor.isAbcClass" ID="BugBearVisitor.isAbcClass"></a> +<h4>BugBearVisitor.isAbcClass</h4> +<b>isAbcClass</b>(<i>name="ABC"</i>) + +<a NAME="BugBearVisitor.isAbstractDecorator" ID="BugBearVisitor.isAbstractDecorator"></a> +<h4>BugBearVisitor.isAbstractDecorator</h4> +<b>isAbstractDecorator</b>(<i></i>) + +<a NAME="BugBearVisitor.isOverload" ID="BugBearVisitor.isOverload"></a> +<h4>BugBearVisitor.isOverload</h4> +<b>isOverload</b>(<i></i>) + +<a NAME="BugBearVisitor.isStrOrEllipsis" ID="BugBearVisitor.isStrOrEllipsis"></a> +<h4>BugBearVisitor.isStrOrEllipsis</h4> +<b>isStrOrEllipsis</b>(<i></i>) + +<a NAME="BugBearVisitor.nodeStack" ID="BugBearVisitor.nodeStack"></a> +<h4>BugBearVisitor.nodeStack</h4> +<b>nodeStack</b>(<i></i>) +<p> + Public method to get a reference to the most recent node stack. +</p> + +<dl> +<dt>Return:</dt> +<dd> +reference to the most recent node stack +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +list +</dd> +</dl> +<a NAME="BugBearVisitor.superwalk" ID="BugBearVisitor.superwalk"></a> +<h4>BugBearVisitor.superwalk</h4> +<b>superwalk</b>(<i></i>) +<p> + Function to walk an AST node or a list of AST nodes. +</p> + +<dl> + +<dt><i>node</i> (ast.AST or list[ast.AST])</dt> +<dd> +reference to the node or a list of nodes to be processed +</dd> +</dl> +<dl> +<dt>Yield:</dt> +<dd> +next node to be processed +</dd> +</dl> +<dl> +<dt>Yield Type:</dt> +<dd> +ast.AST +</dd> +</dl> +<a NAME="BugBearVisitor.toNameStr" ID="BugBearVisitor.toNameStr"></a> +<h4>BugBearVisitor.toNameStr</h4> +<b>toNameStr</b>(<i>node</i>) +<p> + Public method to turn Name and Attribute nodes to strings, handling any + depth of attribute accesses. +</p> +<p> + +</p> + +<dl> + +<dt><i>node</i> (ast.Name or ast.Attribute)</dt> +<dd> +reference to the node +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +string representation +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +str +</dd> +</dl> +<a NAME="BugBearVisitor.visit" ID="BugBearVisitor.visit"></a> +<h4>BugBearVisitor.visit</h4> +<b>visit</b>(<i>node</i>) +<p> + Public method to traverse a given AST node. +</p> + +<dl> + +<dt><i>node</i> (ast.Node)</dt> +<dd> +AST node to be traversed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_AnnAssign" ID="BugBearVisitor.visit_AnnAssign"></a> +<h4>BugBearVisitor.visit_AnnAssign</h4> +<b>visit_AnnAssign</b>(<i>node</i>) +<p> + Public method to check annotated assign statements. +</p> + +<dl> + +<dt><i>node</i> (ast.AnnAssign)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_Assert" ID="BugBearVisitor.visit_Assert"></a> +<h4>BugBearVisitor.visit_Assert</h4> +<b>visit_Assert</b>(<i>node</i>) +<p> + Public method to handle 'assert' statements. +</p> + +<dl> + +<dt><i>node</i> (ast.Assert)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_Assign" ID="BugBearVisitor.visit_Assign"></a> +<h4>BugBearVisitor.visit_Assign</h4> +<b>visit_Assign</b>(<i>node</i>) +<p> + Public method to handle assignments. +</p> + +<dl> + +<dt><i>node</i> (ast.Assign)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_AsyncFor" ID="BugBearVisitor.visit_AsyncFor"></a> +<h4>BugBearVisitor.visit_AsyncFor</h4> +<b>visit_AsyncFor</b>(<i>node</i>) +<p> + Public method to handle 'for' statements. +</p> + +<dl> + +<dt><i>node</i> (ast.AsyncFor)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_AsyncFunctionDef" ID="BugBearVisitor.visit_AsyncFunctionDef"></a> +<h4>BugBearVisitor.visit_AsyncFunctionDef</h4> +<b>visit_AsyncFunctionDef</b>(<i>node</i>) +<p> + Public method to handle async function definitions. +</p> + +<dl> + +<dt><i>node</i> (ast.AsyncFunctionDef)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_Call" ID="BugBearVisitor.visit_Call"></a> +<h4>BugBearVisitor.visit_Call</h4> +<b>visit_Call</b>(<i>node</i>) +<p> + Public method to handle a function call. +</p> + +<dl> + +<dt><i>node</i> (ast.Call)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_ClassDef" ID="BugBearVisitor.visit_ClassDef"></a> +<h4>BugBearVisitor.visit_ClassDef</h4> +<b>visit_ClassDef</b>(<i>node</i>) +<p> + Public method to handle class definitions. +</p> + +<dl> + +<dt><i>node</i> (ast.ClassDef)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_Compare" ID="BugBearVisitor.visit_Compare"></a> +<h4>BugBearVisitor.visit_Compare</h4> +<b>visit_Compare</b>(<i>node</i>) +<p> + Public method to handle comparison statements. +</p> + +<dl> + +<dt><i>node</i> (ast.Compare)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_Dict" ID="BugBearVisitor.visit_Dict"></a> +<h4>BugBearVisitor.visit_Dict</h4> +<b>visit_Dict</b>(<i>node</i>) +<p> + Public method to check a dictionary. +</p> + +<dl> + +<dt><i>node</i> (ast.Dict)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_DictComp" ID="BugBearVisitor.visit_DictComp"></a> +<h4>BugBearVisitor.visit_DictComp</h4> +<b>visit_DictComp</b>(<i>node</i>) +<p> + Public method to handle dictionary comprehensions. +</p> + +<dl> + +<dt><i>node</i> (ast.DictComp)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_ExceptHandler" ID="BugBearVisitor.visit_ExceptHandler"></a> +<h4>BugBearVisitor.visit_ExceptHandler</h4> +<b>visit_ExceptHandler</b>(<i>node</i>) +<p> + Public method to handle exception handlers. +</p> + +<dl> + +<dt><i>node</i> (ast.ExceptHandler)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_For" ID="BugBearVisitor.visit_For"></a> +<h4>BugBearVisitor.visit_For</h4> +<b>visit_For</b>(<i>node</i>) +<p> + Public method to handle 'for' statements. +</p> + +<dl> + +<dt><i>node</i> (ast.For)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_FunctionDef" ID="BugBearVisitor.visit_FunctionDef"></a> +<h4>BugBearVisitor.visit_FunctionDef</h4> +<b>visit_FunctionDef</b>(<i>node</i>) +<p> + Public method to handle function definitions. +</p> + +<dl> + +<dt><i>node</i> (ast.FunctionDef)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_GeneratorExp" ID="BugBearVisitor.visit_GeneratorExp"></a> +<h4>BugBearVisitor.visit_GeneratorExp</h4> +<b>visit_GeneratorExp</b>(<i>node</i>) +<p> + Public method to handle generator expressions. +</p> + +<dl> + +<dt><i>node</i> (ast.GeneratorExp)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_Import" ID="BugBearVisitor.visit_Import"></a> +<h4>BugBearVisitor.visit_Import</h4> +<b>visit_Import</b>(<i>node</i>) +<p> + Public method to check imports. +</p> + +<dl> + +<dt><i>node</i> (ast.Import)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_ImportFrom" ID="BugBearVisitor.visit_ImportFrom"></a> +<h4>BugBearVisitor.visit_ImportFrom</h4> +<b>visit_ImportFrom</b>(<i>node</i>) +<p> + Public method to check from imports. +</p> + +<dl> + +<dt><i>node</i> (ast.Import)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_JoinedStr" ID="BugBearVisitor.visit_JoinedStr"></a> +<h4>BugBearVisitor.visit_JoinedStr</h4> +<b>visit_JoinedStr</b>(<i>node</i>) +<p> + Public method to handle f-string arguments. +</p> + +<dl> + +<dt><i>node</i> (ast.JoinedStr)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_ListComp" ID="BugBearVisitor.visit_ListComp"></a> +<h4>BugBearVisitor.visit_ListComp</h4> +<b>visit_ListComp</b>(<i>node</i>) +<p> + Public method to handle list comprehensions. +</p> + +<dl> + +<dt><i>node</i> (ast.ListComp)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_Module" ID="BugBearVisitor.visit_Module"></a> +<h4>BugBearVisitor.visit_Module</h4> +<b>visit_Module</b>(<i>node</i>) +<p> + Public method to handle a module node. +</p> + +<dl> + +<dt><i>node</i> (ast.Module)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_Raise" ID="BugBearVisitor.visit_Raise"></a> +<h4>BugBearVisitor.visit_Raise</h4> +<b>visit_Raise</b>(<i>node</i>) +<p> + Public method to handle 'raise' statements. +</p> + +<dl> + +<dt><i>node</i> (ast.Raise)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_Return" ID="BugBearVisitor.visit_Return"></a> +<h4>BugBearVisitor.visit_Return</h4> +<b>visit_Return</b>(<i>node</i>) +<p> + Public method to handle 'Return' nodes. +</p> + +<dl> + +<dt><i>node</i> (ast.Return)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_Set" ID="BugBearVisitor.visit_Set"></a> +<h4>BugBearVisitor.visit_Set</h4> +<b>visit_Set</b>(<i>node</i>) +<p> + Public method to check a set. +</p> + +<dl> + +<dt><i>node</i> (ast.Set)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_SetComp" ID="BugBearVisitor.visit_SetComp"></a> +<h4>BugBearVisitor.visit_SetComp</h4> +<b>visit_SetComp</b>(<i>node</i>) +<p> + Public method to handle set comprehensions. +</p> + +<dl> + +<dt><i>node</i> (ast.SetComp)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_Try" ID="BugBearVisitor.visit_Try"></a> +<h4>BugBearVisitor.visit_Try</h4> +<b>visit_Try</b>(<i>node</i>) +<p> + Public method to handle 'try' statements. +</p> + +<dl> + +<dt><i>node</i> (ast.Try)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_TryStar" ID="BugBearVisitor.visit_TryStar"></a> +<h4>BugBearVisitor.visit_TryStar</h4> +<b>visit_TryStar</b>(<i>node</i>) +<p> + Public method to handle 'except*' statements. +</p> + +<dl> + +<dt><i>node</i> (ast.TryStar)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_UAdd" ID="BugBearVisitor.visit_UAdd"></a> +<h4>BugBearVisitor.visit_UAdd</h4> +<b>visit_UAdd</b>(<i>node</i>) +<p> + Public method to handle unary additions. +</p> + +<dl> + +<dt><i>node</i> (ast.UAdd)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_While" ID="BugBearVisitor.visit_While"></a> +<h4>BugBearVisitor.visit_While</h4> +<b>visit_While</b>(<i>node</i>) +<p> + Public method to handle 'while' statements. +</p> + +<dl> + +<dt><i>node</i> (ast.While)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_With" ID="BugBearVisitor.visit_With"></a> +<h4>BugBearVisitor.visit_With</h4> +<b>visit_With</b>(<i>node</i>) +<p> + Public method to handle 'with' statements. +</p> + +<dl> + +<dt><i>node</i> (ast.With)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_Yield" ID="BugBearVisitor.visit_Yield"></a> +<h4>BugBearVisitor.visit_Yield</h4> +<b>visit_Yield</b>(<i>node</i>) +<p> + Public method to handle 'Yield' nodes. +</p> + +<dl> + +<dt><i>node</i> (ast.Yield)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="BugBearVisitor.visit_YieldFrom" ID="BugBearVisitor.visit_YieldFrom"></a> +<h4>BugBearVisitor.visit_YieldFrom</h4> +<b>visit_YieldFrom</b>(<i>node</i>) +<p> + Public method to handle 'YieldFrom' nodes. +</p> + +<dl> + +<dt><i>node</i> (ast.YieldFrom)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="ExceptBaseExceptionVisitor" ID="ExceptBaseExceptionVisitor"></a> +<h2>ExceptBaseExceptionVisitor</h2> +<p> + Class to determine, if a 'BaseException' is re-raised. +</p> + +<h3>Derived from</h3> +ast.NodeVisitor +<h3>Class Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Class Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Methods</h3> +<table> +<tr> +<td><a href="#ExceptBaseExceptionVisitor.__init__">ExceptBaseExceptionVisitor</a></td> +<td>Constructor</td> +</tr> +<tr> +<td><a href="#ExceptBaseExceptionVisitor.reRaised">reRaised</a></td> +<td>Public method to check, if the exception is re-raised.</td> +</tr> +<tr> +<td><a href="#ExceptBaseExceptionVisitor.visit_ExceptHandler">visit_ExceptHandler</a></td> +<td>Public method to handle 'ExceptHandler' nodes.</td> +</tr> +<tr> +<td><a href="#ExceptBaseExceptionVisitor.visit_Raise">visit_Raise</a></td> +<td>Public method to handle 'Raise' nodes.</td> +</tr> +</table> + +<h3>Static Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + + +<a NAME="ExceptBaseExceptionVisitor.__init__" ID="ExceptBaseExceptionVisitor.__init__"></a> +<h4>ExceptBaseExceptionVisitor (Constructor)</h4> +<b>ExceptBaseExceptionVisitor</b>(<i>exceptNode</i>) +<p> + Constructor +</p> + +<dl> + +<dt><i>exceptNode</i> (ast.ExceptHandler)</dt> +<dd> +exception node to be inspected +</dd> +</dl> +<a NAME="ExceptBaseExceptionVisitor.reRaised" ID="ExceptBaseExceptionVisitor.reRaised"></a> +<h4>ExceptBaseExceptionVisitor.reRaised</h4> +<b>reRaised</b>(<i></i>) +<p> + Public method to check, if the exception is re-raised. +</p> + +<dl> +<dt>Return:</dt> +<dd> +flag indicating a re-raised exception +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<a NAME="ExceptBaseExceptionVisitor.visit_ExceptHandler" ID="ExceptBaseExceptionVisitor.visit_ExceptHandler"></a> +<h4>ExceptBaseExceptionVisitor.visit_ExceptHandler</h4> +<b>visit_ExceptHandler</b>(<i>node: ast.ExceptHandler</i>) +<p> + Public method to handle 'ExceptHandler' nodes. +</p> + +<dl> + +<dt><i>node</i> (ast.ExceptHandler)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="ExceptBaseExceptionVisitor.visit_Raise" ID="ExceptBaseExceptionVisitor.visit_Raise"></a> +<h4>ExceptBaseExceptionVisitor.visit_Raise</h4> +<b>visit_Raise</b>(<i>node</i>) +<p> + Public method to handle 'Raise' nodes. +</p> +<p> + If we find a corresponding `raise` or `raise e` where e was from + `except BaseException as e:` then we mark re_raised as True and can + stop scanning. +</p> + +<dl> + +<dt><i>node</i> (ast.Raise)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="FunctionDefDefaultsVisitor" ID="FunctionDefDefaultsVisitor"></a> +<h2>FunctionDefDefaultsVisitor</h2> +<p> + Class used by M506, M508 and M539. +</p> + +<h3>Derived from</h3> +ast.NodeVisitor +<h3>Class Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Class Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Methods</h3> +<table> +<tr> +<td><a href="#FunctionDefDefaultsVisitor.__init__">FunctionDefDefaultsVisitor</a></td> +<td>Constructor</td> +</tr> +<tr> +<td><a href="#FunctionDefDefaultsVisitor.__visitMutableLiteralOrComprehension">__visitMutableLiteralOrComprehension</a></td> +<td>Private method to flag mutable literals and comprehensions.</td> +</tr> +<tr> +<td><a href="#FunctionDefDefaultsVisitor.visit">visit</a></td> +<td>Public method to traverse an AST node or a list of AST nodes.</td> +</tr> +<tr> +<td><a href="#FunctionDefDefaultsVisitor.visit_Call">visit_Call</a></td> +<td>Public method to process Call nodes.</td> +</tr> +<tr> +<td><a href="#FunctionDefDefaultsVisitor.visit_Lambda">visit_Lambda</a></td> +<td>Public method to process Lambda nodes.</td> +</tr> +</table> + +<h3>Static Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + + +<a NAME="FunctionDefDefaultsVisitor.__init__" ID="FunctionDefDefaultsVisitor.__init__"></a> +<h4>FunctionDefDefaultsVisitor (Constructor)</h4> +<b>FunctionDefDefaultsVisitor</b>(<i>errorCodeCalls, errorCodeLiterals, </i>) +<p> + Constructor +</p> + +<dl> + +<dt><i>errorCodeCalls</i> (str)</dt> +<dd> +error code for ast.Call nodes +</dd> +<dt><i>errorCodeLiterals</i> (str)</dt> +<dd> +error code for literal nodes +</dd> +</dl> +<a NAME="FunctionDefDefaultsVisitor.__visitMutableLiteralOrComprehension" ID="FunctionDefDefaultsVisitor.__visitMutableLiteralOrComprehension"></a> +<h4>FunctionDefDefaultsVisitor.__visitMutableLiteralOrComprehension</h4> +<b>__visitMutableLiteralOrComprehension</b>(<i>node</i>) +<p> + Private method to flag mutable literals and comprehensions. +</p> + +<dl> + +<dt><i>node</i> (ast.Dict, ast.List, ast.Set, ast.ListComp, ast.DictComp or ast.SetComp)</dt> +<dd> +AST node to be processed +</dd> +</dl> +<a NAME="FunctionDefDefaultsVisitor.visit" ID="FunctionDefDefaultsVisitor.visit"></a> +<h4>FunctionDefDefaultsVisitor.visit</h4> +<b>visit</b>(<i>node</i>) +<p> + Public method to traverse an AST node or a list of AST nodes. +</p> +<p> + This is an extended method that can also handle a list of AST nodes. +</p> + +<dl> + +<dt><i>node</i> (ast.AST or list of ast.AST)</dt> +<dd> +AST node or list of AST nodes to be processed +</dd> +</dl> +<a NAME="FunctionDefDefaultsVisitor.visit_Call" ID="FunctionDefDefaultsVisitor.visit_Call"></a> +<h4>FunctionDefDefaultsVisitor.visit_Call</h4> +<b>visit_Call</b>(<i>node</i>) +<p> + Public method to process Call nodes. +</p> + +<dl> + +<dt><i>node</i> (ast.Call)</dt> +<dd> +AST node to be processed +</dd> +</dl> +<a NAME="FunctionDefDefaultsVisitor.visit_Lambda" ID="FunctionDefDefaultsVisitor.visit_Lambda"></a> +<h4>FunctionDefDefaultsVisitor.visit_Lambda</h4> +<b>visit_Lambda</b>(<i>node</i>) +<p> + Public method to process Lambda nodes. +</p> + +<dl> + +<dt><i>node</i> (ast.Lambda)</dt> +<dd> +AST node to be processed +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="M520NameFinder" ID="M520NameFinder"></a> +<h2>M520NameFinder</h2> +<p> + Class to extract a name out of a tree of nodes ignoring names defined within the + local scope of a comprehension. +</p> + +<h3>Derived from</h3> +NameFinder +<h3>Class Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Class Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Methods</h3> +<table> +<tr> +<td><a href="#M520NameFinder.visit_DictComp">visit_DictComp</a></td> +<td>Public method to handle a dictionary comprehension.</td> +</tr> +<tr> +<td><a href="#M520NameFinder.visit_GeneratorExp">visit_GeneratorExp</a></td> +<td>Public method to handle a generator expressions.</td> +</tr> +<tr> +<td><a href="#M520NameFinder.visit_Lambda">visit_Lambda</a></td> +<td>Public method to handle a Lambda function.</td> +</tr> +<tr> +<td><a href="#M520NameFinder.visit_ListComp">visit_ListComp</a></td> +<td>Public method to handle a list comprehension.</td> +</tr> +<tr> +<td><a href="#M520NameFinder.visit_comprehension">visit_comprehension</a></td> +<td>Public method to handle the 'for' of a comprehension.</td> +</tr> +</table> + +<h3>Static Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + + +<a NAME="M520NameFinder.visit_DictComp" ID="M520NameFinder.visit_DictComp"></a> +<h4>M520NameFinder.visit_DictComp</h4> +<b>visit_DictComp</b>(<i>node</i>) +<p> + Public method to handle a dictionary comprehension. +</p> + +<dl> + +<dt><i>node</i> (TYPE)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="M520NameFinder.visit_GeneratorExp" ID="M520NameFinder.visit_GeneratorExp"></a> +<h4>M520NameFinder.visit_GeneratorExp</h4> +<b>visit_GeneratorExp</b>(<i>node</i>) +<p> + Public method to handle a generator expressions. +</p> + +<dl> + +<dt><i>node</i> (ast.GeneratorExp)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="M520NameFinder.visit_Lambda" ID="M520NameFinder.visit_Lambda"></a> +<h4>M520NameFinder.visit_Lambda</h4> +<b>visit_Lambda</b>(<i>node</i>) +<p> + Public method to handle a Lambda function. +</p> + +<dl> + +<dt><i>node</i> (ast.Lambda)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="M520NameFinder.visit_ListComp" ID="M520NameFinder.visit_ListComp"></a> +<h4>M520NameFinder.visit_ListComp</h4> +<b>visit_ListComp</b>(<i>node</i>) +<p> + Public method to handle a list comprehension. +</p> + +<dl> + +<dt><i>node</i> (TYPE)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="M520NameFinder.visit_comprehension" ID="M520NameFinder.visit_comprehension"></a> +<h4>M520NameFinder.visit_comprehension</h4> +<b>visit_comprehension</b>(<i>node</i>) +<p> + Public method to handle the 'for' of a comprehension. +</p> + +<dl> + +<dt><i>node</i> (ast.comprehension)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="M540CaughtException" ID="M540CaughtException"></a> +<h2>M540CaughtException</h2> +<p> + Class to hold the data for a caught exception. +</p> + +<h3>Derived from</h3> +None +<h3>Class Attributes</h3> +<table> +<tr><td>hasNote</td></tr> +<tr><td>name</td></tr> +</table> + +<h3>Class Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Static Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + + +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="M541UnhandledKeyType" ID="M541UnhandledKeyType"></a> +<h2>M541UnhandledKeyType</h2> +<p> + Class to hold a dictionary key of a type that we do not check for duplicates. +</p> + +<h3>Derived from</h3> +None +<h3>Class Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Class Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Static Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + + +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="M541VariableKeyType" ID="M541VariableKeyType"></a> +<h2>M541VariableKeyType</h2> +<p> + Class to hold the name of a variable key type. +</p> + +<h3>Derived from</h3> +None +<h3>Class Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Class Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Methods</h3> +<table> +<tr> +<td><a href="#M541VariableKeyType.__init__">M541VariableKeyType</a></td> +<td>Constructor</td> +</tr> +</table> + +<h3>Static Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + + +<a NAME="M541VariableKeyType.__init__" ID="M541VariableKeyType.__init__"></a> +<h4>M541VariableKeyType (Constructor)</h4> +<b>M541VariableKeyType</b>(<i>name</i>) +<p> + Constructor +</p> + +<dl> + +<dt><i>name</i> (str)</dt> +<dd> +name of the variable key type +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="M569Checker" ID="M569Checker"></a> +<h2>M569Checker</h2> +<p> + Class traversing a 'for' loop body to check for modifications to a loop's + mutable iterable. +</p> + +<h3>Derived from</h3> +ast.NodeVisitor +<h3>Class Attributes</h3> +<table> +<tr><td>MUTATING_FUNCTIONS</td></tr> +</table> + +<h3>Class Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Methods</h3> +<table> +<tr> +<td><a href="#M569Checker.__init__">M569Checker</a></td> +<td>Constructor</td> +</tr> +<tr> +<td><a href="#M569Checker.visit">visit</a></td> +<td>Public method to inspect an ast node.</td> +</tr> +<tr> +<td><a href="#M569Checker.visit_Call">visit_Call</a></td> +<td>Public method handling 'Call' nodes.</td> +</tr> +<tr> +<td><a href="#M569Checker.visit_Delete">visit_Delete</a></td> +<td>Public method handling 'Delete' nodes.</td> +</tr> +</table> + +<h3>Static Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + + +<a NAME="M569Checker.__init__" ID="M569Checker.__init__"></a> +<h4>M569Checker (Constructor)</h4> +<b>M569Checker</b>(<i>name, bugbear</i>) +<p> + Constructor +</p> + +<dl> + +<dt><i>name</i> (str)</dt> +<dd> +name of the iterator +</dd> +<dt><i>bugbear</i> (BugBearVisitor)</dt> +<dd> +reference to the bugbear visitor +</dd> +</dl> +<a NAME="M569Checker.visit" ID="M569Checker.visit"></a> +<h4>M569Checker.visit</h4> +<b>visit</b>(<i>node</i>) +<p> + Public method to inspect an ast node. +</p> +<p> + Like super-visit but supports iteration over lists. +</p> + +<dl> + +<dt><i>node</i> (TYPE)</dt> +<dd> +AST node to be traversed +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +reference to the last processed node +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +ast.Node +</dd> +</dl> +<a NAME="M569Checker.visit_Call" ID="M569Checker.visit_Call"></a> +<h4>M569Checker.visit_Call</h4> +<b>visit_Call</b>(<i>node</i>) +<p> + Public method handling 'Call' nodes. +</p> + +<dl> + +<dt><i>node</i> (ast.Call)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="M569Checker.visit_Delete" ID="M569Checker.visit_Delete"></a> +<h4>M569Checker.visit_Delete</h4> +<b>visit_Delete</b>(<i>node</i>) +<p> + Public method handling 'Delete' nodes. +</p> + +<dl> + +<dt><i>node</i> (ast.Delete)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="NameFinder" ID="NameFinder"></a> +<h2>NameFinder</h2> +<p> + Class to extract a name out of a tree of nodes. +</p> + +<h3>Derived from</h3> +ast.NodeVisitor +<h3>Class Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Class Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Methods</h3> +<table> +<tr> +<td><a href="#NameFinder.__init__">NameFinder</a></td> +<td>Constructor</td> +</tr> +<tr> +<td><a href="#NameFinder.getNames">getNames</a></td> +<td>Public method to return the extracted names and Name nodes.</td> +</tr> +<tr> +<td><a href="#NameFinder.visit">visit</a></td> +<td>Public method to traverse a given AST node.</td> +</tr> +<tr> +<td><a href="#NameFinder.visit_Name">visit_Name</a></td> +<td>Public method to handle 'Name' nodes.</td> +</tr> +</table> + +<h3>Static Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + + +<a NAME="NameFinder.__init__" ID="NameFinder.__init__"></a> +<h4>NameFinder (Constructor)</h4> +<b>NameFinder</b>(<i></i>) +<p> + Constructor +</p> + +<a NAME="NameFinder.getNames" ID="NameFinder.getNames"></a> +<h4>NameFinder.getNames</h4> +<b>getNames</b>(<i></i>) +<p> + Public method to return the extracted names and Name nodes. +</p> + +<dl> +<dt>Return:</dt> +<dd> +dictionary containing the names as keys and the list of nodes +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +dict +</dd> +</dl> +<a NAME="NameFinder.visit" ID="NameFinder.visit"></a> +<h4>NameFinder.visit</h4> +<b>visit</b>(<i>node</i>) +<p> + Public method to traverse a given AST node. +</p> + +<dl> + +<dt><i>node</i> (ast.Node)</dt> +<dd> +AST node to be traversed +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +reference to the last processed node +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +ast.Node +</dd> +</dl> +<a NAME="NameFinder.visit_Name" ID="NameFinder.visit_Name"></a> +<h4>NameFinder.visit_Name</h4> +<b>visit_Name</b>(<i>node</i>) +<p> + Public method to handle 'Name' nodes. +</p> + +<dl> + +<dt><i>node</i> (ast.Name)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="NamedExprFinder" ID="NamedExprFinder"></a> +<h2>NamedExprFinder</h2> +<p> + Class to extract names defined through an ast.NamedExpr. +</p> + +<h3>Derived from</h3> +ast.NodeVisitor +<h3>Class Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Class Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Methods</h3> +<table> +<tr> +<td><a href="#NamedExprFinder.__init__">NamedExprFinder</a></td> +<td>Constructor</td> +</tr> +<tr> +<td><a href="#NamedExprFinder.getNames">getNames</a></td> +<td>Public method to return the extracted names and Name nodes.</td> +</tr> +<tr> +<td><a href="#NamedExprFinder.visit">visit</a></td> +<td>Public method to traverse a given AST node.</td> +</tr> +<tr> +<td><a href="#NamedExprFinder.visit_NamedExpr">visit_NamedExpr</a></td> +<td>Public method handling 'NamedExpr' nodes.</td> +</tr> +</table> + +<h3>Static Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + + +<a NAME="NamedExprFinder.__init__" ID="NamedExprFinder.__init__"></a> +<h4>NamedExprFinder (Constructor)</h4> +<b>NamedExprFinder</b>(<i></i>) +<p> + Constructor +</p> + +<a NAME="NamedExprFinder.getNames" ID="NamedExprFinder.getNames"></a> +<h4>NamedExprFinder.getNames</h4> +<b>getNames</b>(<i></i>) +<p> + Public method to return the extracted names and Name nodes. +</p> + +<dl> +<dt>Return:</dt> +<dd> +dictionary containing the names as keys and the list of nodes +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +dict +</dd> +</dl> +<a NAME="NamedExprFinder.visit" ID="NamedExprFinder.visit"></a> +<h4>NamedExprFinder.visit</h4> +<b>visit</b>(<i>node</i>) +<p> + Public method to traverse a given AST node. +</p> +<p> + Like super-visit but supports iteration over lists. +</p> + +<dl> + +<dt><i>node</i> (TYPE)</dt> +<dd> +AST node to be traversed +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +reference to the last processed node +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +ast.Node +</dd> +</dl> +<a NAME="NamedExprFinder.visit_NamedExpr" ID="NamedExprFinder.visit_NamedExpr"></a> +<h4>NamedExprFinder.visit_NamedExpr</h4> +<b>visit_NamedExpr</b>(<i>node: ast.NamedExpr</i>) +<p> + Public method handling 'NamedExpr' nodes. +</p> + +<dl> + +<dt><i>node</i> (ast.NamedExpr)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="composeCallPath" ID="composeCallPath"></a> +<h2>composeCallPath</h2> +<b>composeCallPath</b>(<i>node</i>) +<p> + Generator function to assemble the call path of a given node. +</p> + +<dl> + +<dt><i>node</i> (ast.Node)</dt> +<dd> +node to assemble call path for +</dd> +</dl> +<dl> +<dt>Yield:</dt> +<dd> +call path components +</dd> +</dl> +<dl> +<dt>Yield Type:</dt> +<dd> +str +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +</body></html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DateTimeVisitor.html Thu Feb 27 14:42:39 2025 +0100 @@ -0,0 +1,134 @@ +<!DOCTYPE html> +<html><head> +<title>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DateTimeVisitor</title> +<meta charset="UTF-8"> +<link rel="stylesheet" href="styles.css"> +</head> +<body> +<a NAME="top" ID="top"></a> +<h1>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DateTimeVisitor</h1> +<p> +Module implementing a node visitor to check datetime function calls. +</p> + +<h3>Global Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Classes</h3> +<table> +<tr> +<td><a href="#DateTimeVisitor">DateTimeVisitor</a></td> +<td>Class implementing a node visitor to check datetime function calls.</td> +</tr> +</table> + +<h3>Functions</h3> +<table> +<tr><td>None</td></tr> +</table> + +<hr /> +<hr /> +<a NAME="DateTimeVisitor" ID="DateTimeVisitor"></a> +<h2>DateTimeVisitor</h2> +<p> + Class implementing a node visitor to check datetime function calls. +</p> +<p> + Note: This class is modeled after flake8_datetimez v20.10.0 checker. +</p> + +<h3>Derived from</h3> +ast.NodeVisitor +<h3>Class Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Class Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Methods</h3> +<table> +<tr> +<td><a href="#DateTimeVisitor.__init__">DateTimeVisitor</a></td> +<td>Constructor</td> +</tr> +<tr> +<td><a href="#DateTimeVisitor.__getFromKeywords">__getFromKeywords</a></td> +<td>Private method to get a keyword node given its name.</td> +</tr> +<tr> +<td><a href="#DateTimeVisitor.visit_Call">visit_Call</a></td> +<td>Public method to handle a function call.</td> +</tr> +</table> + +<h3>Static Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + + +<a NAME="DateTimeVisitor.__init__" ID="DateTimeVisitor.__init__"></a> +<h4>DateTimeVisitor (Constructor)</h4> +<b>DateTimeVisitor</b>(<i></i>) +<p> + Constructor +</p> + +<a NAME="DateTimeVisitor.__getFromKeywords" ID="DateTimeVisitor.__getFromKeywords"></a> +<h4>DateTimeVisitor.__getFromKeywords</h4> +<b>__getFromKeywords</b>(<i>keywords, name</i>) +<p> + Private method to get a keyword node given its name. +</p> + +<dl> + +<dt><i>keywords</i> (list of ast.AST)</dt> +<dd> +list of keyword argument nodes +</dd> +<dt><i>name</i> (str)</dt> +<dd> +name of the keyword node +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +keyword node +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +ast.AST +</dd> +</dl> +<a NAME="DateTimeVisitor.visit_Call" ID="DateTimeVisitor.visit_Call"></a> +<h4>DateTimeVisitor.visit_Call</h4> +<b>visit_Call</b>(<i>node</i>) +<p> + Public method to handle a function call. +</p> +<p> + Every datetime related function call is check for use of the naive + variant (i.e. use without TZ info). +</p> + +<dl> + +<dt><i>node</i> (ast.Call)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +</body></html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DefaultMatchCaseVisitor.html Thu Feb 27 14:42:39 2025 +0100 @@ -0,0 +1,249 @@ +<!DOCTYPE html> +<html><head> +<title>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DefaultMatchCaseVisitor</title> +<meta charset="UTF-8"> +<link rel="stylesheet" href="styles.css"> +</head> +<body> +<a NAME="top" ID="top"></a> +<h1>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DefaultMatchCaseVisitor</h1> +<p> +Module implementing a node visitor to check default match cases. +</p> + +<h3>Global Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Classes</h3> +<table> +<tr> +<td><a href="#DefaultMatchCaseVisitor">DefaultMatchCaseVisitor</a></td> +<td>Class implementing a node visitor to check default match cases.</td> +</tr> +</table> + +<h3>Functions</h3> +<table> +<tr><td>None</td></tr> +</table> + +<hr /> +<hr /> +<a NAME="DefaultMatchCaseVisitor" ID="DefaultMatchCaseVisitor"></a> +<h2>DefaultMatchCaseVisitor</h2> +<p> + Class implementing a node visitor to check default match cases. +</p> +<p> + Note: This class is modeled after flake8-spm v0.0.1. +</p> + +<h3>Derived from</h3> +ast.NodeVisitor +<h3>Class Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Class Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Methods</h3> +<table> +<tr> +<td><a href="#DefaultMatchCaseVisitor.__init__">DefaultMatchCaseVisitor</a></td> +<td>Constructor</td> +</tr> +<tr> +<td><a href="#DefaultMatchCaseVisitor.__badNodes">__badNodes</a></td> +<td>Private method to yield bad match nodes.</td> +</tr> +<tr> +<td><a href="#DefaultMatchCaseVisitor.__emptyMatchDefault">__emptyMatchDefault</a></td> +<td>Private method to check for an empty default match case.</td> +</tr> +<tr> +<td><a href="#DefaultMatchCaseVisitor.__findBadNode">__findBadNode</a></td> +<td>Private method returning a reference to the bad node of a case node.</td> +</tr> +<tr> +<td><a href="#DefaultMatchCaseVisitor.__lastStatementDoesNotRaise">__lastStatementDoesNotRaise</a></td> +<td>Private method to check that the last case statement does not raise an exception.</td> +</tr> +<tr> +<td><a href="#DefaultMatchCaseVisitor.__returnPrecedesExceptionRaising">__returnPrecedesExceptionRaising</a></td> +<td>Private method to check that no return precedes an exception raising.</td> +</tr> +<tr> +<td><a href="#DefaultMatchCaseVisitor.visit_Match">visit_Match</a></td> +<td>Public method to handle Match nodes.</td> +</tr> +</table> + +<h3>Static Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + + +<a NAME="DefaultMatchCaseVisitor.__init__" ID="DefaultMatchCaseVisitor.__init__"></a> +<h4>DefaultMatchCaseVisitor (Constructor)</h4> +<b>DefaultMatchCaseVisitor</b>(<i></i>) +<p> + Constructor +</p> + +<a NAME="DefaultMatchCaseVisitor.__badNodes" ID="DefaultMatchCaseVisitor.__badNodes"></a> +<h4>DefaultMatchCaseVisitor.__badNodes</h4> +<b>__badNodes</b>(<i>node</i>) +<p> + Private method to yield bad match nodes. +</p> + +<dl> + +<dt><i>node</i> (ast.Match)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<dl> +<dt>Yield:</dt> +<dd> +tuple containing a reference to bad match case node and the corresponding + issue code +</dd> +</dl> +<dl> +<dt>Yield Type:</dt> +<dd> +tyuple of (ast.AST, str) +</dd> +</dl> +<a NAME="DefaultMatchCaseVisitor.__emptyMatchDefault" ID="DefaultMatchCaseVisitor.__emptyMatchDefault"></a> +<h4>DefaultMatchCaseVisitor.__emptyMatchDefault</h4> +<b>__emptyMatchDefault</b>(<i>case</i>) +<p> + Private method to check for an empty default match case. +</p> + +<dl> + +<dt><i>case</i> (ast.match_case)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +flag indicating an empty default match case +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<a NAME="DefaultMatchCaseVisitor.__findBadNode" ID="DefaultMatchCaseVisitor.__findBadNode"></a> +<h4>DefaultMatchCaseVisitor.__findBadNode</h4> +<b>__findBadNode</b>(<i>case</i>) +<p> + Private method returning a reference to the bad node of a case node. +</p> + +<dl> + +<dt><i>case</i> (ast.match_case)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +reference to the bad node +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +ast.AST +</dd> +</dl> +<a NAME="DefaultMatchCaseVisitor.__lastStatementDoesNotRaise" ID="DefaultMatchCaseVisitor.__lastStatementDoesNotRaise"></a> +<h4>DefaultMatchCaseVisitor.__lastStatementDoesNotRaise</h4> +<b>__lastStatementDoesNotRaise</b>(<i>case</i>) +<p> + Private method to check that the last case statement does not raise an + exception. +</p> + +<dl> + +<dt><i>case</i> (ast.match_case)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +flag indicating that the last case statement does not raise an + exception +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<a NAME="DefaultMatchCaseVisitor.__returnPrecedesExceptionRaising" ID="DefaultMatchCaseVisitor.__returnPrecedesExceptionRaising"></a> +<h4>DefaultMatchCaseVisitor.__returnPrecedesExceptionRaising</h4> +<b>__returnPrecedesExceptionRaising</b>(<i>case</i>) +<p> + Private method to check that no return precedes an exception raising. +</p> + +<dl> + +<dt><i>case</i> (ast.match_case)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +flag indicating that a return precedes an exception raising +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<a NAME="DefaultMatchCaseVisitor.visit_Match" ID="DefaultMatchCaseVisitor.visit_Match"></a> +<h4>DefaultMatchCaseVisitor.visit_Match</h4> +<b>visit_Match</b>(<i>node</i>) +<p> + Public method to handle Match nodes. +</p> + +<dl> + +<dt><i>node</i> (ast.Match)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +</body></html>
--- a/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html Thu Feb 27 14:42:39 2025 +0100 @@ -13,88 +13,20 @@ <h3>Global Attributes</h3> <table> -<tr><td>BugBearContext</td></tr> -<tr><td>BugbearImmutableCalls</td></tr> -<tr><td>BugbearMutableCalls</td></tr> -<tr><td>BugbearMutableComprehensions</td></tr> -<tr><td>BugbearMutableLiterals</td></tr> +<tr><td>None</td></tr> </table> <h3>Classes</h3> <table> <tr> -<td><a href="#BugBearVisitor">BugBearVisitor</a></td> -<td>Class implementing a node visitor to check for various topics.</td> -</tr> -<tr> -<td><a href="#DateTimeVisitor">DateTimeVisitor</a></td> -<td>Class implementing a node visitor to check datetime function calls.</td> -</tr> -<tr> -<td><a href="#DefaultMatchCaseVisitor">DefaultMatchCaseVisitor</a></td> -<td>Class implementing a node visitor to check default match cases.</td> -</tr> -<tr> -<td><a href="#ExceptBaseExceptionVisitor">ExceptBaseExceptionVisitor</a></td> -<td>Class to determine, if a 'BaseException' is re-raised.</td> -</tr> -<tr> -<td><a href="#FunctionDefDefaultsVisitor">FunctionDefDefaultsVisitor</a></td> -<td>Class used by M506, M508 and M539.</td> -</tr> -<tr> -<td><a href="#M520NameFinder">M520NameFinder</a></td> -<td>Class to extract a name out of a tree of nodes ignoring names defined within the local scope of a comprehension.</td> -</tr> -<tr> -<td><a href="#M540CaughtException">M540CaughtException</a></td> -<td>Class to hold the data for a caught exception.</td> -</tr> -<tr> -<td><a href="#M541UnhandledKeyType">M541UnhandledKeyType</a></td> -<td>Class to hold a dictionary key of a type that we do not check for duplicates.</td> -</tr> -<tr> -<td><a href="#M541VariableKeyType">M541VariableKeyType</a></td> -<td>Class to hold the name of a variable key type.</td> -</tr> -<tr> -<td><a href="#M569Checker">M569Checker</a></td> -<td>Class traversing a 'for' loop body to check for modifications to a loop's mutable iterable.</td> -</tr> -<tr> <td><a href="#MiscellaneousChecker">MiscellaneousChecker</a></td> <td>Class implementing a checker for miscellaneous checks.</td> </tr> -<tr> -<td><a href="#NameFinder">NameFinder</a></td> -<td>Class to extract a name out of a tree of nodes.</td> -</tr> -<tr> -<td><a href="#NamedExprFinder">NamedExprFinder</a></td> -<td>Class to extract names defined through an ast.NamedExpr.</td> -</tr> -<tr> -<td><a href="#ReturnVisitor">ReturnVisitor</a></td> -<td>Class implementing a node visitor to check return statements.</td> -</tr> -<tr> -<td><a href="#SysVersionVisitor">SysVersionVisitor</a></td> -<td>Class implementing a node visitor to check the use of sys.version and sys.version_info.</td> -</tr> -<tr> -<td><a href="#TextVisitor">TextVisitor</a></td> -<td>Class implementing a node visitor for bytes and str instances.</td> -</tr> </table> <h3>Functions</h3> <table> <tr> -<td><a href="#composeCallPath">composeCallPath</a></td> -<td>Generator function to assemble the call path of a given node.</td> -</tr> -<tr> <td><a href="#pairwise">pairwise</a></td> <td></td> </tr> @@ -102,2578 +34,6 @@ <hr /> <hr /> -<a NAME="BugBearVisitor" ID="BugBearVisitor"></a> -<h2>BugBearVisitor</h2> -<p> - Class implementing a node visitor to check for various topics. -</p> - -<h3>Derived from</h3> -ast.NodeVisitor -<h3>Class Attributes</h3> -<table> -<tr><td>CONTEXTFUL_NODES</td></tr> -<tr><td>FUNCTION_NODES</td></tr> -<tr><td>NodeWindowSize</td></tr> -</table> - -<h3>Class Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Methods</h3> -<table> -<tr> -<td><a href="#BugBearVisitor.__init__">BugBearVisitor</a></td> -<td>Constructor</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__checkForM505">__checkForM505</a></td> -<td>Private method to check the use of *strip().</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__checkForM506_M508">__checkForM506_M508</a></td> -<td>Private method to check the use of mutable literals, comprehensions and calls.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__checkForM507">__checkForM507</a></td> -<td>Private method to check for unused loop variables.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__checkForM512">__checkForM512</a></td> -<td>Private method to check for return/continue/break inside finally blocks.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__checkForM513_M514_M529_M530">__checkForM513_M514_M529_M530</a></td> -<td>Private method to check various exception handler situations.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__checkForM515">__checkForM515</a></td> -<td>Private method to check for pointless comparisons.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__checkForM516">__checkForM516</a></td> -<td>Private method to check for raising a literal instead of an exception.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__checkForM517">__checkForM517</a></td> -<td>Private method to check for use of the evil syntax 'with assertRaises(Exception): or 'with pytest.raises(Exception):'.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__checkForM518">__checkForM518</a></td> -<td>Private method to check for useless expressions.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__checkForM519">__checkForM519</a></td> -<td>Private method to check for use of 'functools.lru_cache' or 'functools.cache'.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__checkForM520">__checkForM520</a></td> -<td>Private method to check for a loop that modifies its iterable.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__checkForM521">__checkForM521</a></td> -<td>Private method to check for use of an f-string as docstring.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__checkForM522">__checkForM522</a></td> -<td>Private method to check for use of an f-string as docstring.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__checkForM523">__checkForM523</a></td> -<td>Private method to check that functions (including lambdas) do not use loop variables.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__checkForM524_M527">__checkForM524_M527</a></td> -<td>Private method to check for inheritance from abstract classes in abc and lack of any methods decorated with abstract*.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__checkForM525">__checkForM525</a></td> -<td>Private method to check for exceptions being handled multiple times.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__checkForM526">__checkForM526</a></td> -<td>Private method to check for Star-arg unpacking after keyword argument.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__checkForM528">__checkForM528</a></td> -<td>Private method to check for warn without stacklevel.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__checkForM531">__checkForM531</a></td> -<td>Private method to check that 'itertools.groupby' isn't iterated over more than once.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__checkForM532">__checkForM532</a></td> -<td>Private method to check for possible unintentional typing annotation.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__checkForM533">__checkForM533</a></td> -<td>Private method to check a set for duplicate items.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__checkForM534">__checkForM534</a></td> -<td>Private method to check that re.sub/subn/split arguments flags/count/maxsplit are passed as keyword arguments.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__checkForM535">__checkForM535</a></td> -<td>Private method to check that a static key isn't used in a dict comprehension.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__checkForM539">__checkForM539</a></td> -<td>Private method to check for correct ContextVar usage.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__checkForM540AddNote">__checkForM540AddNote</a></td> -<td>Private method to check add_note usage.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__checkForM540Usage">__checkForM540Usage</a></td> -<td>Private method to check the usage of exceptions with added note.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__checkForM541">__checkForM541</a></td> -<td>Private method to check for duplicate key value pairs in a dictionary literal.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__checkForM569">__checkForM569</a></td> -<td>Private method to check for changes to a loop's mutable iterable.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__checkRedundantExcepthandlers">__checkRedundantExcepthandlers</a></td> -<td>Private method to check for redundant exception types in an exception handler.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__childrenInScope">__childrenInScope</a></td> -<td>Private method to get all child nodes in the given scope.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__flattenExcepthandler">__flattenExcepthandler</a></td> -<td>Private method to flatten the list of exceptions handled by an except handler.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__getAssignedNames">__getAssignedNames</a></td> -<td>Private method to get the names of a for loop.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__getDictCompLoopAndNamedExprVarNames">__getDictCompLoopAndNamedExprVarNames</a></td> -<td>Private method to get the names of comprehension loop variables.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__getNamesFromTuple">__getNamesFromTuple</a></td> -<td>Private method to get the names from an ast.Tuple node.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__inClassInit">__inClassInit</a></td> -<td>Private method to check, if we are inside an '__init__' method.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__isIdentifier">__isIdentifier</a></td> -<td>Private method to check if arg is a valid identifier.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__namesFromAssignments">__namesFromAssignments</a></td> -<td>Private method to get names of an assignment.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__typesafeIssubclass">__typesafeIssubclass</a></td> -<td>Private method implementing a type safe issubclass() function.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.__walkList">__walkList</a></td> -<td>Private method to walk a given list of nodes.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor._loop">_loop</a></td> -<td></td> -</tr> -<tr> -<td><a href="#BugBearVisitor.check">check</a></td> -<td></td> -</tr> -<tr> -<td><a href="#BugBearVisitor.convertToValue">convertToValue</a></td> -<td>Function to extract the value of a given item.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.emptyBody">emptyBody</a></td> -<td></td> -</tr> -<tr> -<td><a href="#BugBearVisitor.isAbcClass">isAbcClass</a></td> -<td></td> -</tr> -<tr> -<td><a href="#BugBearVisitor.isAbstractDecorator">isAbstractDecorator</a></td> -<td></td> -</tr> -<tr> -<td><a href="#BugBearVisitor.isOverload">isOverload</a></td> -<td></td> -</tr> -<tr> -<td><a href="#BugBearVisitor.isStrOrEllipsis">isStrOrEllipsis</a></td> -<td></td> -</tr> -<tr> -<td><a href="#BugBearVisitor.nodeStack">nodeStack</a></td> -<td>Public method to get a reference to the most recent node stack.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.superwalk">superwalk</a></td> -<td>Function to walk an AST node or a list of AST nodes.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.toNameStr">toNameStr</a></td> -<td>Public method to turn Name and Attribute nodes to strings, handling any depth of attribute accesses.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit">visit</a></td> -<td>Public method to traverse a given AST node.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_AnnAssign">visit_AnnAssign</a></td> -<td>Public method to check annotated assign statements.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_Assert">visit_Assert</a></td> -<td>Public method to handle 'assert' statements.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_Assign">visit_Assign</a></td> -<td>Public method to handle assignments.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_AsyncFor">visit_AsyncFor</a></td> -<td>Public method to handle 'for' statements.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_AsyncFunctionDef">visit_AsyncFunctionDef</a></td> -<td>Public method to handle async function definitions.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_Call">visit_Call</a></td> -<td>Public method to handle a function call.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_ClassDef">visit_ClassDef</a></td> -<td>Public method to handle class definitions.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_Compare">visit_Compare</a></td> -<td>Public method to handle comparison statements.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_Dict">visit_Dict</a></td> -<td>Public method to check a dictionary.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_DictComp">visit_DictComp</a></td> -<td>Public method to handle dictionary comprehensions.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_ExceptHandler">visit_ExceptHandler</a></td> -<td>Public method to handle exception handlers.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_For">visit_For</a></td> -<td>Public method to handle 'for' statements.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_FunctionDef">visit_FunctionDef</a></td> -<td>Public method to handle function definitions.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_GeneratorExp">visit_GeneratorExp</a></td> -<td>Public method to handle generator expressions.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_Import">visit_Import</a></td> -<td>Public method to check imports.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_ImportFrom">visit_ImportFrom</a></td> -<td>Public method to check from imports.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_JoinedStr">visit_JoinedStr</a></td> -<td>Public method to handle f-string arguments.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_ListComp">visit_ListComp</a></td> -<td>Public method to handle list comprehensions.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_Module">visit_Module</a></td> -<td>Public method to handle a module node.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_Raise">visit_Raise</a></td> -<td>Public method to handle 'raise' statements.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_Return">visit_Return</a></td> -<td>Public method to handle 'Return' nodes.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_Set">visit_Set</a></td> -<td>Public method to check a set.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_SetComp">visit_SetComp</a></td> -<td>Public method to handle set comprehensions.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_Try">visit_Try</a></td> -<td>Public method to handle 'try' statements.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_TryStar">visit_TryStar</a></td> -<td>Public method to handle 'except*' statements.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_UAdd">visit_UAdd</a></td> -<td>Public method to handle unary additions.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_While">visit_While</a></td> -<td>Public method to handle 'while' statements.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_With">visit_With</a></td> -<td>Public method to handle 'with' statements.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_Yield">visit_Yield</a></td> -<td>Public method to handle 'Yield' nodes.</td> -</tr> -<tr> -<td><a href="#BugBearVisitor.visit_YieldFrom">visit_YieldFrom</a></td> -<td>Public method to handle 'YieldFrom' nodes.</td> -</tr> -</table> - -<h3>Static Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - - -<a NAME="BugBearVisitor.__init__" ID="BugBearVisitor.__init__"></a> -<h4>BugBearVisitor (Constructor)</h4> -<b>BugBearVisitor</b>(<i></i>) -<p> - Constructor -</p> - -<a NAME="BugBearVisitor.__checkForM505" ID="BugBearVisitor.__checkForM505"></a> -<h4>BugBearVisitor.__checkForM505</h4> -<b>__checkForM505</b>(<i>node</i>) -<p> - Private method to check the use of *strip(). -</p> - -<dl> - -<dt><i>node</i> (ast.Call)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.__checkForM506_M508" ID="BugBearVisitor.__checkForM506_M508"></a> -<h4>BugBearVisitor.__checkForM506_M508</h4> -<b>__checkForM506_M508</b>(<i>node</i>) -<p> - Private method to check the use of mutable literals, comprehensions and calls. -</p> - -<dl> - -<dt><i>node</i> (ast.AsyncFunctionDef or ast.FunctionDef)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.__checkForM507" ID="BugBearVisitor.__checkForM507"></a> -<h4>BugBearVisitor.__checkForM507</h4> -<b>__checkForM507</b>(<i>node</i>) -<p> - Private method to check for unused loop variables. -</p> - -<dl> - -<dt><i>node</i> (ast.For or ast.AsyncFor)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.__checkForM512" ID="BugBearVisitor.__checkForM512"></a> -<h4>BugBearVisitor.__checkForM512</h4> -<b>__checkForM512</b>(<i>node</i>) -<p> - Private method to check for return/continue/break inside finally blocks. -</p> - -<dl> - -<dt><i>node</i> (ast.Try)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.__checkForM513_M514_M529_M530" ID="BugBearVisitor.__checkForM513_M514_M529_M530"></a> -<h4>BugBearVisitor.__checkForM513_M514_M529_M530</h4> -<b>__checkForM513_M514_M529_M530</b>(<i>node</i>) -<p> - Private method to check various exception handler situations. -</p> - -<dl> - -<dt><i>node</i> (ast.ExceptHandler)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -list of exception handler names -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -list of str -</dd> -</dl> -<a NAME="BugBearVisitor.__checkForM515" ID="BugBearVisitor.__checkForM515"></a> -<h4>BugBearVisitor.__checkForM515</h4> -<b>__checkForM515</b>(<i>node</i>) -<p> - Private method to check for pointless comparisons. -</p> - -<dl> - -<dt><i>node</i> (ast.Compare)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.__checkForM516" ID="BugBearVisitor.__checkForM516"></a> -<h4>BugBearVisitor.__checkForM516</h4> -<b>__checkForM516</b>(<i>node</i>) -<p> - Private method to check for raising a literal instead of an exception. -</p> - -<dl> - -<dt><i>node</i> (ast.Raise)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.__checkForM517" ID="BugBearVisitor.__checkForM517"></a> -<h4>BugBearVisitor.__checkForM517</h4> -<b>__checkForM517</b>(<i>node</i>) -<p> - Private method to check for use of the evil syntax - 'with assertRaises(Exception): or 'with pytest.raises(Exception):'. -</p> - -<dl> - -<dt><i>node</i> (ast.With)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.__checkForM518" ID="BugBearVisitor.__checkForM518"></a> -<h4>BugBearVisitor.__checkForM518</h4> -<b>__checkForM518</b>(<i>node</i>) -<p> - Private method to check for useless expressions. -</p> - -<dl> - -<dt><i>node</i> (ast.FunctionDef)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.__checkForM519" ID="BugBearVisitor.__checkForM519"></a> -<h4>BugBearVisitor.__checkForM519</h4> -<b>__checkForM519</b>(<i>node</i>) -<p> - Private method to check for use of 'functools.lru_cache' or 'functools.cache'. -</p> - -<dl> - -<dt><i>node</i> (ast.FunctionDef)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.__checkForM520" ID="BugBearVisitor.__checkForM520"></a> -<h4>BugBearVisitor.__checkForM520</h4> -<b>__checkForM520</b>(<i>node</i>) -<p> - Private method to check for a loop that modifies its iterable. -</p> - -<dl> - -<dt><i>node</i> (ast.For or ast.AsyncFor)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.__checkForM521" ID="BugBearVisitor.__checkForM521"></a> -<h4>BugBearVisitor.__checkForM521</h4> -<b>__checkForM521</b>(<i>node</i>) -<p> - Private method to check for use of an f-string as docstring. -</p> - -<dl> - -<dt><i>node</i> (ast.FunctionDef or ast.ClassDef)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.__checkForM522" ID="BugBearVisitor.__checkForM522"></a> -<h4>BugBearVisitor.__checkForM522</h4> -<b>__checkForM522</b>(<i>node</i>) -<p> - Private method to check for use of an f-string as docstring. -</p> - -<dl> - -<dt><i>node</i> (ast.With)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.__checkForM523" ID="BugBearVisitor.__checkForM523"></a> -<h4>BugBearVisitor.__checkForM523</h4> -<b>__checkForM523</b>(<i>loopNode</i>) -<p> - Private method to check that functions (including lambdas) do not use loop - variables. -</p> - -<dl> - -<dt><i>loopNode</i> (ast.For, ast.AsyncFor, ast.While, ast.ListComp, ast.SetComp,ast.DictComp,)</dt> -<dd> -reference to the node to be processed - or ast.GeneratorExp -</dd> -</dl> -<a NAME="BugBearVisitor.__checkForM524_M527" ID="BugBearVisitor.__checkForM524_M527"></a> -<h4>BugBearVisitor.__checkForM524_M527</h4> -<b>__checkForM524_M527</b>(<i>node</i>) -<p> - Private method to check for inheritance from abstract classes in abc and lack of - any methods decorated with abstract*. -</p> - -<dl> - -<dt><i>node</i> (ast.ClassDef)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.__checkForM525" ID="BugBearVisitor.__checkForM525"></a> -<h4>BugBearVisitor.__checkForM525</h4> -<b>__checkForM525</b>(<i>node</i>) -<p> - Private method to check for exceptions being handled multiple times. -</p> - -<dl> - -<dt><i>node</i> (ast.Try)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.__checkForM526" ID="BugBearVisitor.__checkForM526"></a> -<h4>BugBearVisitor.__checkForM526</h4> -<b>__checkForM526</b>(<i>node</i>) -<p> - Private method to check for Star-arg unpacking after keyword argument. -</p> - -<dl> - -<dt><i>node</i> (ast.Call)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.__checkForM528" ID="BugBearVisitor.__checkForM528"></a> -<h4>BugBearVisitor.__checkForM528</h4> -<b>__checkForM528</b>(<i>node</i>) -<p> - Private method to check for warn without stacklevel. -</p> - -<dl> - -<dt><i>node</i> (ast.Call)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.__checkForM531" ID="BugBearVisitor.__checkForM531"></a> -<h4>BugBearVisitor.__checkForM531</h4> -<b>__checkForM531</b>(<i>loopNode</i>) -<p> - Private method to check that 'itertools.groupby' isn't iterated over more than - once. -</p> -<p> - A warning is emitted when the generator returned by 'groupby()' is used - more than once inside a loop body or when it's used in a nested loop. -</p> - -<dl> - -<dt><i>loopNode</i> (ast.For or ast.AsyncFor)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.__checkForM532" ID="BugBearVisitor.__checkForM532"></a> -<h4>BugBearVisitor.__checkForM532</h4> -<b>__checkForM532</b>(<i>node</i>) -<p> - Private method to check for possible unintentional typing annotation. -</p> - -<dl> - -<dt><i>node</i> (ast.AnnAssign)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.__checkForM533" ID="BugBearVisitor.__checkForM533"></a> -<h4>BugBearVisitor.__checkForM533</h4> -<b>__checkForM533</b>(<i>node</i>) -<p> - Private method to check a set for duplicate items. -</p> - -<dl> - -<dt><i>node</i> (ast.Set)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.__checkForM534" ID="BugBearVisitor.__checkForM534"></a> -<h4>BugBearVisitor.__checkForM534</h4> -<b>__checkForM534</b>(<i>node</i>) -<p> - Private method to check that re.sub/subn/split arguments flags/count/maxsplit - are passed as keyword arguments. -</p> - -<dl> - -<dt><i>node</i> (ast.Call)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.__checkForM535" ID="BugBearVisitor.__checkForM535"></a> -<h4>BugBearVisitor.__checkForM535</h4> -<b>__checkForM535</b>(<i>node</i>) -<p> - Private method to check that a static key isn't used in a dict comprehension. -</p> -<p> - Record a warning if a likely unchanging key is used - either a constant, - or a variable that isn't coming from the generator expression. -</p> - -<dl> - -<dt><i>node</i> (ast.DictComp)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.__checkForM539" ID="BugBearVisitor.__checkForM539"></a> -<h4>BugBearVisitor.__checkForM539</h4> -<b>__checkForM539</b>(<i>node</i>) -<p> - Private method to check for correct ContextVar usage. -</p> - -<dl> - -<dt><i>node</i> (ast.Call)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.__checkForM540AddNote" ID="BugBearVisitor.__checkForM540AddNote"></a> -<h4>BugBearVisitor.__checkForM540AddNote</h4> -<b>__checkForM540AddNote</b>(<i>node</i>) -<p> - Private method to check add_note usage. -</p> - -<dl> - -<dt><i>node</i> (ast.Attribute)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -flag -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<a NAME="BugBearVisitor.__checkForM540Usage" ID="BugBearVisitor.__checkForM540Usage"></a> -<h4>BugBearVisitor.__checkForM540Usage</h4> -<b>__checkForM540Usage</b>(<i>node</i>) -<p> - Private method to check the usage of exceptions with added note. -</p> - -<dl> - -<dt><i>node</i> (ast.expr or None)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.__checkForM541" ID="BugBearVisitor.__checkForM541"></a> -<h4>BugBearVisitor.__checkForM541</h4> -<b>__checkForM541</b>(<i>node</i>) -<p> - Private method to check for duplicate key value pairs in a dictionary literal. -</p> - -<dl> - -<dt><i>node</i> (ast.Dict)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.__checkForM569" ID="BugBearVisitor.__checkForM569"></a> -<h4>BugBearVisitor.__checkForM569</h4> -<b>__checkForM569</b>(<i>node</i>) -<p> - Private method to check for changes to a loop's mutable iterable. -</p> - -<dl> - -<dt><i>node</i> (ast.For)</dt> -<dd> -loop node to be checked -</dd> -</dl> -<a NAME="BugBearVisitor.__checkRedundantExcepthandlers" ID="BugBearVisitor.__checkRedundantExcepthandlers"></a> -<h4>BugBearVisitor.__checkRedundantExcepthandlers</h4> -<b>__checkRedundantExcepthandlers</b>(<i>names, node, inTryStar</i>) -<p> - Private method to check for redundant exception types in an exception handler. -</p> - -<dl> - -<dt><i>names</i> (list of ast.Name)</dt> -<dd> -list of exception types to be checked -</dd> -<dt><i>node</i> (ast.ExceptionHandler)</dt> -<dd> -reference to the exception handler node -</dd> -<dt><i>inTryStar</i> (str)</dt> -<dd> -character indicating an 'except*' handler -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -tuple containing the error data -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (ast.Node, str, str, str, str) -</dd> -</dl> -<a NAME="BugBearVisitor.__childrenInScope" ID="BugBearVisitor.__childrenInScope"></a> -<h4>BugBearVisitor.__childrenInScope</h4> -<b>__childrenInScope</b>(<i>node</i>) -<p> - Private method to get all child nodes in the given scope. -</p> - -<dl> - -<dt><i>node</i> (ast.Node)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<dl> -<dt>Yield:</dt> -<dd> -reference to a child node -</dd> -</dl> -<dl> -<dt>Yield Type:</dt> -<dd> -ast.Node -</dd> -</dl> -<a NAME="BugBearVisitor.__flattenExcepthandler" ID="BugBearVisitor.__flattenExcepthandler"></a> -<h4>BugBearVisitor.__flattenExcepthandler</h4> -<b>__flattenExcepthandler</b>(<i>node</i>) -<p> - Private method to flatten the list of exceptions handled by an except handler. -</p> - -<dl> - -<dt><i>node</i> (ast.Node)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<dl> -<dt>Yield:</dt> -<dd> -reference to the exception type node -</dd> -</dl> -<dl> -<dt>Yield Type:</dt> -<dd> -ast.Node -</dd> -</dl> -<a NAME="BugBearVisitor.__getAssignedNames" ID="BugBearVisitor.__getAssignedNames"></a> -<h4>BugBearVisitor.__getAssignedNames</h4> -<b>__getAssignedNames</b>(<i>loopNode</i>) -<p> - Private method to get the names of a for loop. -</p> - -<dl> - -<dt><i>loopNode</i> (ast.For)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<dl> -<dt>Yield:</dt> -<dd> -DESCRIPTION -</dd> -</dl> -<dl> -<dt>Yield Type:</dt> -<dd> -TYPE -</dd> -</dl> -<a NAME="BugBearVisitor.__getDictCompLoopAndNamedExprVarNames" ID="BugBearVisitor.__getDictCompLoopAndNamedExprVarNames"></a> -<h4>BugBearVisitor.__getDictCompLoopAndNamedExprVarNames</h4> -<b>__getDictCompLoopAndNamedExprVarNames</b>(<i>node</i>) -<p> - Private method to get the names of comprehension loop variables. -</p> - -<dl> - -<dt><i>node</i> (ast.DictComp)</dt> -<dd> -ast node to be processed -</dd> -</dl> -<dl> -<dt>Yield:</dt> -<dd> -loop variable names -</dd> -</dl> -<dl> -<dt>Yield Type:</dt> -<dd> -str -</dd> -</dl> -<a NAME="BugBearVisitor.__getNamesFromTuple" ID="BugBearVisitor.__getNamesFromTuple"></a> -<h4>BugBearVisitor.__getNamesFromTuple</h4> -<b>__getNamesFromTuple</b>(<i>node</i>) -<p> - Private method to get the names from an ast.Tuple node. -</p> - -<dl> - -<dt><i>node</i> (ast.Tuple)</dt> -<dd> -ast node to be processed -</dd> -</dl> -<dl> -<dt>Yield:</dt> -<dd> -names -</dd> -</dl> -<dl> -<dt>Yield Type:</dt> -<dd> -str -</dd> -</dl> -<a NAME="BugBearVisitor.__inClassInit" ID="BugBearVisitor.__inClassInit"></a> -<h4>BugBearVisitor.__inClassInit</h4> -<b>__inClassInit</b>(<i></i>) -<p> - Private method to check, if we are inside an '__init__' method. -</p> - -<dl> -<dt>Return:</dt> -<dd> -flag indicating being within the '__init__' method -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<a NAME="BugBearVisitor.__isIdentifier" ID="BugBearVisitor.__isIdentifier"></a> -<h4>BugBearVisitor.__isIdentifier</h4> -<b>__isIdentifier</b>(<i>arg</i>) -<p> - Private method to check if arg is a valid identifier. -</p> -<p> - See https://docs.python.org/2/reference/lexical_analysis.html#identifiers -</p> - -<dl> - -<dt><i>arg</i> (ast.Node)</dt> -<dd> -reference to an argument node -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -flag indicating a valid identifier -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -TYPE -</dd> -</dl> -<a NAME="BugBearVisitor.__namesFromAssignments" ID="BugBearVisitor.__namesFromAssignments"></a> -<h4>BugBearVisitor.__namesFromAssignments</h4> -<b>__namesFromAssignments</b>(<i>assignTarget</i>) -<p> - Private method to get names of an assignment. -</p> - -<dl> - -<dt><i>assignTarget</i> (ast.Node)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<dl> -<dt>Yield:</dt> -<dd> -name of the assignment -</dd> -</dl> -<dl> -<dt>Yield Type:</dt> -<dd> -str -</dd> -</dl> -<a NAME="BugBearVisitor.__typesafeIssubclass" ID="BugBearVisitor.__typesafeIssubclass"></a> -<h4>BugBearVisitor.__typesafeIssubclass</h4> -<b>__typesafeIssubclass</b>(<i>obj, classOrTuple</i>) -<p> - Private method implementing a type safe issubclass() function. -</p> - -<dl> - -<dt><i>obj</i> (Any)</dt> -<dd> -reference to the object to be tested -</dd> -<dt><i>classOrTuple</i> (type)</dt> -<dd> -type to check against -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -flag indicating a subclass -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<a NAME="BugBearVisitor.__walkList" ID="BugBearVisitor.__walkList"></a> -<h4>BugBearVisitor.__walkList</h4> -<b>__walkList</b>(<i>nodes</i>) -<p> - Private method to walk a given list of nodes. -</p> - -<dl> - -<dt><i>nodes</i> (list of ast.Node)</dt> -<dd> -list of nodes to walk -</dd> -</dl> -<dl> -<dt>Yield:</dt> -<dd> -node references as determined by the ast.walk() function -</dd> -</dl> -<dl> -<dt>Yield Type:</dt> -<dd> -ast.Node -</dd> -</dl> -<a NAME="BugBearVisitor._loop" ID="BugBearVisitor._loop"></a> -<h4>BugBearVisitor._loop</h4> -<b>_loop</b>(<i>badNodeTypes</i>) - -<a NAME="BugBearVisitor.check" ID="BugBearVisitor.check"></a> -<h4>BugBearVisitor.check</h4> -<b>check</b>(<i>paramName</i>) - -<a NAME="BugBearVisitor.convertToValue" ID="BugBearVisitor.convertToValue"></a> -<h4>BugBearVisitor.convertToValue</h4> -<b>convertToValue</b>(<i></i>) -<p> - Function to extract the value of a given item. -</p> - -<dl> - -<dt><i>item</i> (ast.Ast)</dt> -<dd> -node to extract value from -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -value of the node -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -Any -</dd> -</dl> -<a NAME="BugBearVisitor.emptyBody" ID="BugBearVisitor.emptyBody"></a> -<h4>BugBearVisitor.emptyBody</h4> -<b>emptyBody</b>(<i></i>) - -<a NAME="BugBearVisitor.isAbcClass" ID="BugBearVisitor.isAbcClass"></a> -<h4>BugBearVisitor.isAbcClass</h4> -<b>isAbcClass</b>(<i>name="ABC"</i>) - -<a NAME="BugBearVisitor.isAbstractDecorator" ID="BugBearVisitor.isAbstractDecorator"></a> -<h4>BugBearVisitor.isAbstractDecorator</h4> -<b>isAbstractDecorator</b>(<i></i>) - -<a NAME="BugBearVisitor.isOverload" ID="BugBearVisitor.isOverload"></a> -<h4>BugBearVisitor.isOverload</h4> -<b>isOverload</b>(<i></i>) - -<a NAME="BugBearVisitor.isStrOrEllipsis" ID="BugBearVisitor.isStrOrEllipsis"></a> -<h4>BugBearVisitor.isStrOrEllipsis</h4> -<b>isStrOrEllipsis</b>(<i></i>) - -<a NAME="BugBearVisitor.nodeStack" ID="BugBearVisitor.nodeStack"></a> -<h4>BugBearVisitor.nodeStack</h4> -<b>nodeStack</b>(<i></i>) -<p> - Public method to get a reference to the most recent node stack. -</p> - -<dl> -<dt>Return:</dt> -<dd> -reference to the most recent node stack -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -list -</dd> -</dl> -<a NAME="BugBearVisitor.superwalk" ID="BugBearVisitor.superwalk"></a> -<h4>BugBearVisitor.superwalk</h4> -<b>superwalk</b>(<i></i>) -<p> - Function to walk an AST node or a list of AST nodes. -</p> - -<dl> - -<dt><i>node</i> (ast.AST or list[ast.AST])</dt> -<dd> -reference to the node or a list of nodes to be processed -</dd> -</dl> -<dl> -<dt>Yield:</dt> -<dd> -next node to be processed -</dd> -</dl> -<dl> -<dt>Yield Type:</dt> -<dd> -ast.AST -</dd> -</dl> -<a NAME="BugBearVisitor.toNameStr" ID="BugBearVisitor.toNameStr"></a> -<h4>BugBearVisitor.toNameStr</h4> -<b>toNameStr</b>(<i>node</i>) -<p> - Public method to turn Name and Attribute nodes to strings, handling any - depth of attribute accesses. -</p> -<p> - -</p> - -<dl> - -<dt><i>node</i> (ast.Name or ast.Attribute)</dt> -<dd> -reference to the node -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -string representation -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -str -</dd> -</dl> -<a NAME="BugBearVisitor.visit" ID="BugBearVisitor.visit"></a> -<h4>BugBearVisitor.visit</h4> -<b>visit</b>(<i>node</i>) -<p> - Public method to traverse a given AST node. -</p> - -<dl> - -<dt><i>node</i> (ast.Node)</dt> -<dd> -AST node to be traversed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_AnnAssign" ID="BugBearVisitor.visit_AnnAssign"></a> -<h4>BugBearVisitor.visit_AnnAssign</h4> -<b>visit_AnnAssign</b>(<i>node</i>) -<p> - Public method to check annotated assign statements. -</p> - -<dl> - -<dt><i>node</i> (ast.AnnAssign)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_Assert" ID="BugBearVisitor.visit_Assert"></a> -<h4>BugBearVisitor.visit_Assert</h4> -<b>visit_Assert</b>(<i>node</i>) -<p> - Public method to handle 'assert' statements. -</p> - -<dl> - -<dt><i>node</i> (ast.Assert)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_Assign" ID="BugBearVisitor.visit_Assign"></a> -<h4>BugBearVisitor.visit_Assign</h4> -<b>visit_Assign</b>(<i>node</i>) -<p> - Public method to handle assignments. -</p> - -<dl> - -<dt><i>node</i> (ast.Assign)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_AsyncFor" ID="BugBearVisitor.visit_AsyncFor"></a> -<h4>BugBearVisitor.visit_AsyncFor</h4> -<b>visit_AsyncFor</b>(<i>node</i>) -<p> - Public method to handle 'for' statements. -</p> - -<dl> - -<dt><i>node</i> (ast.AsyncFor)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_AsyncFunctionDef" ID="BugBearVisitor.visit_AsyncFunctionDef"></a> -<h4>BugBearVisitor.visit_AsyncFunctionDef</h4> -<b>visit_AsyncFunctionDef</b>(<i>node</i>) -<p> - Public method to handle async function definitions. -</p> - -<dl> - -<dt><i>node</i> (ast.AsyncFunctionDef)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_Call" ID="BugBearVisitor.visit_Call"></a> -<h4>BugBearVisitor.visit_Call</h4> -<b>visit_Call</b>(<i>node</i>) -<p> - Public method to handle a function call. -</p> - -<dl> - -<dt><i>node</i> (ast.Call)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_ClassDef" ID="BugBearVisitor.visit_ClassDef"></a> -<h4>BugBearVisitor.visit_ClassDef</h4> -<b>visit_ClassDef</b>(<i>node</i>) -<p> - Public method to handle class definitions. -</p> - -<dl> - -<dt><i>node</i> (ast.ClassDef)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_Compare" ID="BugBearVisitor.visit_Compare"></a> -<h4>BugBearVisitor.visit_Compare</h4> -<b>visit_Compare</b>(<i>node</i>) -<p> - Public method to handle comparison statements. -</p> - -<dl> - -<dt><i>node</i> (ast.Compare)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_Dict" ID="BugBearVisitor.visit_Dict"></a> -<h4>BugBearVisitor.visit_Dict</h4> -<b>visit_Dict</b>(<i>node</i>) -<p> - Public method to check a dictionary. -</p> - -<dl> - -<dt><i>node</i> (ast.Dict)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_DictComp" ID="BugBearVisitor.visit_DictComp"></a> -<h4>BugBearVisitor.visit_DictComp</h4> -<b>visit_DictComp</b>(<i>node</i>) -<p> - Public method to handle dictionary comprehensions. -</p> - -<dl> - -<dt><i>node</i> (ast.DictComp)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_ExceptHandler" ID="BugBearVisitor.visit_ExceptHandler"></a> -<h4>BugBearVisitor.visit_ExceptHandler</h4> -<b>visit_ExceptHandler</b>(<i>node</i>) -<p> - Public method to handle exception handlers. -</p> - -<dl> - -<dt><i>node</i> (ast.ExceptHandler)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_For" ID="BugBearVisitor.visit_For"></a> -<h4>BugBearVisitor.visit_For</h4> -<b>visit_For</b>(<i>node</i>) -<p> - Public method to handle 'for' statements. -</p> - -<dl> - -<dt><i>node</i> (ast.For)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_FunctionDef" ID="BugBearVisitor.visit_FunctionDef"></a> -<h4>BugBearVisitor.visit_FunctionDef</h4> -<b>visit_FunctionDef</b>(<i>node</i>) -<p> - Public method to handle function definitions. -</p> - -<dl> - -<dt><i>node</i> (ast.FunctionDef)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_GeneratorExp" ID="BugBearVisitor.visit_GeneratorExp"></a> -<h4>BugBearVisitor.visit_GeneratorExp</h4> -<b>visit_GeneratorExp</b>(<i>node</i>) -<p> - Public method to handle generator expressions. -</p> - -<dl> - -<dt><i>node</i> (ast.GeneratorExp)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_Import" ID="BugBearVisitor.visit_Import"></a> -<h4>BugBearVisitor.visit_Import</h4> -<b>visit_Import</b>(<i>node</i>) -<p> - Public method to check imports. -</p> - -<dl> - -<dt><i>node</i> (ast.Import)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_ImportFrom" ID="BugBearVisitor.visit_ImportFrom"></a> -<h4>BugBearVisitor.visit_ImportFrom</h4> -<b>visit_ImportFrom</b>(<i>node</i>) -<p> - Public method to check from imports. -</p> - -<dl> - -<dt><i>node</i> (ast.Import)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_JoinedStr" ID="BugBearVisitor.visit_JoinedStr"></a> -<h4>BugBearVisitor.visit_JoinedStr</h4> -<b>visit_JoinedStr</b>(<i>node</i>) -<p> - Public method to handle f-string arguments. -</p> - -<dl> - -<dt><i>node</i> (ast.JoinedStr)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_ListComp" ID="BugBearVisitor.visit_ListComp"></a> -<h4>BugBearVisitor.visit_ListComp</h4> -<b>visit_ListComp</b>(<i>node</i>) -<p> - Public method to handle list comprehensions. -</p> - -<dl> - -<dt><i>node</i> (ast.ListComp)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_Module" ID="BugBearVisitor.visit_Module"></a> -<h4>BugBearVisitor.visit_Module</h4> -<b>visit_Module</b>(<i>node</i>) -<p> - Public method to handle a module node. -</p> - -<dl> - -<dt><i>node</i> (ast.Module)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_Raise" ID="BugBearVisitor.visit_Raise"></a> -<h4>BugBearVisitor.visit_Raise</h4> -<b>visit_Raise</b>(<i>node</i>) -<p> - Public method to handle 'raise' statements. -</p> - -<dl> - -<dt><i>node</i> (ast.Raise)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_Return" ID="BugBearVisitor.visit_Return"></a> -<h4>BugBearVisitor.visit_Return</h4> -<b>visit_Return</b>(<i>node</i>) -<p> - Public method to handle 'Return' nodes. -</p> - -<dl> - -<dt><i>node</i> (ast.Return)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_Set" ID="BugBearVisitor.visit_Set"></a> -<h4>BugBearVisitor.visit_Set</h4> -<b>visit_Set</b>(<i>node</i>) -<p> - Public method to check a set. -</p> - -<dl> - -<dt><i>node</i> (ast.Set)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_SetComp" ID="BugBearVisitor.visit_SetComp"></a> -<h4>BugBearVisitor.visit_SetComp</h4> -<b>visit_SetComp</b>(<i>node</i>) -<p> - Public method to handle set comprehensions. -</p> - -<dl> - -<dt><i>node</i> (ast.SetComp)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_Try" ID="BugBearVisitor.visit_Try"></a> -<h4>BugBearVisitor.visit_Try</h4> -<b>visit_Try</b>(<i>node</i>) -<p> - Public method to handle 'try' statements. -</p> - -<dl> - -<dt><i>node</i> (ast.Try)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_TryStar" ID="BugBearVisitor.visit_TryStar"></a> -<h4>BugBearVisitor.visit_TryStar</h4> -<b>visit_TryStar</b>(<i>node</i>) -<p> - Public method to handle 'except*' statements. -</p> - -<dl> - -<dt><i>node</i> (ast.TryStar)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_UAdd" ID="BugBearVisitor.visit_UAdd"></a> -<h4>BugBearVisitor.visit_UAdd</h4> -<b>visit_UAdd</b>(<i>node</i>) -<p> - Public method to handle unary additions. -</p> - -<dl> - -<dt><i>node</i> (ast.UAdd)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_While" ID="BugBearVisitor.visit_While"></a> -<h4>BugBearVisitor.visit_While</h4> -<b>visit_While</b>(<i>node</i>) -<p> - Public method to handle 'while' statements. -</p> - -<dl> - -<dt><i>node</i> (ast.While)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_With" ID="BugBearVisitor.visit_With"></a> -<h4>BugBearVisitor.visit_With</h4> -<b>visit_With</b>(<i>node</i>) -<p> - Public method to handle 'with' statements. -</p> - -<dl> - -<dt><i>node</i> (ast.With)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_Yield" ID="BugBearVisitor.visit_Yield"></a> -<h4>BugBearVisitor.visit_Yield</h4> -<b>visit_Yield</b>(<i>node</i>) -<p> - Public method to handle 'Yield' nodes. -</p> - -<dl> - -<dt><i>node</i> (ast.Yield)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="BugBearVisitor.visit_YieldFrom" ID="BugBearVisitor.visit_YieldFrom"></a> -<h4>BugBearVisitor.visit_YieldFrom</h4> -<b>visit_YieldFrom</b>(<i>node</i>) -<p> - Public method to handle 'YieldFrom' nodes. -</p> - -<dl> - -<dt><i>node</i> (ast.YieldFrom)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="DateTimeVisitor" ID="DateTimeVisitor"></a> -<h2>DateTimeVisitor</h2> -<p> - Class implementing a node visitor to check datetime function calls. -</p> -<p> - Note: This class is modeled after flake8_datetimez checker. -</p> - -<h3>Derived from</h3> -ast.NodeVisitor -<h3>Class Attributes</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Class Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Methods</h3> -<table> -<tr> -<td><a href="#DateTimeVisitor.__init__">DateTimeVisitor</a></td> -<td>Constructor</td> -</tr> -<tr> -<td><a href="#DateTimeVisitor.__getFromKeywords">__getFromKeywords</a></td> -<td>Private method to get a keyword node given its name.</td> -</tr> -<tr> -<td><a href="#DateTimeVisitor.visit_Call">visit_Call</a></td> -<td>Public method to handle a function call.</td> -</tr> -</table> - -<h3>Static Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - - -<a NAME="DateTimeVisitor.__init__" ID="DateTimeVisitor.__init__"></a> -<h4>DateTimeVisitor (Constructor)</h4> -<b>DateTimeVisitor</b>(<i></i>) -<p> - Constructor -</p> - -<a NAME="DateTimeVisitor.__getFromKeywords" ID="DateTimeVisitor.__getFromKeywords"></a> -<h4>DateTimeVisitor.__getFromKeywords</h4> -<b>__getFromKeywords</b>(<i>keywords, name</i>) -<p> - Private method to get a keyword node given its name. -</p> - -<dl> - -<dt><i>keywords</i> (list of ast.AST)</dt> -<dd> -list of keyword argument nodes -</dd> -<dt><i>name</i> (str)</dt> -<dd> -name of the keyword node -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -keyword node -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -ast.AST -</dd> -</dl> -<a NAME="DateTimeVisitor.visit_Call" ID="DateTimeVisitor.visit_Call"></a> -<h4>DateTimeVisitor.visit_Call</h4> -<b>visit_Call</b>(<i>node</i>) -<p> - Public method to handle a function call. -</p> -<p> - Every datetime related function call is check for use of the naive - variant (i.e. use without TZ info). -</p> - -<dl> - -<dt><i>node</i> (ast.Call)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="DefaultMatchCaseVisitor" ID="DefaultMatchCaseVisitor"></a> -<h2>DefaultMatchCaseVisitor</h2> -<p> - Class implementing a node visitor to check default match cases. -</p> -<p> - Note: This class is modeled after flake8-spm v0.0.1. -</p> - -<h3>Derived from</h3> -ast.NodeVisitor -<h3>Class Attributes</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Class Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Methods</h3> -<table> -<tr> -<td><a href="#DefaultMatchCaseVisitor.__init__">DefaultMatchCaseVisitor</a></td> -<td>Constructor</td> -</tr> -<tr> -<td><a href="#DefaultMatchCaseVisitor.__badNodes">__badNodes</a></td> -<td>Private method to yield bad match nodes.</td> -</tr> -<tr> -<td><a href="#DefaultMatchCaseVisitor.__emptyMatchDefault">__emptyMatchDefault</a></td> -<td>Private method to check for an empty default match case.</td> -</tr> -<tr> -<td><a href="#DefaultMatchCaseVisitor.__findBadNode">__findBadNode</a></td> -<td>Private method returning a reference to the bad node of a case node.</td> -</tr> -<tr> -<td><a href="#DefaultMatchCaseVisitor.__lastStatementDoesNotRaise">__lastStatementDoesNotRaise</a></td> -<td>Private method to check that the last case statement does not raise an exception.</td> -</tr> -<tr> -<td><a href="#DefaultMatchCaseVisitor.__returnPrecedesExceptionRaising">__returnPrecedesExceptionRaising</a></td> -<td>Private method to check that no return precedes an exception raising.</td> -</tr> -<tr> -<td><a href="#DefaultMatchCaseVisitor.visit_Match">visit_Match</a></td> -<td>Public method to handle Match nodes.</td> -</tr> -</table> - -<h3>Static Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - - -<a NAME="DefaultMatchCaseVisitor.__init__" ID="DefaultMatchCaseVisitor.__init__"></a> -<h4>DefaultMatchCaseVisitor (Constructor)</h4> -<b>DefaultMatchCaseVisitor</b>(<i></i>) -<p> - Constructor -</p> - -<a NAME="DefaultMatchCaseVisitor.__badNodes" ID="DefaultMatchCaseVisitor.__badNodes"></a> -<h4>DefaultMatchCaseVisitor.__badNodes</h4> -<b>__badNodes</b>(<i>node</i>) -<p> - Private method to yield bad match nodes. -</p> - -<dl> - -<dt><i>node</i> (ast.Match)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<dl> -<dt>Yield:</dt> -<dd> -tuple containing a reference to bad match case node and the corresponding - issue code -</dd> -</dl> -<dl> -<dt>Yield Type:</dt> -<dd> -tyuple of (ast.AST, str) -</dd> -</dl> -<a NAME="DefaultMatchCaseVisitor.__emptyMatchDefault" ID="DefaultMatchCaseVisitor.__emptyMatchDefault"></a> -<h4>DefaultMatchCaseVisitor.__emptyMatchDefault</h4> -<b>__emptyMatchDefault</b>(<i>case</i>) -<p> - Private method to check for an empty default match case. -</p> - -<dl> - -<dt><i>case</i> (ast.match_case)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -flag indicating an empty default match case -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<a NAME="DefaultMatchCaseVisitor.__findBadNode" ID="DefaultMatchCaseVisitor.__findBadNode"></a> -<h4>DefaultMatchCaseVisitor.__findBadNode</h4> -<b>__findBadNode</b>(<i>case</i>) -<p> - Private method returning a reference to the bad node of a case node. -</p> - -<dl> - -<dt><i>case</i> (ast.match_case)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -reference to the bad node -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -ast.AST -</dd> -</dl> -<a NAME="DefaultMatchCaseVisitor.__lastStatementDoesNotRaise" ID="DefaultMatchCaseVisitor.__lastStatementDoesNotRaise"></a> -<h4>DefaultMatchCaseVisitor.__lastStatementDoesNotRaise</h4> -<b>__lastStatementDoesNotRaise</b>(<i>case</i>) -<p> - Private method to check that the last case statement does not raise an - exception. -</p> - -<dl> - -<dt><i>case</i> (ast.match_case)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -flag indicating that the last case statement does not raise an - exception -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<a NAME="DefaultMatchCaseVisitor.__returnPrecedesExceptionRaising" ID="DefaultMatchCaseVisitor.__returnPrecedesExceptionRaising"></a> -<h4>DefaultMatchCaseVisitor.__returnPrecedesExceptionRaising</h4> -<b>__returnPrecedesExceptionRaising</b>(<i>case</i>) -<p> - Private method to check that no return precedes an exception raising. -</p> - -<dl> - -<dt><i>case</i> (ast.match_case)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -flag indicating that a return precedes an exception raising -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<a NAME="DefaultMatchCaseVisitor.visit_Match" ID="DefaultMatchCaseVisitor.visit_Match"></a> -<h4>DefaultMatchCaseVisitor.visit_Match</h4> -<b>visit_Match</b>(<i>node</i>) -<p> - Public method to handle Match nodes. -</p> - -<dl> - -<dt><i>node</i> (ast.Match)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="ExceptBaseExceptionVisitor" ID="ExceptBaseExceptionVisitor"></a> -<h2>ExceptBaseExceptionVisitor</h2> -<p> - Class to determine, if a 'BaseException' is re-raised. -</p> - -<h3>Derived from</h3> -ast.NodeVisitor -<h3>Class Attributes</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Class Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Methods</h3> -<table> -<tr> -<td><a href="#ExceptBaseExceptionVisitor.__init__">ExceptBaseExceptionVisitor</a></td> -<td>Constructor</td> -</tr> -<tr> -<td><a href="#ExceptBaseExceptionVisitor.reRaised">reRaised</a></td> -<td>Public method to check, if the exception is re-raised.</td> -</tr> -<tr> -<td><a href="#ExceptBaseExceptionVisitor.visit_ExceptHandler">visit_ExceptHandler</a></td> -<td>Public method to handle 'ExceptHandler' nodes.</td> -</tr> -<tr> -<td><a href="#ExceptBaseExceptionVisitor.visit_Raise">visit_Raise</a></td> -<td>Public method to handle 'Raise' nodes.</td> -</tr> -</table> - -<h3>Static Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - - -<a NAME="ExceptBaseExceptionVisitor.__init__" ID="ExceptBaseExceptionVisitor.__init__"></a> -<h4>ExceptBaseExceptionVisitor (Constructor)</h4> -<b>ExceptBaseExceptionVisitor</b>(<i>exceptNode</i>) -<p> - Constructor -</p> - -<dl> - -<dt><i>exceptNode</i> (ast.ExceptHandler)</dt> -<dd> -exception node to be inspected -</dd> -</dl> -<a NAME="ExceptBaseExceptionVisitor.reRaised" ID="ExceptBaseExceptionVisitor.reRaised"></a> -<h4>ExceptBaseExceptionVisitor.reRaised</h4> -<b>reRaised</b>(<i></i>) -<p> - Public method to check, if the exception is re-raised. -</p> - -<dl> -<dt>Return:</dt> -<dd> -flag indicating a re-raised exception -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<a NAME="ExceptBaseExceptionVisitor.visit_ExceptHandler" ID="ExceptBaseExceptionVisitor.visit_ExceptHandler"></a> -<h4>ExceptBaseExceptionVisitor.visit_ExceptHandler</h4> -<b>visit_ExceptHandler</b>(<i>node: ast.ExceptHandler</i>) -<p> - Public method to handle 'ExceptHandler' nodes. -</p> - -<dl> - -<dt><i>node</i> (ast.ExceptHandler)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="ExceptBaseExceptionVisitor.visit_Raise" ID="ExceptBaseExceptionVisitor.visit_Raise"></a> -<h4>ExceptBaseExceptionVisitor.visit_Raise</h4> -<b>visit_Raise</b>(<i>node</i>) -<p> - Public method to handle 'Raise' nodes. -</p> -<p> - If we find a corresponding `raise` or `raise e` where e was from - `except BaseException as e:` then we mark re_raised as True and can - stop scanning. -</p> - -<dl> - -<dt><i>node</i> (ast.Raise)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="FunctionDefDefaultsVisitor" ID="FunctionDefDefaultsVisitor"></a> -<h2>FunctionDefDefaultsVisitor</h2> -<p> - Class used by M506, M508 and M539. -</p> - -<h3>Derived from</h3> -ast.NodeVisitor -<h3>Class Attributes</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Class Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Methods</h3> -<table> -<tr> -<td><a href="#FunctionDefDefaultsVisitor.__init__">FunctionDefDefaultsVisitor</a></td> -<td>Constructor</td> -</tr> -<tr> -<td><a href="#FunctionDefDefaultsVisitor.__visitMutableLiteralOrComprehension">__visitMutableLiteralOrComprehension</a></td> -<td>Private method to flag mutable literals and comprehensions.</td> -</tr> -<tr> -<td><a href="#FunctionDefDefaultsVisitor.visit">visit</a></td> -<td>Public method to traverse an AST node or a list of AST nodes.</td> -</tr> -<tr> -<td><a href="#FunctionDefDefaultsVisitor.visit_Call">visit_Call</a></td> -<td>Public method to process Call nodes.</td> -</tr> -<tr> -<td><a href="#FunctionDefDefaultsVisitor.visit_Lambda">visit_Lambda</a></td> -<td>Public method to process Lambda nodes.</td> -</tr> -</table> - -<h3>Static Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - - -<a NAME="FunctionDefDefaultsVisitor.__init__" ID="FunctionDefDefaultsVisitor.__init__"></a> -<h4>FunctionDefDefaultsVisitor (Constructor)</h4> -<b>FunctionDefDefaultsVisitor</b>(<i>errorCodeCalls, errorCodeLiterals, </i>) -<p> - Constructor -</p> - -<dl> - -<dt><i>errorCodeCalls</i> (str)</dt> -<dd> -error code for ast.Call nodes -</dd> -<dt><i>errorCodeLiterals</i> (str)</dt> -<dd> -error code for literal nodes -</dd> -</dl> -<a NAME="FunctionDefDefaultsVisitor.__visitMutableLiteralOrComprehension" ID="FunctionDefDefaultsVisitor.__visitMutableLiteralOrComprehension"></a> -<h4>FunctionDefDefaultsVisitor.__visitMutableLiteralOrComprehension</h4> -<b>__visitMutableLiteralOrComprehension</b>(<i>node</i>) -<p> - Private method to flag mutable literals and comprehensions. -</p> - -<dl> - -<dt><i>node</i> (ast.Dict, ast.List, ast.Set, ast.ListComp, ast.DictComp or ast.SetComp)</dt> -<dd> -AST node to be processed -</dd> -</dl> -<a NAME="FunctionDefDefaultsVisitor.visit" ID="FunctionDefDefaultsVisitor.visit"></a> -<h4>FunctionDefDefaultsVisitor.visit</h4> -<b>visit</b>(<i>node</i>) -<p> - Public method to traverse an AST node or a list of AST nodes. -</p> -<p> - This is an extended method that can also handle a list of AST nodes. -</p> - -<dl> - -<dt><i>node</i> (ast.AST or list of ast.AST)</dt> -<dd> -AST node or list of AST nodes to be processed -</dd> -</dl> -<a NAME="FunctionDefDefaultsVisitor.visit_Call" ID="FunctionDefDefaultsVisitor.visit_Call"></a> -<h4>FunctionDefDefaultsVisitor.visit_Call</h4> -<b>visit_Call</b>(<i>node</i>) -<p> - Public method to process Call nodes. -</p> - -<dl> - -<dt><i>node</i> (ast.Call)</dt> -<dd> -AST node to be processed -</dd> -</dl> -<a NAME="FunctionDefDefaultsVisitor.visit_Lambda" ID="FunctionDefDefaultsVisitor.visit_Lambda"></a> -<h4>FunctionDefDefaultsVisitor.visit_Lambda</h4> -<b>visit_Lambda</b>(<i>node</i>) -<p> - Public method to process Lambda nodes. -</p> - -<dl> - -<dt><i>node</i> (ast.Lambda)</dt> -<dd> -AST node to be processed -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="M520NameFinder" ID="M520NameFinder"></a> -<h2>M520NameFinder</h2> -<p> - Class to extract a name out of a tree of nodes ignoring names defined within the - local scope of a comprehension. -</p> - -<h3>Derived from</h3> -NameFinder -<h3>Class Attributes</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Class Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Methods</h3> -<table> -<tr> -<td><a href="#M520NameFinder.visit_DictComp">visit_DictComp</a></td> -<td>Public method to handle a dictionary comprehension.</td> -</tr> -<tr> -<td><a href="#M520NameFinder.visit_GeneratorExp">visit_GeneratorExp</a></td> -<td>Public method to handle a generator expressions.</td> -</tr> -<tr> -<td><a href="#M520NameFinder.visit_Lambda">visit_Lambda</a></td> -<td>Public method to handle a Lambda function.</td> -</tr> -<tr> -<td><a href="#M520NameFinder.visit_ListComp">visit_ListComp</a></td> -<td>Public method to handle a list comprehension.</td> -</tr> -<tr> -<td><a href="#M520NameFinder.visit_comprehension">visit_comprehension</a></td> -<td>Public method to handle the 'for' of a comprehension.</td> -</tr> -</table> - -<h3>Static Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - - -<a NAME="M520NameFinder.visit_DictComp" ID="M520NameFinder.visit_DictComp"></a> -<h4>M520NameFinder.visit_DictComp</h4> -<b>visit_DictComp</b>(<i>node</i>) -<p> - Public method to handle a dictionary comprehension. -</p> - -<dl> - -<dt><i>node</i> (TYPE)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="M520NameFinder.visit_GeneratorExp" ID="M520NameFinder.visit_GeneratorExp"></a> -<h4>M520NameFinder.visit_GeneratorExp</h4> -<b>visit_GeneratorExp</b>(<i>node</i>) -<p> - Public method to handle a generator expressions. -</p> - -<dl> - -<dt><i>node</i> (ast.GeneratorExp)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="M520NameFinder.visit_Lambda" ID="M520NameFinder.visit_Lambda"></a> -<h4>M520NameFinder.visit_Lambda</h4> -<b>visit_Lambda</b>(<i>node</i>) -<p> - Public method to handle a Lambda function. -</p> - -<dl> - -<dt><i>node</i> (ast.Lambda)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="M520NameFinder.visit_ListComp" ID="M520NameFinder.visit_ListComp"></a> -<h4>M520NameFinder.visit_ListComp</h4> -<b>visit_ListComp</b>(<i>node</i>) -<p> - Public method to handle a list comprehension. -</p> - -<dl> - -<dt><i>node</i> (TYPE)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="M520NameFinder.visit_comprehension" ID="M520NameFinder.visit_comprehension"></a> -<h4>M520NameFinder.visit_comprehension</h4> -<b>visit_comprehension</b>(<i>node</i>) -<p> - Public method to handle the 'for' of a comprehension. -</p> - -<dl> - -<dt><i>node</i> (ast.comprehension)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="M540CaughtException" ID="M540CaughtException"></a> -<h2>M540CaughtException</h2> -<p> - Class to hold the data for a caught exception. -</p> - -<h3>Derived from</h3> -None -<h3>Class Attributes</h3> -<table> -<tr><td>hasNote</td></tr> -<tr><td>name</td></tr> -</table> - -<h3>Class Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Static Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - - -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="M541UnhandledKeyType" ID="M541UnhandledKeyType"></a> -<h2>M541UnhandledKeyType</h2> -<p> - Class to hold a dictionary key of a type that we do not check for duplicates. -</p> - -<h3>Derived from</h3> -None -<h3>Class Attributes</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Class Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Static Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - - -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="M541VariableKeyType" ID="M541VariableKeyType"></a> -<h2>M541VariableKeyType</h2> -<p> - Class to hold the name of a variable key type. -</p> - -<h3>Derived from</h3> -None -<h3>Class Attributes</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Class Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Methods</h3> -<table> -<tr> -<td><a href="#M541VariableKeyType.__init__">M541VariableKeyType</a></td> -<td>Constructor</td> -</tr> -</table> - -<h3>Static Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - - -<a NAME="M541VariableKeyType.__init__" ID="M541VariableKeyType.__init__"></a> -<h4>M541VariableKeyType (Constructor)</h4> -<b>M541VariableKeyType</b>(<i>name</i>) -<p> - Constructor -</p> - -<dl> - -<dt><i>name</i> (str)</dt> -<dd> -name of the variable key type -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="M569Checker" ID="M569Checker"></a> -<h2>M569Checker</h2> -<p> - Class traversing a 'for' loop body to check for modifications to a loop's - mutable iterable. -</p> - -<h3>Derived from</h3> -ast.NodeVisitor -<h3>Class Attributes</h3> -<table> -<tr><td>MUTATING_FUNCTIONS</td></tr> -</table> - -<h3>Class Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Methods</h3> -<table> -<tr> -<td><a href="#M569Checker.__init__">M569Checker</a></td> -<td>Constructor</td> -</tr> -<tr> -<td><a href="#M569Checker.visit">visit</a></td> -<td>Public method to inspect an ast node.</td> -</tr> -<tr> -<td><a href="#M569Checker.visit_Call">visit_Call</a></td> -<td>Public method handling 'Call' nodes.</td> -</tr> -<tr> -<td><a href="#M569Checker.visit_Delete">visit_Delete</a></td> -<td>Public method handling 'Delete' nodes.</td> -</tr> -</table> - -<h3>Static Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - - -<a NAME="M569Checker.__init__" ID="M569Checker.__init__"></a> -<h4>M569Checker (Constructor)</h4> -<b>M569Checker</b>(<i>name, bugbear</i>) -<p> - Constructor -</p> - -<dl> - -<dt><i>name</i> (str)</dt> -<dd> -name of the iterator -</dd> -<dt><i>bugbear</i> (BugBearVisitor)</dt> -<dd> -reference to the bugbear visitor -</dd> -</dl> -<a NAME="M569Checker.visit" ID="M569Checker.visit"></a> -<h4>M569Checker.visit</h4> -<b>visit</b>(<i>node</i>) -<p> - Public method to inspect an ast node. -</p> -<p> - Like super-visit but supports iteration over lists. -</p> - -<dl> - -<dt><i>node</i> (TYPE)</dt> -<dd> -AST node to be traversed -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -reference to the last processed node -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -ast.Node -</dd> -</dl> -<a NAME="M569Checker.visit_Call" ID="M569Checker.visit_Call"></a> -<h4>M569Checker.visit_Call</h4> -<b>visit_Call</b>(<i>node</i>) -<p> - Public method handling 'Call' nodes. -</p> - -<dl> - -<dt><i>node</i> (ast.Call)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="M569Checker.visit_Delete" ID="M569Checker.visit_Delete"></a> -<h4>M569Checker.visit_Delete</h4> -<b>visit_Delete</b>(<i>node</i>) -<p> - Public method handling 'Delete' nodes. -</p> - -<dl> - -<dt><i>node</i> (ast.Delete)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> <a NAME="MiscellaneousChecker" ID="MiscellaneousChecker"></a> <h2>MiscellaneousChecker</h2> <p> @@ -2681,10 +41,11 @@ </p> <h3>Derived from</h3> -None +CodeStyleTopicChecker <h3>Class Attributes</h3> <table> <tr><td>BuiltinsWhiteList</td></tr> +<tr><td>Category</td></tr> <tr><td>Codes</td></tr> <tr><td>FormatFieldRegex</td></tr> <tr><td>Formatter</td></tr> @@ -2790,10 +151,6 @@ <td>Private function to test, if the node should be checked.</td> </tr> <tr> -<td><a href="#MiscellaneousChecker.__error">__error</a></td> -<td>Private method to record an issue.</td> -</tr> -<tr> <td><a href="#MiscellaneousChecker.__getCoding">__getCoding</a></td> <td>Private method to get the defined coding of the source.</td> </tr> @@ -2802,17 +159,9 @@ <td>Private method to extract the format field information.</td> </tr> <tr> -<td><a href="#MiscellaneousChecker.__ignoreCode">__ignoreCode</a></td> -<td>Private method to check if the message code should be ignored.</td> -</tr> -<tr> <td><a href="#MiscellaneousChecker.__isImplicitStringConcat">__isImplicitStringConcat</a></td> <td>Private method to check, if the given strings indicate an implicit string concatenation.</td> </tr> -<tr> -<td><a href="#MiscellaneousChecker.run">run</a></td> -<td>Public method to check the given source against miscellaneous conditions.</td> -</tr> </table> <h3>Static Methods</h3> @@ -3041,32 +390,6 @@ bool </dd> </dl> -<a NAME="MiscellaneousChecker.__error" ID="MiscellaneousChecker.__error"></a> -<h4>MiscellaneousChecker.__error</h4> -<b>__error</b>(<i>lineNumber, offset, code, *args</i>) -<p> - Private method to record an issue. -</p> - -<dl> - -<dt><i>lineNumber</i> (int)</dt> -<dd> -line number of the issue -</dd> -<dt><i>offset</i> (int)</dt> -<dd> -position within line of the issue -</dd> -<dt><i>code</i> (str)</dt> -<dd> -message code -</dd> -<dt><i>args</i> (list)</dt> -<dd> -arguments for the message -</dd> -</dl> <a NAME="MiscellaneousChecker.__getCoding" ID="MiscellaneousChecker.__getCoding"></a> <h4>MiscellaneousChecker.__getCoding</h4> <b>__getCoding</b>(<i></i>) @@ -3113,32 +436,6 @@ tuple of set of str, bool, bool </dd> </dl> -<a NAME="MiscellaneousChecker.__ignoreCode" ID="MiscellaneousChecker.__ignoreCode"></a> -<h4>MiscellaneousChecker.__ignoreCode</h4> -<b>__ignoreCode</b>(<i>code</i>) -<p> - Private method to check if the message code should be ignored. -</p> - -<dl> - -<dt><i>code</i> (str)</dt> -<dd> -message code to check for -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -flag indicating to ignore the given code -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> <a NAME="MiscellaneousChecker.__isImplicitStringConcat" ID="MiscellaneousChecker.__isImplicitStringConcat"></a> <h4>MiscellaneousChecker.__isImplicitStringConcat</h4> <b>__isImplicitStringConcat</b>(<i>first, second</i>) @@ -3170,1196 +467,6 @@ bool </dd> </dl> -<a NAME="MiscellaneousChecker.run" ID="MiscellaneousChecker.run"></a> -<h4>MiscellaneousChecker.run</h4> -<b>run</b>(<i></i>) -<p> - Public method to check the given source against miscellaneous - conditions. -</p> - -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="NameFinder" ID="NameFinder"></a> -<h2>NameFinder</h2> -<p> - Class to extract a name out of a tree of nodes. -</p> - -<h3>Derived from</h3> -ast.NodeVisitor -<h3>Class Attributes</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Class Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Methods</h3> -<table> -<tr> -<td><a href="#NameFinder.__init__">NameFinder</a></td> -<td>Constructor</td> -</tr> -<tr> -<td><a href="#NameFinder.getNames">getNames</a></td> -<td>Public method to return the extracted names and Name nodes.</td> -</tr> -<tr> -<td><a href="#NameFinder.visit">visit</a></td> -<td>Public method to traverse a given AST node.</td> -</tr> -<tr> -<td><a href="#NameFinder.visit_Name">visit_Name</a></td> -<td>Public method to handle 'Name' nodes.</td> -</tr> -</table> - -<h3>Static Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - - -<a NAME="NameFinder.__init__" ID="NameFinder.__init__"></a> -<h4>NameFinder (Constructor)</h4> -<b>NameFinder</b>(<i></i>) -<p> - Constructor -</p> - -<a NAME="NameFinder.getNames" ID="NameFinder.getNames"></a> -<h4>NameFinder.getNames</h4> -<b>getNames</b>(<i></i>) -<p> - Public method to return the extracted names and Name nodes. -</p> - -<dl> -<dt>Return:</dt> -<dd> -dictionary containing the names as keys and the list of nodes -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -dict -</dd> -</dl> -<a NAME="NameFinder.visit" ID="NameFinder.visit"></a> -<h4>NameFinder.visit</h4> -<b>visit</b>(<i>node</i>) -<p> - Public method to traverse a given AST node. -</p> - -<dl> - -<dt><i>node</i> (ast.Node)</dt> -<dd> -AST node to be traversed -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -reference to the last processed node -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -ast.Node -</dd> -</dl> -<a NAME="NameFinder.visit_Name" ID="NameFinder.visit_Name"></a> -<h4>NameFinder.visit_Name</h4> -<b>visit_Name</b>(<i>node</i>) -<p> - Public method to handle 'Name' nodes. -</p> - -<dl> - -<dt><i>node</i> (ast.Name)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="NamedExprFinder" ID="NamedExprFinder"></a> -<h2>NamedExprFinder</h2> -<p> - Class to extract names defined through an ast.NamedExpr. -</p> - -<h3>Derived from</h3> -ast.NodeVisitor -<h3>Class Attributes</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Class Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Methods</h3> -<table> -<tr> -<td><a href="#NamedExprFinder.__init__">NamedExprFinder</a></td> -<td>Constructor</td> -</tr> -<tr> -<td><a href="#NamedExprFinder.getNames">getNames</a></td> -<td>Public method to return the extracted names and Name nodes.</td> -</tr> -<tr> -<td><a href="#NamedExprFinder.visit">visit</a></td> -<td>Public method to traverse a given AST node.</td> -</tr> -<tr> -<td><a href="#NamedExprFinder.visit_NamedExpr">visit_NamedExpr</a></td> -<td>Public method handling 'NamedExpr' nodes.</td> -</tr> -</table> - -<h3>Static Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - - -<a NAME="NamedExprFinder.__init__" ID="NamedExprFinder.__init__"></a> -<h4>NamedExprFinder (Constructor)</h4> -<b>NamedExprFinder</b>(<i></i>) -<p> - Constructor -</p> - -<a NAME="NamedExprFinder.getNames" ID="NamedExprFinder.getNames"></a> -<h4>NamedExprFinder.getNames</h4> -<b>getNames</b>(<i></i>) -<p> - Public method to return the extracted names and Name nodes. -</p> - -<dl> -<dt>Return:</dt> -<dd> -dictionary containing the names as keys and the list of nodes -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -dict -</dd> -</dl> -<a NAME="NamedExprFinder.visit" ID="NamedExprFinder.visit"></a> -<h4>NamedExprFinder.visit</h4> -<b>visit</b>(<i>node</i>) -<p> - Public method to traverse a given AST node. -</p> -<p> - Like super-visit but supports iteration over lists. -</p> - -<dl> - -<dt><i>node</i> (TYPE)</dt> -<dd> -AST node to be traversed -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -reference to the last processed node -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -ast.Node -</dd> -</dl> -<a NAME="NamedExprFinder.visit_NamedExpr" ID="NamedExprFinder.visit_NamedExpr"></a> -<h4>NamedExprFinder.visit_NamedExpr</h4> -<b>visit_NamedExpr</b>(<i>node: ast.NamedExpr</i>) -<p> - Public method handling 'NamedExpr' nodes. -</p> - -<dl> - -<dt><i>node</i> (ast.NamedExpr)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="ReturnVisitor" ID="ReturnVisitor"></a> -<h2>ReturnVisitor</h2> -<p> - Class implementing a node visitor to check return statements. -</p> - -<h3>Derived from</h3> -ast.NodeVisitor -<h3>Class Attributes</h3> -<table> -<tr><td>Assigns</td></tr> -<tr><td>Refs</td></tr> -<tr><td>Returns</td></tr> -</table> - -<h3>Class Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Methods</h3> -<table> -<tr> -<td><a href="#ReturnVisitor.__init__">ReturnVisitor</a></td> -<td>Constructor</td> -</tr> -<tr> -<td><a href="#ReturnVisitor.__checkFunction">__checkFunction</a></td> -<td>Private method to check a function definition node.</td> -</tr> -<tr> -<td><a href="#ReturnVisitor.__checkImplicitReturn">__checkImplicitReturn</a></td> -<td>Private method to check for an implicit return statement.</td> -</tr> -<tr> -<td><a href="#ReturnVisitor.__checkImplicitReturnValue">__checkImplicitReturnValue</a></td> -<td>Private method to check for implicit return values.</td> -</tr> -<tr> -<td><a href="#ReturnVisitor.__checkUnnecessaryAssign">__checkUnnecessaryAssign</a></td> -<td>Private method to check for an unnecessary assign statement.</td> -</tr> -<tr> -<td><a href="#ReturnVisitor.__checkUnnecessaryReturnNone">__checkUnnecessaryReturnNone</a></td> -<td>Private method to check for an unnecessary 'return None' statement.</td> -</tr> -<tr> -<td><a href="#ReturnVisitor.__hasRefsBeforeNextAssign">__hasRefsBeforeNextAssign</a></td> -<td>Private method to check for references before a following assign statement.</td> -</tr> -<tr> -<td><a href="#ReturnVisitor.__isFalse">__isFalse</a></td> -<td>Private method to check, if a node value is False.</td> -</tr> -<tr> -<td><a href="#ReturnVisitor.__isNone">__isNone</a></td> -<td>Private method to check, if a node value is None.</td> -</tr> -<tr> -<td><a href="#ReturnVisitor.__resultExists">__resultExists</a></td> -<td>Private method to check the existance of a return result.</td> -</tr> -<tr> -<td><a href="#ReturnVisitor.__visitAssignTarget">__visitAssignTarget</a></td> -<td>Private method to handle an assign target node.</td> -</tr> -<tr> -<td><a href="#ReturnVisitor.__visitLoop">__visitLoop</a></td> -<td>Private method to handle loop nodes.</td> -</tr> -<tr> -<td><a href="#ReturnVisitor.__visitWithStack">__visitWithStack</a></td> -<td>Private method to traverse a given function node using a stack.</td> -</tr> -<tr> -<td><a href="#ReturnVisitor.assigns">assigns</a></td> -<td>Public method to get the Assign nodes.</td> -</tr> -<tr> -<td><a href="#ReturnVisitor.refs">refs</a></td> -<td>Public method to get the References nodes.</td> -</tr> -<tr> -<td><a href="#ReturnVisitor.returns">returns</a></td> -<td>Public method to get the Return nodes.</td> -</tr> -<tr> -<td><a href="#ReturnVisitor.visit_Assign">visit_Assign</a></td> -<td>Public method to handle an assign node.</td> -</tr> -<tr> -<td><a href="#ReturnVisitor.visit_AsyncFor">visit_AsyncFor</a></td> -<td>Public method to handle an async for loop.</td> -</tr> -<tr> -<td><a href="#ReturnVisitor.visit_AsyncFunctionDef">visit_AsyncFunctionDef</a></td> -<td>Public method to handle a function definition.</td> -</tr> -<tr> -<td><a href="#ReturnVisitor.visit_For">visit_For</a></td> -<td>Public method to handle a for loop.</td> -</tr> -<tr> -<td><a href="#ReturnVisitor.visit_FunctionDef">visit_FunctionDef</a></td> -<td>Public method to handle a function definition.</td> -</tr> -<tr> -<td><a href="#ReturnVisitor.visit_Name">visit_Name</a></td> -<td>Public method to handle a name node.</td> -</tr> -<tr> -<td><a href="#ReturnVisitor.visit_Return">visit_Return</a></td> -<td>Public method to handle a return node.</td> -</tr> -<tr> -<td><a href="#ReturnVisitor.visit_While">visit_While</a></td> -<td>Public method to handle a while loop.</td> -</tr> -</table> - -<h3>Static Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - - -<a NAME="ReturnVisitor.__init__" ID="ReturnVisitor.__init__"></a> -<h4>ReturnVisitor (Constructor)</h4> -<b>ReturnVisitor</b>(<i></i>) -<p> - Constructor -</p> - -<a NAME="ReturnVisitor.__checkFunction" ID="ReturnVisitor.__checkFunction"></a> -<h4>ReturnVisitor.__checkFunction</h4> -<b>__checkFunction</b>(<i>node</i>) -<p> - Private method to check a function definition node. -</p> - -<dl> - -<dt><i>node</i> (ast.AsyncFunctionDef or ast.FunctionDef)</dt> -<dd> -reference to the node to check -</dd> -</dl> -<a NAME="ReturnVisitor.__checkImplicitReturn" ID="ReturnVisitor.__checkImplicitReturn"></a> -<h4>ReturnVisitor.__checkImplicitReturn</h4> -<b>__checkImplicitReturn</b>(<i>node</i>) -<p> - Private method to check for an implicit return statement. -</p> - -<dl> - -<dt><i>node</i> (ast.AST)</dt> -<dd> -reference to the node to check -</dd> -</dl> -<a NAME="ReturnVisitor.__checkImplicitReturnValue" ID="ReturnVisitor.__checkImplicitReturnValue"></a> -<h4>ReturnVisitor.__checkImplicitReturnValue</h4> -<b>__checkImplicitReturnValue</b>(<i></i>) -<p> - Private method to check for implicit return values. -</p> - -<a NAME="ReturnVisitor.__checkUnnecessaryAssign" ID="ReturnVisitor.__checkUnnecessaryAssign"></a> -<h4>ReturnVisitor.__checkUnnecessaryAssign</h4> -<b>__checkUnnecessaryAssign</b>(<i>node</i>) -<p> - Private method to check for an unnecessary assign statement. -</p> - -<dl> - -<dt><i>node</i> (ast.AST)</dt> -<dd> -reference to the node to check -</dd> -</dl> -<a NAME="ReturnVisitor.__checkUnnecessaryReturnNone" ID="ReturnVisitor.__checkUnnecessaryReturnNone"></a> -<h4>ReturnVisitor.__checkUnnecessaryReturnNone</h4> -<b>__checkUnnecessaryReturnNone</b>(<i></i>) -<p> - Private method to check for an unnecessary 'return None' statement. -</p> - -<a NAME="ReturnVisitor.__hasRefsBeforeNextAssign" ID="ReturnVisitor.__hasRefsBeforeNextAssign"></a> -<h4>ReturnVisitor.__hasRefsBeforeNextAssign</h4> -<b>__hasRefsBeforeNextAssign</b>(<i>varname, returnLineno</i>) -<p> - Private method to check for references before a following assign - statement. -</p> - -<dl> - -<dt><i>varname</i> (str)</dt> -<dd> -variable name to check for -</dd> -<dt><i>returnLineno</i> (int)</dt> -<dd> -line number of the return statement -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -flag indicating the existence of references -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<a NAME="ReturnVisitor.__isFalse" ID="ReturnVisitor.__isFalse"></a> -<h4>ReturnVisitor.__isFalse</h4> -<b>__isFalse</b>(<i>node</i>) -<p> - Private method to check, if a node value is False. -</p> - -<dl> - -<dt><i>node</i> (ast.AST)</dt> -<dd> -reference to the node to check -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -flag indicating the node contains a False value -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<a NAME="ReturnVisitor.__isNone" ID="ReturnVisitor.__isNone"></a> -<h4>ReturnVisitor.__isNone</h4> -<b>__isNone</b>(<i>node</i>) -<p> - Private method to check, if a node value is None. -</p> - -<dl> - -<dt><i>node</i> (ast.AST)</dt> -<dd> -reference to the node to check -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -flag indicating the node contains a None value -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<a NAME="ReturnVisitor.__resultExists" ID="ReturnVisitor.__resultExists"></a> -<h4>ReturnVisitor.__resultExists</h4> -<b>__resultExists</b>(<i></i>) -<p> - Private method to check the existance of a return result. -</p> - -<dl> -<dt>Return:</dt> -<dd> -flag indicating the existence of a return result -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<a NAME="ReturnVisitor.__visitAssignTarget" ID="ReturnVisitor.__visitAssignTarget"></a> -<h4>ReturnVisitor.__visitAssignTarget</h4> -<b>__visitAssignTarget</b>(<i>node</i>) -<p> - Private method to handle an assign target node. -</p> - -<dl> - -<dt><i>node</i> (ast.AST)</dt> -<dd> -reference to the node to handle -</dd> -</dl> -<a NAME="ReturnVisitor.__visitLoop" ID="ReturnVisitor.__visitLoop"></a> -<h4>ReturnVisitor.__visitLoop</h4> -<b>__visitLoop</b>(<i>node</i>) -<p> - Private method to handle loop nodes. -</p> - -<dl> - -<dt><i>node</i> (ast.For, ast.AsyncFor or ast.While)</dt> -<dd> -reference to the loop node to handle -</dd> -</dl> -<a NAME="ReturnVisitor.__visitWithStack" ID="ReturnVisitor.__visitWithStack"></a> -<h4>ReturnVisitor.__visitWithStack</h4> -<b>__visitWithStack</b>(<i>node</i>) -<p> - Private method to traverse a given function node using a stack. -</p> - -<dl> - -<dt><i>node</i> (ast.FunctionDef or ast.AsyncFunctionDef)</dt> -<dd> -AST node to be traversed -</dd> -</dl> -<a NAME="ReturnVisitor.assigns" ID="ReturnVisitor.assigns"></a> -<h4>ReturnVisitor.assigns</h4> -<b>assigns</b>(<i></i>) -<p> - Public method to get the Assign nodes. -</p> - -<dl> -<dt>Return:</dt> -<dd> -dictionary containing the node name as key and line number - as value -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -dict -</dd> -</dl> -<a NAME="ReturnVisitor.refs" ID="ReturnVisitor.refs"></a> -<h4>ReturnVisitor.refs</h4> -<b>refs</b>(<i></i>) -<p> - Public method to get the References nodes. -</p> - -<dl> -<dt>Return:</dt> -<dd> -dictionary containing the node name as key and line number - as value -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -dict -</dd> -</dl> -<a NAME="ReturnVisitor.returns" ID="ReturnVisitor.returns"></a> -<h4>ReturnVisitor.returns</h4> -<b>returns</b>(<i></i>) -<p> - Public method to get the Return nodes. -</p> - -<dl> -<dt>Return:</dt> -<dd> -dictionary containing the node name as key and line number - as value -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -dict -</dd> -</dl> -<a NAME="ReturnVisitor.visit_Assign" ID="ReturnVisitor.visit_Assign"></a> -<h4>ReturnVisitor.visit_Assign</h4> -<b>visit_Assign</b>(<i>node</i>) -<p> - Public method to handle an assign node. -</p> - -<dl> - -<dt><i>node</i> (ast.Assign)</dt> -<dd> -reference to the node to handle -</dd> -</dl> -<a NAME="ReturnVisitor.visit_AsyncFor" ID="ReturnVisitor.visit_AsyncFor"></a> -<h4>ReturnVisitor.visit_AsyncFor</h4> -<b>visit_AsyncFor</b>(<i>node</i>) -<p> - Public method to handle an async for loop. -</p> - -<dl> - -<dt><i>node</i> (ast.AsyncFor)</dt> -<dd> -reference to the async for node to handle -</dd> -</dl> -<a NAME="ReturnVisitor.visit_AsyncFunctionDef" ID="ReturnVisitor.visit_AsyncFunctionDef"></a> -<h4>ReturnVisitor.visit_AsyncFunctionDef</h4> -<b>visit_AsyncFunctionDef</b>(<i>node</i>) -<p> - Public method to handle a function definition. -</p> - -<dl> - -<dt><i>node</i> (ast.AsyncFunctionDef)</dt> -<dd> -reference to the node to handle -</dd> -</dl> -<a NAME="ReturnVisitor.visit_For" ID="ReturnVisitor.visit_For"></a> -<h4>ReturnVisitor.visit_For</h4> -<b>visit_For</b>(<i>node</i>) -<p> - Public method to handle a for loop. -</p> - -<dl> - -<dt><i>node</i> (ast.For)</dt> -<dd> -reference to the for node to handle -</dd> -</dl> -<a NAME="ReturnVisitor.visit_FunctionDef" ID="ReturnVisitor.visit_FunctionDef"></a> -<h4>ReturnVisitor.visit_FunctionDef</h4> -<b>visit_FunctionDef</b>(<i>node</i>) -<p> - Public method to handle a function definition. -</p> - -<dl> - -<dt><i>node</i> (ast.FunctionDef)</dt> -<dd> -reference to the node to handle -</dd> -</dl> -<a NAME="ReturnVisitor.visit_Name" ID="ReturnVisitor.visit_Name"></a> -<h4>ReturnVisitor.visit_Name</h4> -<b>visit_Name</b>(<i>node</i>) -<p> - Public method to handle a name node. -</p> - -<dl> - -<dt><i>node</i> (ast.Name)</dt> -<dd> -reference to the node to handle -</dd> -</dl> -<a NAME="ReturnVisitor.visit_Return" ID="ReturnVisitor.visit_Return"></a> -<h4>ReturnVisitor.visit_Return</h4> -<b>visit_Return</b>(<i>node</i>) -<p> - Public method to handle a return node. -</p> - -<dl> - -<dt><i>node</i> (ast.Return)</dt> -<dd> -reference to the node to handle -</dd> -</dl> -<a NAME="ReturnVisitor.visit_While" ID="ReturnVisitor.visit_While"></a> -<h4>ReturnVisitor.visit_While</h4> -<b>visit_While</b>(<i>node</i>) -<p> - Public method to handle a while loop. -</p> - -<dl> - -<dt><i>node</i> (ast.While)</dt> -<dd> -reference to the while node to handle -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="SysVersionVisitor" ID="SysVersionVisitor"></a> -<h2>SysVersionVisitor</h2> -<p> - Class implementing a node visitor to check the use of sys.version and - sys.version_info. -</p> -<p> - Note: This class is modeled after flake8-2020 v1.8.1. -</p> - -<h3>Derived from</h3> -ast.NodeVisitor -<h3>Class Attributes</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Class Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Methods</h3> -<table> -<tr> -<td><a href="#SysVersionVisitor.__init__">SysVersionVisitor</a></td> -<td>Constructor</td> -</tr> -<tr> -<td><a href="#SysVersionVisitor.__isSys">__isSys</a></td> -<td>Private method to check for a reference to sys attribute.</td> -</tr> -<tr> -<td><a href="#SysVersionVisitor.__isSysVersionUpperSlice">__isSysVersionUpperSlice</a></td> -<td>Private method to check the upper slice of sys.version.</td> -</tr> -<tr> -<td><a href="#SysVersionVisitor.visit_Attribute">visit_Attribute</a></td> -<td>Public method to handle an attribute.</td> -</tr> -<tr> -<td><a href="#SysVersionVisitor.visit_Compare">visit_Compare</a></td> -<td>Public method to handle a comparison.</td> -</tr> -<tr> -<td><a href="#SysVersionVisitor.visit_ImportFrom">visit_ImportFrom</a></td> -<td>Public method to handle a from ...</td> -</tr> -<tr> -<td><a href="#SysVersionVisitor.visit_Name">visit_Name</a></td> -<td>Public method to handle an name.</td> -</tr> -<tr> -<td><a href="#SysVersionVisitor.visit_Subscript">visit_Subscript</a></td> -<td>Public method to handle a subscript.</td> -</tr> -</table> - -<h3>Static Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - - -<a NAME="SysVersionVisitor.__init__" ID="SysVersionVisitor.__init__"></a> -<h4>SysVersionVisitor (Constructor)</h4> -<b>SysVersionVisitor</b>(<i></i>) -<p> - Constructor -</p> - -<a NAME="SysVersionVisitor.__isSys" ID="SysVersionVisitor.__isSys"></a> -<h4>SysVersionVisitor.__isSys</h4> -<b>__isSys</b>(<i>attr, node</i>) -<p> - Private method to check for a reference to sys attribute. -</p> - -<dl> - -<dt><i>attr</i> (str)</dt> -<dd> -attribute name -</dd> -<dt><i>node</i> (ast.Node)</dt> -<dd> -reference to the node to be checked -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -flag indicating a match -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<a NAME="SysVersionVisitor.__isSysVersionUpperSlice" ID="SysVersionVisitor.__isSysVersionUpperSlice"></a> -<h4>SysVersionVisitor.__isSysVersionUpperSlice</h4> -<b>__isSysVersionUpperSlice</b>(<i>node, n</i>) -<p> - Private method to check the upper slice of sys.version. -</p> - -<dl> - -<dt><i>node</i> (ast.Node)</dt> -<dd> -reference to the node to be checked -</dd> -<dt><i>n</i> (int)</dt> -<dd> -slice value to check against -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -flag indicating a match -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<a NAME="SysVersionVisitor.visit_Attribute" ID="SysVersionVisitor.visit_Attribute"></a> -<h4>SysVersionVisitor.visit_Attribute</h4> -<b>visit_Attribute</b>(<i>node</i>) -<p> - Public method to handle an attribute. -</p> - -<dl> - -<dt><i>node</i> (ast.Attribute)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="SysVersionVisitor.visit_Compare" ID="SysVersionVisitor.visit_Compare"></a> -<h4>SysVersionVisitor.visit_Compare</h4> -<b>visit_Compare</b>(<i>node</i>) -<p> - Public method to handle a comparison. -</p> - -<dl> - -<dt><i>node</i> (ast.Compare)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="SysVersionVisitor.visit_ImportFrom" ID="SysVersionVisitor.visit_ImportFrom"></a> -<h4>SysVersionVisitor.visit_ImportFrom</h4> -<b>visit_ImportFrom</b>(<i>node</i>) -<p> - Public method to handle a from ... import ... statement. -</p> - -<dl> - -<dt><i>node</i> (ast.ImportFrom)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="SysVersionVisitor.visit_Name" ID="SysVersionVisitor.visit_Name"></a> -<h4>SysVersionVisitor.visit_Name</h4> -<b>visit_Name</b>(<i>node</i>) -<p> - Public method to handle an name. -</p> - -<dl> - -<dt><i>node</i> (ast.Name)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<a NAME="SysVersionVisitor.visit_Subscript" ID="SysVersionVisitor.visit_Subscript"></a> -<h4>SysVersionVisitor.visit_Subscript</h4> -<b>visit_Subscript</b>(<i>node</i>) -<p> - Public method to handle a subscript. -</p> - -<dl> - -<dt><i>node</i> (ast.Subscript)</dt> -<dd> -reference to the node to be processed -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="TextVisitor" ID="TextVisitor"></a> -<h2>TextVisitor</h2> -<p> - Class implementing a node visitor for bytes and str instances. -</p> -<p> - It tries to detect docstrings as string of the first expression of each - module, class or function. -</p> - -<h3>Derived from</h3> -ast.NodeVisitor -<h3>Class Attributes</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Class Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Methods</h3> -<table> -<tr> -<td><a href="#TextVisitor.__init__">TextVisitor</a></td> -<td>Constructor</td> -</tr> -<tr> -<td><a href="#TextVisitor.__addNode">__addNode</a></td> -<td>Private method to add a node to our list of nodes.</td> -</tr> -<tr> -<td><a href="#TextVisitor.__visitBody">__visitBody</a></td> -<td>Private method to traverse the body of the node manually.</td> -</tr> -<tr> -<td><a href="#TextVisitor.__visitDefinition">__visitDefinition</a></td> -<td>Private method handling class and function definitions.</td> -</tr> -<tr> -<td><a href="#TextVisitor.visit_AsyncFunctionDef">visit_AsyncFunctionDef</a></td> -<td>Public method to handle an asynchronous function definition.</td> -</tr> -<tr> -<td><a href="#TextVisitor.visit_Call">visit_Call</a></td> -<td>Public method to handle a function call.</td> -</tr> -<tr> -<td><a href="#TextVisitor.visit_ClassDef">visit_ClassDef</a></td> -<td>Public method to handle a class definition.</td> -</tr> -<tr> -<td><a href="#TextVisitor.visit_Constant">visit_Constant</a></td> -<td>Public method to handle constant nodes.</td> -</tr> -<tr> -<td><a href="#TextVisitor.visit_FunctionDef">visit_FunctionDef</a></td> -<td>Public method to handle a function definition.</td> -</tr> -<tr> -<td><a href="#TextVisitor.visit_Module">visit_Module</a></td> -<td>Public method to handle a module.</td> -</tr> -</table> - -<h3>Static Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - - -<a NAME="TextVisitor.__init__" ID="TextVisitor.__init__"></a> -<h4>TextVisitor (Constructor)</h4> -<b>TextVisitor</b>(<i></i>) -<p> - Constructor -</p> - -<a NAME="TextVisitor.__addNode" ID="TextVisitor.__addNode"></a> -<h4>TextVisitor.__addNode</h4> -<b>__addNode</b>(<i>node</i>) -<p> - Private method to add a node to our list of nodes. -</p> - -<dl> - -<dt><i>node</i> (ast.AST)</dt> -<dd> -reference to the node to add -</dd> -</dl> -<a NAME="TextVisitor.__visitBody" ID="TextVisitor.__visitBody"></a> -<h4>TextVisitor.__visitBody</h4> -<b>__visitBody</b>(<i>node</i>) -<p> - Private method to traverse the body of the node manually. -</p> -<p> - If the first node is an expression which contains a string or bytes it - marks that as a docstring. -</p> - -<dl> - -<dt><i>node</i> (ast.AST)</dt> -<dd> -reference to the node to traverse -</dd> -</dl> -<a NAME="TextVisitor.__visitDefinition" ID="TextVisitor.__visitDefinition"></a> -<h4>TextVisitor.__visitDefinition</h4> -<b>__visitDefinition</b>(<i>node</i>) -<p> - Private method handling class and function definitions. -</p> - -<dl> - -<dt><i>node</i> (ast.FunctionDef, ast.AsyncFunctionDef or ast.ClassDef)</dt> -<dd> -reference to the node to handle -</dd> -</dl> -<a NAME="TextVisitor.visit_AsyncFunctionDef" ID="TextVisitor.visit_AsyncFunctionDef"></a> -<h4>TextVisitor.visit_AsyncFunctionDef</h4> -<b>visit_AsyncFunctionDef</b>(<i>node</i>) -<p> - Public method to handle an asynchronous function definition. -</p> - -<dl> - -<dt><i>node</i> (ast.AsyncFunctionDef)</dt> -<dd> -reference to the node to handle -</dd> -</dl> -<a NAME="TextVisitor.visit_Call" ID="TextVisitor.visit_Call"></a> -<h4>TextVisitor.visit_Call</h4> -<b>visit_Call</b>(<i>node</i>) -<p> - Public method to handle a function call. -</p> - -<dl> - -<dt><i>node</i> (ast.Call)</dt> -<dd> -reference to the node to handle -</dd> -</dl> -<a NAME="TextVisitor.visit_ClassDef" ID="TextVisitor.visit_ClassDef"></a> -<h4>TextVisitor.visit_ClassDef</h4> -<b>visit_ClassDef</b>(<i>node</i>) -<p> - Public method to handle a class definition. -</p> - -<dl> - -<dt><i>node</i> (ast.ClassDef)</dt> -<dd> -reference to the node to handle -</dd> -</dl> -<a NAME="TextVisitor.visit_Constant" ID="TextVisitor.visit_Constant"></a> -<h4>TextVisitor.visit_Constant</h4> -<b>visit_Constant</b>(<i>node</i>) -<p> - Public method to handle constant nodes. -</p> - -<dl> - -<dt><i>node</i> (ast.Constant)</dt> -<dd> -reference to the bytes node -</dd> -</dl> -<a NAME="TextVisitor.visit_FunctionDef" ID="TextVisitor.visit_FunctionDef"></a> -<h4>TextVisitor.visit_FunctionDef</h4> -<b>visit_FunctionDef</b>(<i>node</i>) -<p> - Public method to handle a function definition. -</p> - -<dl> - -<dt><i>node</i> (ast.FunctionDef)</dt> -<dd> -reference to the node to handle -</dd> -</dl> -<a NAME="TextVisitor.visit_Module" ID="TextVisitor.visit_Module"></a> -<h4>TextVisitor.visit_Module</h4> -<b>visit_Module</b>(<i>node</i>) -<p> - Public method to handle a module. -</p> - -<dl> - -<dt><i>node</i> (ast.Module)</dt> -<dd> -reference to the node to handle -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="composeCallPath" ID="composeCallPath"></a> -<h2>composeCallPath</h2> -<b>composeCallPath</b>(<i>node</i>) -<p> - Generator function to assemble the call path of a given node. -</p> - -<dl> - -<dt><i>node</i> (ast.Node)</dt> -<dd> -node to assemble call path for -</dd> -</dl> -<dl> -<dt>Yield:</dt> -<dd> -call path components -</dd> -</dl> -<dl> -<dt>Yield Type:</dt> -<dd> -str -</dd> -</dl> <div align="right"><a href="#top">Up</a></div> <hr /> <hr />
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html Thu Feb 27 14:42:39 2025 +0100 @@ -0,0 +1,646 @@ +<!DOCTYPE html> +<html><head> +<title>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor</title> +<meta charset="UTF-8"> +<link rel="stylesheet" href="styles.css"> +</head> +<body> +<a NAME="top" ID="top"></a> +<h1>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor</h1> +<p> +Module implementing a node visitor to check return statements. +</p> + +<h3>Global Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Classes</h3> +<table> +<tr> +<td><a href="#ReturnVisitor">ReturnVisitor</a></td> +<td>Class implementing a node visitor to check return statements.</td> +</tr> +</table> + +<h3>Functions</h3> +<table> +<tr><td>None</td></tr> +</table> + +<hr /> +<hr /> +<a NAME="ReturnVisitor" ID="ReturnVisitor"></a> +<h2>ReturnVisitor</h2> +<p> + Class implementing a node visitor to check return statements. +</p> +<p> + Note 1: This class is modeled after flake8-return v1.2.0 checker without + checking for superfluous return. + Note 2: This class is a combination of the main visitor class and the various + mixin classes of of the above checker. +</p> + +<h3>Derived from</h3> +ast.NodeVisitor +<h3>Class Attributes</h3> +<table> +<tr><td>Assigns</td></tr> +<tr><td>Loops</td></tr> +<tr><td>Refs</td></tr> +<tr><td>Returns</td></tr> +<tr><td>Tries</td></tr> +</table> + +<h3>Class Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Methods</h3> +<table> +<tr> +<td><a href="#ReturnVisitor.__init__">ReturnVisitor</a></td> +<td>Constructor</td> +</tr> +<tr> +<td><a href="#ReturnVisitor.__checkFunction">__checkFunction</a></td> +<td>Private method to check a function definition node.</td> +</tr> +<tr> +<td><a href="#ReturnVisitor.__checkImplicitReturn">__checkImplicitReturn</a></td> +<td>Private method to check for an implicit return statement.</td> +</tr> +<tr> +<td><a href="#ReturnVisitor.__checkImplicitReturnValue">__checkImplicitReturnValue</a></td> +<td>Private method to check for implicit return values.</td> +</tr> +<tr> +<td><a href="#ReturnVisitor.__checkUnnecessaryAssign">__checkUnnecessaryAssign</a></td> +<td>Private method to check for an unnecessary assign statement.</td> +</tr> +<tr> +<td><a href="#ReturnVisitor.__checkUnnecessaryReturnNone">__checkUnnecessaryReturnNone</a></td> +<td>Private method to check for an unnecessary 'return None' statement.</td> +</tr> +<tr> +<td><a href="#ReturnVisitor.__hasRefsBeforeNextAssign">__hasRefsBeforeNextAssign</a></td> +<td>Private method to check for references before a following assign statement.</td> +</tr> +<tr> +<td><a href="#ReturnVisitor.__hasRefsOrAssignsWithinTryOrLoop">__hasRefsOrAssignsWithinTryOrLoop</a></td> +<td>Private method to check for references or assignments in exception handlers or loops.</td> +</tr> +<tr> +<td><a href="#ReturnVisitor.__isFalse">__isFalse</a></td> +<td>Private method to check, if a node value is False.</td> +</tr> +<tr> +<td><a href="#ReturnVisitor.__isNone">__isNone</a></td> +<td>Private method to check, if a node value is None.</td> +</tr> +<tr> +<td><a href="#ReturnVisitor.__resultExists">__resultExists</a></td> +<td>Private method to check the existance of a return result.</td> +</tr> +<tr> +<td><a href="#ReturnVisitor.__visitAssignTarget">__visitAssignTarget</a></td> +<td>Private method to handle an assign target node.</td> +</tr> +<tr> +<td><a href="#ReturnVisitor.__visitLoop">__visitLoop</a></td> +<td>Private method to handle loop nodes.</td> +</tr> +<tr> +<td><a href="#ReturnVisitor.__visitWithStack">__visitWithStack</a></td> +<td>Private method to traverse a given function node using a stack.</td> +</tr> +<tr> +<td><a href="#ReturnVisitor.assigns">assigns</a></td> +<td>Public method to get the Assign nodes.</td> +</tr> +<tr> +<td><a href="#ReturnVisitor.loops">loops</a></td> +<td>Public method to get the Loop nodes.</td> +</tr> +<tr> +<td><a href="#ReturnVisitor.refs">refs</a></td> +<td>Public method to get the References nodes.</td> +</tr> +<tr> +<td><a href="#ReturnVisitor.returns">returns</a></td> +<td>Public method to get the Return nodes.</td> +</tr> +<tr> +<td><a href="#ReturnVisitor.tries">tries</a></td> +<td>Public method to get the Try nodes.</td> +</tr> +<tr> +<td><a href="#ReturnVisitor.visit_Assign">visit_Assign</a></td> +<td>Public method to handle an assign node.</td> +</tr> +<tr> +<td><a href="#ReturnVisitor.visit_AsyncFor">visit_AsyncFor</a></td> +<td>Public method to handle an async for loop.</td> +</tr> +<tr> +<td><a href="#ReturnVisitor.visit_AsyncFunctionDef">visit_AsyncFunctionDef</a></td> +<td>Public method to handle a function definition.</td> +</tr> +<tr> +<td><a href="#ReturnVisitor.visit_For">visit_For</a></td> +<td>Public method to handle a for loop.</td> +</tr> +<tr> +<td><a href="#ReturnVisitor.visit_FunctionDef">visit_FunctionDef</a></td> +<td>Public method to handle a function definition.</td> +</tr> +<tr> +<td><a href="#ReturnVisitor.visit_Name">visit_Name</a></td> +<td>Public method to handle a name node.</td> +</tr> +<tr> +<td><a href="#ReturnVisitor.visit_Return">visit_Return</a></td> +<td>Public method to handle a return node.</td> +</tr> +<tr> +<td><a href="#ReturnVisitor.visit_Try">visit_Try</a></td> +<td>Public method to handle a try/except node.</td> +</tr> +<tr> +<td><a href="#ReturnVisitor.visit_While">visit_While</a></td> +<td>Public method to handle a while loop.</td> +</tr> +</table> + +<h3>Static Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + + +<a NAME="ReturnVisitor.__init__" ID="ReturnVisitor.__init__"></a> +<h4>ReturnVisitor (Constructor)</h4> +<b>ReturnVisitor</b>(<i></i>) +<p> + Constructor +</p> + +<a NAME="ReturnVisitor.__checkFunction" ID="ReturnVisitor.__checkFunction"></a> +<h4>ReturnVisitor.__checkFunction</h4> +<b>__checkFunction</b>(<i>node</i>) +<p> + Private method to check a function definition node. +</p> + +<dl> + +<dt><i>node</i> (ast.AsyncFunctionDef or ast.FunctionDef)</dt> +<dd> +reference to the node to check +</dd> +</dl> +<a NAME="ReturnVisitor.__checkImplicitReturn" ID="ReturnVisitor.__checkImplicitReturn"></a> +<h4>ReturnVisitor.__checkImplicitReturn</h4> +<b>__checkImplicitReturn</b>(<i>node</i>) +<p> + Private method to check for an implicit return statement. +</p> + +<dl> + +<dt><i>node</i> (ast.AST)</dt> +<dd> +reference to the node to check +</dd> +</dl> +<a NAME="ReturnVisitor.__checkImplicitReturnValue" ID="ReturnVisitor.__checkImplicitReturnValue"></a> +<h4>ReturnVisitor.__checkImplicitReturnValue</h4> +<b>__checkImplicitReturnValue</b>(<i></i>) +<p> + Private method to check for implicit return values. +</p> + +<a NAME="ReturnVisitor.__checkUnnecessaryAssign" ID="ReturnVisitor.__checkUnnecessaryAssign"></a> +<h4>ReturnVisitor.__checkUnnecessaryAssign</h4> +<b>__checkUnnecessaryAssign</b>(<i>node</i>) +<p> + Private method to check for an unnecessary assign statement. +</p> + +<dl> + +<dt><i>node</i> (ast.AST)</dt> +<dd> +reference to the node to check +</dd> +</dl> +<a NAME="ReturnVisitor.__checkUnnecessaryReturnNone" ID="ReturnVisitor.__checkUnnecessaryReturnNone"></a> +<h4>ReturnVisitor.__checkUnnecessaryReturnNone</h4> +<b>__checkUnnecessaryReturnNone</b>(<i></i>) +<p> + Private method to check for an unnecessary 'return None' statement. +</p> + +<a NAME="ReturnVisitor.__hasRefsBeforeNextAssign" ID="ReturnVisitor.__hasRefsBeforeNextAssign"></a> +<h4>ReturnVisitor.__hasRefsBeforeNextAssign</h4> +<b>__hasRefsBeforeNextAssign</b>(<i>varname, returnLineno</i>) +<p> + Private method to check for references before a following assign + statement. +</p> + +<dl> + +<dt><i>varname</i> (str)</dt> +<dd> +variable name to check for +</dd> +<dt><i>returnLineno</i> (int)</dt> +<dd> +line number of the return statement +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +flag indicating the existence of references +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<a NAME="ReturnVisitor.__hasRefsOrAssignsWithinTryOrLoop" ID="ReturnVisitor.__hasRefsOrAssignsWithinTryOrLoop"></a> +<h4>ReturnVisitor.__hasRefsOrAssignsWithinTryOrLoop</h4> +<b>__hasRefsOrAssignsWithinTryOrLoop</b>(<i>varname: str</i>) +<p> + Private method to check for references or assignments in exception handlers + or loops. +</p> + +<dl> + +<dt><i>varname</i> (str)</dt> +<dd> +name of the variable to check for +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +flag indicating a reference or assignment +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<a NAME="ReturnVisitor.__isFalse" ID="ReturnVisitor.__isFalse"></a> +<h4>ReturnVisitor.__isFalse</h4> +<b>__isFalse</b>(<i>node</i>) +<p> + Private method to check, if a node value is False. +</p> + +<dl> + +<dt><i>node</i> (ast.AST)</dt> +<dd> +reference to the node to check +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +flag indicating the node contains a False value +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<a NAME="ReturnVisitor.__isNone" ID="ReturnVisitor.__isNone"></a> +<h4>ReturnVisitor.__isNone</h4> +<b>__isNone</b>(<i>node</i>) +<p> + Private method to check, if a node value is None. +</p> + +<dl> + +<dt><i>node</i> (ast.AST)</dt> +<dd> +reference to the node to check +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +flag indicating the node contains a None value +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<a NAME="ReturnVisitor.__resultExists" ID="ReturnVisitor.__resultExists"></a> +<h4>ReturnVisitor.__resultExists</h4> +<b>__resultExists</b>(<i></i>) +<p> + Private method to check the existance of a return result. +</p> + +<dl> +<dt>Return:</dt> +<dd> +flag indicating the existence of a return result +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<a NAME="ReturnVisitor.__visitAssignTarget" ID="ReturnVisitor.__visitAssignTarget"></a> +<h4>ReturnVisitor.__visitAssignTarget</h4> +<b>__visitAssignTarget</b>(<i>node</i>) +<p> + Private method to handle an assign target node. +</p> + +<dl> + +<dt><i>node</i> (ast.AST)</dt> +<dd> +reference to the node to handle +</dd> +</dl> +<a NAME="ReturnVisitor.__visitLoop" ID="ReturnVisitor.__visitLoop"></a> +<h4>ReturnVisitor.__visitLoop</h4> +<b>__visitLoop</b>(<i>node</i>) +<p> + Private method to handle loop nodes. +</p> + +<dl> + +<dt><i>node</i> (ast.For, ast.AsyncFor or ast.While)</dt> +<dd> +reference to the loop node to handle +</dd> +</dl> +<a NAME="ReturnVisitor.__visitWithStack" ID="ReturnVisitor.__visitWithStack"></a> +<h4>ReturnVisitor.__visitWithStack</h4> +<b>__visitWithStack</b>(<i>node</i>) +<p> + Private method to traverse a given function node using a stack. +</p> + +<dl> + +<dt><i>node</i> (ast.FunctionDef or ast.AsyncFunctionDef)</dt> +<dd> +AST node to be traversed +</dd> +</dl> +<a NAME="ReturnVisitor.assigns" ID="ReturnVisitor.assigns"></a> +<h4>ReturnVisitor.assigns</h4> +<b>assigns</b>(<i></i>) +<p> + Public method to get the Assign nodes. +</p> + +<dl> +<dt>Return:</dt> +<dd> +dictionary containing the node name as key and line number + as value +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +dict +</dd> +</dl> +<a NAME="ReturnVisitor.loops" ID="ReturnVisitor.loops"></a> +<h4>ReturnVisitor.loops</h4> +<b>loops</b>(<i></i>) +<p> + Public method to get the Loop nodes. +</p> + +<dl> +<dt>Return:</dt> +<dd> +dictionary containing the node name as key and line number + as value +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +dict +</dd> +</dl> +<a NAME="ReturnVisitor.refs" ID="ReturnVisitor.refs"></a> +<h4>ReturnVisitor.refs</h4> +<b>refs</b>(<i></i>) +<p> + Public method to get the References nodes. +</p> + +<dl> +<dt>Return:</dt> +<dd> +dictionary containing the node name as key and line number + as value +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +dict +</dd> +</dl> +<a NAME="ReturnVisitor.returns" ID="ReturnVisitor.returns"></a> +<h4>ReturnVisitor.returns</h4> +<b>returns</b>(<i></i>) +<p> + Public method to get the Return nodes. +</p> + +<dl> +<dt>Return:</dt> +<dd> +dictionary containing the node name as key and line number + as value +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +dict +</dd> +</dl> +<a NAME="ReturnVisitor.tries" ID="ReturnVisitor.tries"></a> +<h4>ReturnVisitor.tries</h4> +<b>tries</b>(<i></i>) +<p> + Public method to get the Try nodes. +</p> + +<dl> +<dt>Return:</dt> +<dd> +dictionary containing the node name as key and line number + as value +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +dict +</dd> +</dl> +<a NAME="ReturnVisitor.visit_Assign" ID="ReturnVisitor.visit_Assign"></a> +<h4>ReturnVisitor.visit_Assign</h4> +<b>visit_Assign</b>(<i>node</i>) +<p> + Public method to handle an assign node. +</p> + +<dl> + +<dt><i>node</i> (ast.Assign)</dt> +<dd> +reference to the node to handle +</dd> +</dl> +<a NAME="ReturnVisitor.visit_AsyncFor" ID="ReturnVisitor.visit_AsyncFor"></a> +<h4>ReturnVisitor.visit_AsyncFor</h4> +<b>visit_AsyncFor</b>(<i>node</i>) +<p> + Public method to handle an async for loop. +</p> + +<dl> + +<dt><i>node</i> (ast.AsyncFor)</dt> +<dd> +reference to the async for node to handle +</dd> +</dl> +<a NAME="ReturnVisitor.visit_AsyncFunctionDef" ID="ReturnVisitor.visit_AsyncFunctionDef"></a> +<h4>ReturnVisitor.visit_AsyncFunctionDef</h4> +<b>visit_AsyncFunctionDef</b>(<i>node</i>) +<p> + Public method to handle a function definition. +</p> + +<dl> + +<dt><i>node</i> (ast.AsyncFunctionDef)</dt> +<dd> +reference to the node to handle +</dd> +</dl> +<a NAME="ReturnVisitor.visit_For" ID="ReturnVisitor.visit_For"></a> +<h4>ReturnVisitor.visit_For</h4> +<b>visit_For</b>(<i>node</i>) +<p> + Public method to handle a for loop. +</p> + +<dl> + +<dt><i>node</i> (ast.For)</dt> +<dd> +reference to the for node to handle +</dd> +</dl> +<a NAME="ReturnVisitor.visit_FunctionDef" ID="ReturnVisitor.visit_FunctionDef"></a> +<h4>ReturnVisitor.visit_FunctionDef</h4> +<b>visit_FunctionDef</b>(<i>node</i>) +<p> + Public method to handle a function definition. +</p> + +<dl> + +<dt><i>node</i> (ast.FunctionDef)</dt> +<dd> +reference to the node to handle +</dd> +</dl> +<a NAME="ReturnVisitor.visit_Name" ID="ReturnVisitor.visit_Name"></a> +<h4>ReturnVisitor.visit_Name</h4> +<b>visit_Name</b>(<i>node</i>) +<p> + Public method to handle a name node. +</p> + +<dl> + +<dt><i>node</i> (ast.Name)</dt> +<dd> +reference to the node to handle +</dd> +</dl> +<a NAME="ReturnVisitor.visit_Return" ID="ReturnVisitor.visit_Return"></a> +<h4>ReturnVisitor.visit_Return</h4> +<b>visit_Return</b>(<i>node</i>) +<p> + Public method to handle a return node. +</p> + +<dl> + +<dt><i>node</i> (ast.Return)</dt> +<dd> +reference to the node to handle +</dd> +</dl> +<a NAME="ReturnVisitor.visit_Try" ID="ReturnVisitor.visit_Try"></a> +<h4>ReturnVisitor.visit_Try</h4> +<b>visit_Try</b>(<i>node</i>) +<p> + Public method to handle a try/except node. +</p> + +<dl> + +<dt><i>node</i> (ast.Try)</dt> +<dd> +reference to the node to handle +</dd> +</dl> +<a NAME="ReturnVisitor.visit_While" ID="ReturnVisitor.visit_While"></a> +<h4>ReturnVisitor.visit_While</h4> +<b>visit_While</b>(<i>node</i>) +<p> + Public method to handle a while loop. +</p> + +<dl> + +<dt><i>node</i> (ast.While)</dt> +<dd> +reference to the while node to handle +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +</body></html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.SysVersionVisitor.html Thu Feb 27 14:42:39 2025 +0100 @@ -0,0 +1,237 @@ +<!DOCTYPE html> +<html><head> +<title>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.SysVersionVisitor</title> +<meta charset="UTF-8"> +<link rel="stylesheet" href="styles.css"> +</head> +<body> +<a NAME="top" ID="top"></a> +<h1>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.SysVersionVisitor</h1> +<p> +Module implementing a node visitor to check the use of sys.version and sys.version_info. +</p> + +<h3>Global Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Classes</h3> +<table> +<tr> +<td><a href="#SysVersionVisitor">SysVersionVisitor</a></td> +<td>Class implementing a node visitor to check the use of sys.version and sys.version_info.</td> +</tr> +</table> + +<h3>Functions</h3> +<table> +<tr><td>None</td></tr> +</table> + +<hr /> +<hr /> +<a NAME="SysVersionVisitor" ID="SysVersionVisitor"></a> +<h2>SysVersionVisitor</h2> +<p> + Class implementing a node visitor to check the use of sys.version and + sys.version_info. +</p> +<p> + Note: This class is modeled after flake8-2020 v1.8.1. +</p> + +<h3>Derived from</h3> +ast.NodeVisitor +<h3>Class Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Class Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Methods</h3> +<table> +<tr> +<td><a href="#SysVersionVisitor.__init__">SysVersionVisitor</a></td> +<td>Constructor</td> +</tr> +<tr> +<td><a href="#SysVersionVisitor.__isSys">__isSys</a></td> +<td>Private method to check for a reference to sys attribute.</td> +</tr> +<tr> +<td><a href="#SysVersionVisitor.__isSysVersionUpperSlice">__isSysVersionUpperSlice</a></td> +<td>Private method to check the upper slice of sys.version.</td> +</tr> +<tr> +<td><a href="#SysVersionVisitor.visit_Attribute">visit_Attribute</a></td> +<td>Public method to handle an attribute.</td> +</tr> +<tr> +<td><a href="#SysVersionVisitor.visit_Compare">visit_Compare</a></td> +<td>Public method to handle a comparison.</td> +</tr> +<tr> +<td><a href="#SysVersionVisitor.visit_ImportFrom">visit_ImportFrom</a></td> +<td>Public method to handle a from ...</td> +</tr> +<tr> +<td><a href="#SysVersionVisitor.visit_Name">visit_Name</a></td> +<td>Public method to handle an name.</td> +</tr> +<tr> +<td><a href="#SysVersionVisitor.visit_Subscript">visit_Subscript</a></td> +<td>Public method to handle a subscript.</td> +</tr> +</table> + +<h3>Static Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + + +<a NAME="SysVersionVisitor.__init__" ID="SysVersionVisitor.__init__"></a> +<h4>SysVersionVisitor (Constructor)</h4> +<b>SysVersionVisitor</b>(<i></i>) +<p> + Constructor +</p> + +<a NAME="SysVersionVisitor.__isSys" ID="SysVersionVisitor.__isSys"></a> +<h4>SysVersionVisitor.__isSys</h4> +<b>__isSys</b>(<i>attr, node</i>) +<p> + Private method to check for a reference to sys attribute. +</p> + +<dl> + +<dt><i>attr</i> (str)</dt> +<dd> +attribute name +</dd> +<dt><i>node</i> (ast.Node)</dt> +<dd> +reference to the node to be checked +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +flag indicating a match +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<a NAME="SysVersionVisitor.__isSysVersionUpperSlice" ID="SysVersionVisitor.__isSysVersionUpperSlice"></a> +<h4>SysVersionVisitor.__isSysVersionUpperSlice</h4> +<b>__isSysVersionUpperSlice</b>(<i>node, n</i>) +<p> + Private method to check the upper slice of sys.version. +</p> + +<dl> + +<dt><i>node</i> (ast.Node)</dt> +<dd> +reference to the node to be checked +</dd> +<dt><i>n</i> (int)</dt> +<dd> +slice value to check against +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +flag indicating a match +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<a NAME="SysVersionVisitor.visit_Attribute" ID="SysVersionVisitor.visit_Attribute"></a> +<h4>SysVersionVisitor.visit_Attribute</h4> +<b>visit_Attribute</b>(<i>node</i>) +<p> + Public method to handle an attribute. +</p> + +<dl> + +<dt><i>node</i> (ast.Attribute)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="SysVersionVisitor.visit_Compare" ID="SysVersionVisitor.visit_Compare"></a> +<h4>SysVersionVisitor.visit_Compare</h4> +<b>visit_Compare</b>(<i>node</i>) +<p> + Public method to handle a comparison. +</p> + +<dl> + +<dt><i>node</i> (ast.Compare)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="SysVersionVisitor.visit_ImportFrom" ID="SysVersionVisitor.visit_ImportFrom"></a> +<h4>SysVersionVisitor.visit_ImportFrom</h4> +<b>visit_ImportFrom</b>(<i>node</i>) +<p> + Public method to handle a from ... import ... statement. +</p> + +<dl> + +<dt><i>node</i> (ast.ImportFrom)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="SysVersionVisitor.visit_Name" ID="SysVersionVisitor.visit_Name"></a> +<h4>SysVersionVisitor.visit_Name</h4> +<b>visit_Name</b>(<i>node</i>) +<p> + Public method to handle an name. +</p> + +<dl> + +<dt><i>node</i> (ast.Name)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<a NAME="SysVersionVisitor.visit_Subscript" ID="SysVersionVisitor.visit_Subscript"></a> +<h4>SysVersionVisitor.visit_Subscript</h4> +<b>visit_Subscript</b>(<i>node</i>) +<p> + Public method to handle a subscript. +</p> + +<dl> + +<dt><i>node</i> (ast.Subscript)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +</body></html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor.html Thu Feb 27 14:42:39 2025 +0100 @@ -0,0 +1,245 @@ +<!DOCTYPE html> +<html><head> +<title>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor</title> +<meta charset="UTF-8"> +<link rel="stylesheet" href="styles.css"> +</head> +<body> +<a NAME="top" ID="top"></a> +<h1>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor</h1> +<p> +Module implementing a node visitor for bytes and str instances. +</p> + +<h3>Global Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Classes</h3> +<table> +<tr> +<td><a href="#TextVisitor">TextVisitor</a></td> +<td>Class implementing a node visitor for bytes and str instances.</td> +</tr> +</table> + +<h3>Functions</h3> +<table> +<tr><td>None</td></tr> +</table> + +<hr /> +<hr /> +<a NAME="TextVisitor" ID="TextVisitor"></a> +<h2>TextVisitor</h2> +<p> + Class implementing a node visitor for bytes and str instances. +</p> +<p> + It tries to detect docstrings as string of the first expression of each + module, class or function. +</p> + +<h3>Derived from</h3> +ast.NodeVisitor +<h3>Class Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Class Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Methods</h3> +<table> +<tr> +<td><a href="#TextVisitor.__init__">TextVisitor</a></td> +<td>Constructor</td> +</tr> +<tr> +<td><a href="#TextVisitor.__addNode">__addNode</a></td> +<td>Private method to add a node to our list of nodes.</td> +</tr> +<tr> +<td><a href="#TextVisitor.__visitBody">__visitBody</a></td> +<td>Private method to traverse the body of the node manually.</td> +</tr> +<tr> +<td><a href="#TextVisitor.__visitDefinition">__visitDefinition</a></td> +<td>Private method handling class and function definitions.</td> +</tr> +<tr> +<td><a href="#TextVisitor.visit_AsyncFunctionDef">visit_AsyncFunctionDef</a></td> +<td>Public method to handle an asynchronous function definition.</td> +</tr> +<tr> +<td><a href="#TextVisitor.visit_Call">visit_Call</a></td> +<td>Public method to handle a function call.</td> +</tr> +<tr> +<td><a href="#TextVisitor.visit_ClassDef">visit_ClassDef</a></td> +<td>Public method to handle a class definition.</td> +</tr> +<tr> +<td><a href="#TextVisitor.visit_Constant">visit_Constant</a></td> +<td>Public method to handle constant nodes.</td> +</tr> +<tr> +<td><a href="#TextVisitor.visit_FunctionDef">visit_FunctionDef</a></td> +<td>Public method to handle a function definition.</td> +</tr> +<tr> +<td><a href="#TextVisitor.visit_Module">visit_Module</a></td> +<td>Public method to handle a module.</td> +</tr> +</table> + +<h3>Static Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + + +<a NAME="TextVisitor.__init__" ID="TextVisitor.__init__"></a> +<h4>TextVisitor (Constructor)</h4> +<b>TextVisitor</b>(<i></i>) +<p> + Constructor +</p> + +<a NAME="TextVisitor.__addNode" ID="TextVisitor.__addNode"></a> +<h4>TextVisitor.__addNode</h4> +<b>__addNode</b>(<i>node</i>) +<p> + Private method to add a node to our list of nodes. +</p> + +<dl> + +<dt><i>node</i> (ast.AST)</dt> +<dd> +reference to the node to add +</dd> +</dl> +<a NAME="TextVisitor.__visitBody" ID="TextVisitor.__visitBody"></a> +<h4>TextVisitor.__visitBody</h4> +<b>__visitBody</b>(<i>node</i>) +<p> + Private method to traverse the body of the node manually. +</p> +<p> + If the first node is an expression which contains a string or bytes it + marks that as a docstring. +</p> + +<dl> + +<dt><i>node</i> (ast.AST)</dt> +<dd> +reference to the node to traverse +</dd> +</dl> +<a NAME="TextVisitor.__visitDefinition" ID="TextVisitor.__visitDefinition"></a> +<h4>TextVisitor.__visitDefinition</h4> +<b>__visitDefinition</b>(<i>node</i>) +<p> + Private method handling class and function definitions. +</p> + +<dl> + +<dt><i>node</i> (ast.FunctionDef, ast.AsyncFunctionDef or ast.ClassDef)</dt> +<dd> +reference to the node to handle +</dd> +</dl> +<a NAME="TextVisitor.visit_AsyncFunctionDef" ID="TextVisitor.visit_AsyncFunctionDef"></a> +<h4>TextVisitor.visit_AsyncFunctionDef</h4> +<b>visit_AsyncFunctionDef</b>(<i>node</i>) +<p> + Public method to handle an asynchronous function definition. +</p> + +<dl> + +<dt><i>node</i> (ast.AsyncFunctionDef)</dt> +<dd> +reference to the node to handle +</dd> +</dl> +<a NAME="TextVisitor.visit_Call" ID="TextVisitor.visit_Call"></a> +<h4>TextVisitor.visit_Call</h4> +<b>visit_Call</b>(<i>node</i>) +<p> + Public method to handle a function call. +</p> + +<dl> + +<dt><i>node</i> (ast.Call)</dt> +<dd> +reference to the node to handle +</dd> +</dl> +<a NAME="TextVisitor.visit_ClassDef" ID="TextVisitor.visit_ClassDef"></a> +<h4>TextVisitor.visit_ClassDef</h4> +<b>visit_ClassDef</b>(<i>node</i>) +<p> + Public method to handle a class definition. +</p> + +<dl> + +<dt><i>node</i> (ast.ClassDef)</dt> +<dd> +reference to the node to handle +</dd> +</dl> +<a NAME="TextVisitor.visit_Constant" ID="TextVisitor.visit_Constant"></a> +<h4>TextVisitor.visit_Constant</h4> +<b>visit_Constant</b>(<i>node</i>) +<p> + Public method to handle constant nodes. +</p> + +<dl> + +<dt><i>node</i> (ast.Constant)</dt> +<dd> +reference to the bytes node +</dd> +</dl> +<a NAME="TextVisitor.visit_FunctionDef" ID="TextVisitor.visit_FunctionDef"></a> +<h4>TextVisitor.visit_FunctionDef</h4> +<b>visit_FunctionDef</b>(<i>node</i>) +<p> + Public method to handle a function definition. +</p> + +<dl> + +<dt><i>node</i> (ast.FunctionDef)</dt> +<dd> +reference to the node to handle +</dd> +</dl> +<a NAME="TextVisitor.visit_Module" ID="TextVisitor.visit_Module"></a> +<h4>TextVisitor.visit_Module</h4> +<b>visit_Module</b>(<i>node</i>) +<p> + Public method to handle a module. +</p> + +<dl> + +<dt><i>node</i> (ast.Module)</dt> +<dd> +reference to the node to handle +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +</body></html>
--- a/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.NameOrderChecker.html Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.NameOrder.NameOrderChecker.html Thu Feb 27 14:42:39 2025 +0100 @@ -42,11 +42,11 @@ </p> <h3>Derived from</h3> -None +CodeStyleTopicChecker <h3>Class Attributes</h3> <table> +<tr><td>Category</td></tr> <tr><td>Codes</td></tr> -<tr><td>Prefix</td></tr> </table> <h3>Class Methods</h3> @@ -69,10 +69,6 @@ <td>Private method to check the order of import statements and handled exceptions.</td> </tr> <tr> -<td><a href="#NameOrderChecker.__error">__error</a></td> -<td>Private method to record an issue.</td> -</tr> -<tr> <td><a href="#NameOrderChecker.__findErrorInAll">__findErrorInAll</a></td> <td>Private method to check the '__all__' node for errors.</td> </tr> @@ -93,10 +89,6 @@ <td>Private method to find all import and import from nodes of the given tree.</td> </tr> <tr> -<td><a href="#NameOrderChecker.__ignoreCode">__ignoreCode</a></td> -<td>Private method to check if the message code should be ignored.</td> -</tr> -<tr> <td><a href="#NameOrderChecker.__naturalKeys">__naturalKeys</a></td> <td>Private method to generate keys for natural sorting.</td> </tr> @@ -113,10 +105,6 @@ <td>Public method to generate a key for the given module name.</td> </tr> <tr> -<td><a href="#NameOrderChecker.run">run</a></td> -<td>Public method to check the given source against miscellaneous conditions.</td> -</tr> -<tr> <td><a href="#NameOrderChecker.sorted">sorted</a></td> <td>Public method to sort the given list of names.</td> </tr> @@ -203,32 +191,6 @@ Private method to check the order of import statements and handled exceptions. </p> -<a NAME="NameOrderChecker.__error" ID="NameOrderChecker.__error"></a> -<h4>NameOrderChecker.__error</h4> -<b>__error</b>(<i>lineNumber, offset, code, *args</i>) -<p> - Private method to record an issue. -</p> - -<dl> - -<dt><i>lineNumber</i> (int)</dt> -<dd> -line number of the issue -</dd> -<dt><i>offset</i> (int)</dt> -<dd> -position within line of the issue -</dd> -<dt><i>code</i> (str)</dt> -<dd> -message code -</dd> -<dt><i>args</i> (list)</dt> -<dd> -arguments for the message -</dd> -</dl> <a NAME="NameOrderChecker.__findErrorInAll" ID="NameOrderChecker.__findErrorInAll"></a> <h4>NameOrderChecker.__findErrorInAll</h4> <b>__findErrorInAll</b>(<i>node</i>) @@ -246,7 +208,7 @@ <dl> <dt>Return:</dt> <dd> -tuple containing a reference to the node an error code and the error +tuple containing a reference to the node, an error code and the error arguments </dd> </dl> @@ -363,32 +325,6 @@ ast.List | ast.Tuple) </dd> </dl> -<a NAME="NameOrderChecker.__ignoreCode" ID="NameOrderChecker.__ignoreCode"></a> -<h4>NameOrderChecker.__ignoreCode</h4> -<b>__ignoreCode</b>(<i>code</i>) -<p> - Private method to check if the message code should be ignored. -</p> - -<dl> - -<dt><i>code</i> (str)</dt> -<dd> -message code to check for -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -flag indicating to ignore the given code -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> <a NAME="NameOrderChecker.__naturalKeys" ID="NameOrderChecker.__naturalKeys"></a> <h4>NameOrderChecker.__naturalKeys</h4> <b>__naturalKeys</b>(<i>text</i>) @@ -489,14 +425,6 @@ str </dd> </dl> -<a NAME="NameOrderChecker.run" ID="NameOrderChecker.run"></a> -<h4>NameOrderChecker.run</h4> -<b>run</b>(<i></i>) -<p> - Public method to check the given source against miscellaneous - conditions. -</p> - <a NAME="NameOrderChecker.sorted" ID="NameOrderChecker.sorted"></a> <h4>NameOrderChecker.sorted</h4> <b>sorted</b>(<i>toSort, key=None, reverse=False</i>)
--- a/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.NamingStyleChecker.html Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Naming.NamingStyleChecker.html Thu Feb 27 14:42:39 2025 +0100 @@ -38,9 +38,10 @@ </p> <h3>Derived from</h3> -None +CodeStyleTopicChecker <h3>Class Attributes</h3> <table> +<tr><td>Category</td></tr> <tr><td>Codes</td></tr> </table> @@ -88,10 +89,6 @@ <td>Private method to determine the error code for a variable in class scope.</td> </tr> <tr> -<td><a href="#NamingStyleChecker.__error">__error</a></td> -<td>Private method to build the error information.</td> -</tr> -<tr> <td><a href="#NamingStyleChecker.__extractNames">__extractNames</a></td> <td>Private method to extract the names from the target node.</td> </tr> @@ -120,10 +117,6 @@ <td>Private method to determine the error code for a variable in global scope.</td> </tr> <tr> -<td><a href="#NamingStyleChecker.__ignoreCode">__ignoreCode</a></td> -<td>Private method to check if the message code should be ignored.</td> -</tr> -<tr> <td><a href="#NamingStyleChecker.__isMixedCase">__isMixedCase</a></td> <td>Private method to check, if the given name is mixed case.</td> </tr> @@ -152,8 +145,12 @@ <td>Private method to scan the given AST tree.</td> </tr> <tr> +<td><a href="#NamingStyleChecker.addErrorFromNode">addErrorFromNode</a></td> +<td>Public method to build the error information.</td> +</tr> +<tr> <td><a href="#NamingStyleChecker.run">run</a></td> -<td>Public method run by the pycodestyle.py checker.</td> +<td>Public method to execute the relevant checks.</td> </tr> </table> @@ -384,24 +381,6 @@ str or None </dd> </dl> -<a NAME="NamingStyleChecker.__error" ID="NamingStyleChecker.__error"></a> -<h4>NamingStyleChecker.__error</h4> -<b>__error</b>(<i>node, code</i>) -<p> - Private method to build the error information. -</p> - -<dl> - -<dt><i>node</i> (ast.AST)</dt> -<dd> -AST node to report an error for -</dd> -<dt><i>code</i> (str)</dt> -<dd> -error code to report -</dd> -</dl> <a NAME="NamingStyleChecker.__extractNames" ID="NamingStyleChecker.__extractNames"></a> <h4>NamingStyleChecker.__extractNames</h4> <b>__extractNames</b>(<i>assignmentTarget</i>) @@ -572,32 +551,6 @@ str or None </dd> </dl> -<a NAME="NamingStyleChecker.__ignoreCode" ID="NamingStyleChecker.__ignoreCode"></a> -<h4>NamingStyleChecker.__ignoreCode</h4> -<b>__ignoreCode</b>(<i>code</i>) -<p> - Private method to check if the message code should be ignored. -</p> - -<dl> - -<dt><i>code</i> (str)</dt> -<dd> -message code to check for -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -flag indicating to ignore the given code -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> <a NAME="NamingStyleChecker.__isMixedCase" ID="NamingStyleChecker.__isMixedCase"></a> <h4>NamingStyleChecker.__isMixedCase</h4> <b>__isMixedCase</b>(<i>name</i>) @@ -753,26 +706,31 @@ AST tree node to scan </dd> </dl> +<a NAME="NamingStyleChecker.addErrorFromNode" ID="NamingStyleChecker.addErrorFromNode"></a> +<h4>NamingStyleChecker.addErrorFromNode</h4> +<b>addErrorFromNode</b>(<i>node, msgCode</i>) +<p> + Public method to build the error information. +</p> + +<dl> + +<dt><i>node</i> (ast.AST)</dt> +<dd> +AST node to report an error for +</dd> +<dt><i>msgCode</i> (str)</dt> +<dd> +message code +</dd> +</dl> <a NAME="NamingStyleChecker.run" ID="NamingStyleChecker.run"></a> <h4>NamingStyleChecker.run</h4> <b>run</b>(<i></i>) <p> - Public method run by the pycodestyle.py checker. + Public method to execute the relevant checks. </p> -<dl> -<dt>Return:</dt> -<dd> -tuple giving line number, offset within line, code and - checker function -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (int, int, str, function) -</dd> -</dl> <div align="right"><a href="#top">Up</a></div> <hr /> </body></html>
--- a/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.PathlibChecker.html Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.PathLib.PathlibChecker.html Thu Feb 27 14:42:39 2025 +0100 @@ -156,9 +156,10 @@ </p> <h3>Derived from</h3> -None +CodeStyleTopicChecker <h3>Class Attributes</h3> <table> +<tr><td>Category</td></tr> <tr><td>Codes</td></tr> <tr><td>Function2Code</td></tr> </table> @@ -179,16 +180,8 @@ <td>Private method to check the given node for the need for a replacement.</td> </tr> <tr> -<td><a href="#PathlibChecker.__error">__error</a></td> -<td>Private method to record an issue.</td> -</tr> -<tr> -<td><a href="#PathlibChecker.__ignoreCode">__ignoreCode</a></td> -<td>Private method to check if the message code should be ignored.</td> -</tr> -<tr> -<td><a href="#PathlibChecker.run">run</a></td> -<td>Public method to check the given source against functions to be replaced by 'pathlib' equivalents.</td> +<td><a href="#PathlibChecker.__checkPathlibReplacement">__checkPathlibReplacement</a></td> +<td>Private method to check for pathlib replacements.</td> </tr> </table> @@ -255,64 +248,11 @@ resolved name of the node </dd> </dl> -<a NAME="PathlibChecker.__error" ID="PathlibChecker.__error"></a> -<h4>PathlibChecker.__error</h4> -<b>__error</b>(<i>lineNumber, offset, code, *args</i>) +<a NAME="PathlibChecker.__checkPathlibReplacement" ID="PathlibChecker.__checkPathlibReplacement"></a> +<h4>PathlibChecker.__checkPathlibReplacement</h4> +<b>__checkPathlibReplacement</b>(<i></i>) <p> - Private method to record an issue. -</p> - -<dl> - -<dt><i>lineNumber</i> (int)</dt> -<dd> -line number of the issue -</dd> -<dt><i>offset</i> (int)</dt> -<dd> -position within line of the issue -</dd> -<dt><i>code</i> (str)</dt> -<dd> -message code -</dd> -<dt><i>args</i> (list)</dt> -<dd> -arguments for the message -</dd> -</dl> -<a NAME="PathlibChecker.__ignoreCode" ID="PathlibChecker.__ignoreCode"></a> -<h4>PathlibChecker.__ignoreCode</h4> -<b>__ignoreCode</b>(<i>code</i>) -<p> - Private method to check if the message code should be ignored. -</p> - -<dl> - -<dt><i>code</i> (str)</dt> -<dd> -message code to check for -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -flag indicating to ignore the given code -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<a NAME="PathlibChecker.run" ID="PathlibChecker.run"></a> -<h4>PathlibChecker.run</h4> -<b>run</b>(<i></i>) -<p> - Public method to check the given source against functions - to be replaced by 'pathlib' equivalents. + Private method to check for pathlib replacements. </p> <div align="right"><a href="#top">Up</a></div>
--- a/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Pydantic.PydanticChecker.html Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Pydantic.PydanticChecker.html Thu Feb 27 14:42:39 2025 +0100 @@ -38,11 +38,11 @@ </p> <h3>Derived from</h3> -None +CodeStyleTopicChecker <h3>Class Attributes</h3> <table> +<tr><td>Category</td></tr> <tr><td>Codes</td></tr> -<tr><td>Prefix</td></tr> </table> <h3>Class Methods</h3> @@ -60,18 +60,6 @@ <td><a href="#PydanticChecker.__checkPydantic">__checkPydantic</a></td> <td>Private method to check pydantic related topics.</td> </tr> -<tr> -<td><a href="#PydanticChecker.__error">__error</a></td> -<td>Private method to record an issue.</td> -</tr> -<tr> -<td><a href="#PydanticChecker.__ignoreCode">__ignoreCode</a></td> -<td>Private method to check if the message code should be ignored.</td> -</tr> -<tr> -<td><a href="#PydanticChecker.run">run</a></td> -<td>Public method to check the given source against miscellaneous conditions.</td> -</tr> </table> <h3>Static Methods</h3> @@ -129,66 +117,6 @@ Private method to check pydantic related topics. </p> -<a NAME="PydanticChecker.__error" ID="PydanticChecker.__error"></a> -<h4>PydanticChecker.__error</h4> -<b>__error</b>(<i>lineNumber, offset, code, *args</i>) -<p> - Private method to record an issue. -</p> - -<dl> - -<dt><i>lineNumber</i> (int)</dt> -<dd> -line number of the issue -</dd> -<dt><i>offset</i> (int)</dt> -<dd> -position within line of the issue -</dd> -<dt><i>code</i> (str)</dt> -<dd> -message code -</dd> -<dt><i>args</i> (list)</dt> -<dd> -arguments for the message -</dd> -</dl> -<a NAME="PydanticChecker.__ignoreCode" ID="PydanticChecker.__ignoreCode"></a> -<h4>PydanticChecker.__ignoreCode</h4> -<b>__ignoreCode</b>(<i>code</i>) -<p> - Private method to check if the message code should be ignored. -</p> - -<dl> - -<dt><i>code</i> (str)</dt> -<dd> -message code to check for -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -flag indicating to ignore the given code -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<a NAME="PydanticChecker.run" ID="PydanticChecker.run"></a> -<h4>PydanticChecker.run</h4> -<b>run</b>(<i></i>) -<p> - Public method to check the given source against miscellaneous - conditions. -</p> - <div align="right"><a href="#top">Up</a></div> <hr /> </body></html>
--- a/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Pydantic.PydanticVisitor.html Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Pydantic.PydanticVisitor.html Thu Feb 27 14:42:39 2025 +0100 @@ -122,7 +122,7 @@ <dt><i>errorCallback</i> (func)</dt> <dd> -callback function to register an error +callback function to register an issue </dd> </dl> <a NAME="PydanticVisitor.__checkForPyd001" ID="PydanticVisitor.__checkForPyd001"></a>
--- a/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityChecker.html Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityChecker.html Thu Feb 27 14:42:39 2025 +0100 @@ -38,9 +38,10 @@ </p> <h3>Derived from</h3> -None +CodeStyleTopicChecker <h3>Class Attributes</h3> <table> +<tr><td>Category</td></tr> <tr><td>Codes</td></tr> </table> @@ -56,18 +57,14 @@ <td>Constructor</td> </tr> <tr> -<td><a href="#SecurityChecker.__ignoreCode">__ignoreCode</a></td> -<td>Private method to check if the message code should be ignored.</td> +<td><a href="#SecurityChecker.addError">addError</a></td> +<td>Public method to record an issue.</td> </tr> <tr> <td><a href="#SecurityChecker.getConfig">getConfig</a></td> <td>Public method to get the configuration dictionary.</td> </tr> <tr> -<td><a href="#SecurityChecker.reportError">reportError</a></td> -<td>Public method to record an issue.</td> -</tr> -<tr> <td><a href="#SecurityChecker.run">run</a></td> <td>Public method to check the given source against security related conditions.</td> </tr> @@ -121,30 +118,40 @@ dictionary of arguments for the security checks </dd> </dl> -<a NAME="SecurityChecker.__ignoreCode" ID="SecurityChecker.__ignoreCode"></a> -<h4>SecurityChecker.__ignoreCode</h4> -<b>__ignoreCode</b>(<i>code</i>) +<a NAME="SecurityChecker.addError" ID="SecurityChecker.addError"></a> +<h4>SecurityChecker.addError</h4> +<b>addError</b>(<i>lineNumber, offset, msgCode, severity, confidence, *args</i>) <p> - Private method to check if the message code should be ignored. + Public method to record an issue. </p> <dl> -<dt><i>code</i> (str)</dt> +<dt><i>lineNumber</i> (int)</dt> <dd> -message code to check for +line number of the issue </dd> -</dl> -<dl> -<dt>Return:</dt> +<dt><i>offset</i> (int)</dt> +<dd> +position within line of the issue +</dd> +<dt><i>msgCode</i> (str)</dt> <dd> -flag indicating to ignore the given code +message code +</dd> +<dt><i>severity</i> (str)</dt> +<dd> +severity code (H = high, M = medium, L = low, + U = undefined) </dd> -</dl> -<dl> -<dt>Return Type:</dt> +<dt><i>confidence</i> (str)</dt> <dd> -bool +confidence code (H = high, M = medium, L = low, + U = undefined) +</dd> +<dt><i>args</i> (list)</dt> +<dd> +arguments for the message </dd> </dl> <a NAME="SecurityChecker.getConfig" ID="SecurityChecker.getConfig"></a> @@ -166,42 +173,6 @@ dict </dd> </dl> -<a NAME="SecurityChecker.reportError" ID="SecurityChecker.reportError"></a> -<h4>SecurityChecker.reportError</h4> -<b>reportError</b>(<i>lineNumber, offset, code, severity, confidence, *args</i>) -<p> - Public method to record an issue. -</p> - -<dl> - -<dt><i>lineNumber</i> (int)</dt> -<dd> -line number of the issue -</dd> -<dt><i>offset</i> (int)</dt> -<dd> -position within line of the issue -</dd> -<dt><i>code</i> (str)</dt> -<dd> -message code -</dd> -<dt><i>severity</i> (str)</dt> -<dd> -severity code (H = high, M = medium, L = low, - U = undefined) -</dd> -<dt><i>confidence</i> (str)</dt> -<dd> -confidence code (H = high, M = medium, L = low, - U = undefined) -</dd> -<dt><i>args</i> (list)</dt> -<dd> -arguments for the message -</dd> -</dl> <a NAME="SecurityChecker.run" ID="SecurityChecker.run"></a> <h4>SecurityChecker.run</h4> <b>run</b>(<i></i>)
--- a/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Simplify.SimplifyChecker.html Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Simplify.SimplifyChecker.html Thu Feb 27 14:42:39 2025 +0100 @@ -38,9 +38,10 @@ </p> <h3>Derived from</h3> -None +CodeStyleTopicChecker <h3>Class Attributes</h3> <table> +<tr><td>Category</td></tr> <tr><td>Codes</td></tr> </table> @@ -60,16 +61,8 @@ <td>Private method to amend the nodes of the given AST tree with backward and forward references.</td> </tr> <tr> -<td><a href="#SimplifyChecker.__error">__error</a></td> -<td>Private method to record an issue.</td> -</tr> -<tr> -<td><a href="#SimplifyChecker.__ignoreCode">__ignoreCode</a></td> -<td>Private method to check if the message code should be ignored.</td> -</tr> -<tr> -<td><a href="#SimplifyChecker.run">run</a></td> -<td>Public method to check the given source against functions to be replaced by 'pathlib' equivalents.</td> +<td><a href="#SimplifyChecker.__checkCodeSimplifications">__checkCodeSimplifications</a></td> +<td>Private method to check for code simplifications.</td> </tr> </table> @@ -136,64 +129,11 @@ nesting level (defaults to 0) </dd> </dl> -<a NAME="SimplifyChecker.__error" ID="SimplifyChecker.__error"></a> -<h4>SimplifyChecker.__error</h4> -<b>__error</b>(<i>lineNumber, offset, code, *args</i>) +<a NAME="SimplifyChecker.__checkCodeSimplifications" ID="SimplifyChecker.__checkCodeSimplifications"></a> +<h4>SimplifyChecker.__checkCodeSimplifications</h4> +<b>__checkCodeSimplifications</b>(<i></i>) <p> - Private method to record an issue. -</p> - -<dl> - -<dt><i>lineNumber</i> (int)</dt> -<dd> -line number of the issue -</dd> -<dt><i>offset</i> (int)</dt> -<dd> -position within line of the issue -</dd> -<dt><i>code</i> (str)</dt> -<dd> -message code -</dd> -<dt><i>args</i> (list)</dt> -<dd> -arguments for the message -</dd> -</dl> -<a NAME="SimplifyChecker.__ignoreCode" ID="SimplifyChecker.__ignoreCode"></a> -<h4>SimplifyChecker.__ignoreCode</h4> -<b>__ignoreCode</b>(<i>code</i>) -<p> - Private method to check if the message code should be ignored. -</p> - -<dl> - -<dt><i>code</i> (str)</dt> -<dd> -message code to check for -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -flag indicating to ignore the given code -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<a NAME="SimplifyChecker.run" ID="SimplifyChecker.run"></a> -<h4>SimplifyChecker.run</h4> -<b>run</b>(<i></i>) -<p> - Public method to check the given source against functions - to be replaced by 'pathlib' equivalents. + Private method to check for code simplifications. </p> <div align="right"><a href="#top">Up</a></div>
--- a/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Unused.UnusedChecker.html Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Unused.UnusedChecker.html Thu Feb 27 14:42:39 2025 +0100 @@ -303,9 +303,10 @@ </p> <h3>Derived from</h3> -None +CodeStyleTopicChecker <h3>Class Attributes</h3> <table> +<tr><td>Category</td></tr> <tr><td>Codes</td></tr> </table> @@ -329,10 +330,6 @@ <td>Private method to check for unused global variables.</td> </tr> <tr> -<td><a href="#UnusedChecker.__error">__error</a></td> -<td>Private method to record an issue.</td> -</tr> -<tr> <td><a href="#UnusedChecker.__extractGlobalVariables">__extractGlobalVariables</a></td> <td>Private method to get the names of all global variables.</td> </tr> @@ -349,10 +346,6 @@ <td>Private method to get a list of unused arguments of the given function.</td> </tr> <tr> -<td><a href="#UnusedChecker.__ignoreCode">__ignoreCode</a></td> -<td>Private method to check if the message code should be ignored.</td> -</tr> -<tr> <td><a href="#UnusedChecker.__isDunderMethod">__isDunderMethod</a></td> <td>Private method to check, if the function node defines a special function.</td> </tr> @@ -364,10 +357,6 @@ <td><a href="#UnusedChecker.__isStubFunction">__isStubFunction</a></td> <td>Private method to check, if the given function node defines a stub function.</td> </tr> -<tr> -<td><a href="#UnusedChecker.run">run</a></td> -<td>Public method to check the given source against miscellaneous conditions.</td> -</tr> </table> <h3>Static Methods</h3> @@ -432,32 +421,6 @@ Private method to check for unused global variables. </p> -<a NAME="UnusedChecker.__error" ID="UnusedChecker.__error"></a> -<h4>UnusedChecker.__error</h4> -<b>__error</b>(<i>lineNumber, offset, code, *args</i>) -<p> - Private method to record an issue. -</p> - -<dl> - -<dt><i>lineNumber</i> (int)</dt> -<dd> -line number of the issue -</dd> -<dt><i>offset</i> (int)</dt> -<dd> -position within line of the issue -</dd> -<dt><i>code</i> (str)</dt> -<dd> -message code -</dd> -<dt><i>args</i> (list)</dt> -<dd> -arguments for the message -</dd> -</dl> <a NAME="UnusedChecker.__extractGlobalVariables" ID="UnusedChecker.__extractGlobalVariables"></a> <h4>UnusedChecker.__extractGlobalVariables</h4> <b>__extractGlobalVariables</b>(<i></i>) @@ -555,32 +518,6 @@ list of tuples of (int, ast.arg) </dd> </dl> -<a NAME="UnusedChecker.__ignoreCode" ID="UnusedChecker.__ignoreCode"></a> -<h4>UnusedChecker.__ignoreCode</h4> -<b>__ignoreCode</b>(<i>code</i>) -<p> - Private method to check if the message code should be ignored. -</p> - -<dl> - -<dt><i>code</i> (str)</dt> -<dd> -message code to check for -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -flag indicating to ignore the given code -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> <a NAME="UnusedChecker.__isDunderMethod" ID="UnusedChecker.__isDunderMethod"></a> <h4>UnusedChecker.__isDunderMethod</h4> <b>__isDunderMethod</b>(<i>functionNode</i>) @@ -664,14 +601,6 @@ bool </dd> </dl> -<a NAME="UnusedChecker.run" ID="UnusedChecker.run"></a> -<h4>UnusedChecker.run</h4> -<b>run</b>(<i></i>) -<p> - Public method to check the given source against miscellaneous - conditions. -</p> - <div align="right"><a href="#top">Up</a></div> <hr /> </body></html>
--- a/src/eric7/Documentation/Source/index-eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.html Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Documentation/Source/index-eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.html Thu Feb 27 14:42:39 2025 +0100 @@ -16,6 +16,18 @@ <table> <tr> +<td><a href="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.BugBearVisitor.html">BugBearVisitor</a></td> +<td>Module implementing a visitor to check for various potential issues.</td> +</tr> +<tr> +<td><a href="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DateTimeVisitor.html">DateTimeVisitor</a></td> +<td>Module implementing a node visitor to check datetime function calls.</td> +</tr> +<tr> +<td><a href="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DefaultMatchCaseVisitor.html">DefaultMatchCaseVisitor</a></td> +<td>Module implementing a node visitor to check default match cases.</td> +</tr> +<tr> <td><a href="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html">MiscellaneousChecker</a></td> <td>Module implementing a checker for miscellaneous checks.</td> </tr> @@ -24,6 +36,18 @@ <td>Module implementing complex defaults for the miscellaneous checker.</td> </tr> <tr> +<td><a href="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ReturnVisitor.html">ReturnVisitor</a></td> +<td>Module implementing a node visitor to check return statements.</td> +</tr> +<tr> +<td><a href="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.SysVersionVisitor.html">SysVersionVisitor</a></td> +<td>Module implementing a node visitor to check the use of sys.version and sys.version_info.</td> +</tr> +<tr> +<td><a href="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor.html">TextVisitor</a></td> +<td>Module implementing a node visitor for bytes and str instances.</td> +</tr> +<tr> <td><a href="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.eradicate.html">eradicate</a></td> <td>Removes commented-out Python code.</td> </tr>
--- a/src/eric7/Documentation/Source/index-eric7.Plugins.CheckerPlugins.CodeStyleChecker.html Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Documentation/Source/index-eric7.Plugins.CheckerPlugins.CodeStyleChecker.html Thu Feb 27 14:42:39 2025 +0100 @@ -108,6 +108,10 @@ <td>Module implementing a dialog showing statistical data for the last code style checker run.</td> </tr> <tr> +<td><a href="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleTopicChecker.html">CodeStyleTopicChecker</a></td> +<td>Module implementing the topic checker base class containing common methods.</td> +</tr> +<tr> <td><a href="eric7.Plugins.CheckerPlugins.CodeStyleChecker.ast_unparse.html">ast_unparse</a></td> <td></td> </tr>
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Annotations/AnnotationsChecker.py Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Annotations/AnnotationsChecker.py Thu Feb 27 14:42:39 2025 +0100 @@ -9,18 +9,19 @@ import ast import contextlib -import copy import sys from functools import lru_cache import AstUtilities +from CodeStyleTopicChecker import CodeStyleTopicChecker + from .AnnotationsCheckerDefaults import AnnotationsCheckerDefaultArgs from .AnnotationsEnums import AnnotationType, ClassDecoratorType, FunctionType -class AnnotationsChecker: +class AnnotationsChecker(CodeStyleTopicChecker): """ Class implementing a checker for function type annotations. """ @@ -58,6 +59,7 @@ ## deprecated 'typing' symbols (PEP 585) "A-911", ] + Category = "A" def __init__(self, source, filename, tree, select, ignore, expected, repeat, args): """ @@ -80,20 +82,17 @@ @param args dictionary of arguments for the annotation checks @type dict """ - self.__select = tuple(select) - self.__ignore = tuple(ignore) - self.__expected = expected[:] - self.__repeat = repeat - self.__filename = filename - self.__source = source[:] - self.__tree = copy.deepcopy(tree) - self.__args = args - - # statistics counters - self.counters = {} - - # collection of detected errors - self.errors = [] + super().__init__( + AnnotationsChecker.Category, + source, + filename, + tree, + select, + ignore, + expected, + repeat, + args, + ) checkersWithCodes = [ ( @@ -120,76 +119,7 @@ (self.__checkAnnotationPep604, ("A-901",)), (self.__checkDeprecatedTypingSymbols, ("A-911",)), ] - - self.__checkers = [] - for checker, codes in checkersWithCodes: - if any(not (code and self.__ignoreCode(code)) for code in codes): - self.__checkers.append(checker) - - def __ignoreCode(self, code): - """ - Private method to check if the message code should be ignored. - - @param code message code to check for - @type str - @return flag indicating to ignore the given code - @rtype bool - """ - return code in self.__ignore or ( - code.startswith(self.__ignore) and not code.startswith(self.__select) - ) - - def __error(self, lineNumber, offset, code, *args): - """ - Private method to record an issue. - - @param lineNumber line number of the issue - @type int - @param offset position within line of the issue - @type int - @param code message code - @type str - @param args arguments for the message - @type list - """ - if self.__ignoreCode(code): - return - - if code in self.counters: - self.counters[code] += 1 - else: - self.counters[code] = 1 - - # Don't care about expected codes - if code in self.__expected: - return - - if code and (self.counters[code] == 1 or self.__repeat): - # record the issue with one based line number - self.errors.append( - { - "file": self.__filename, - "line": lineNumber + 1, - "offset": offset, - "code": code, - "args": args, - } - ) - - def run(self): - """ - Public method to check the given source against annotation issues. - """ - if not self.__filename: - # don't do anything, if essential data is missing - return - - if not self.__checkers: - # don't do anything, if no codes were selected - return - - for check in self.__checkers: - check() + self._initializeCheckers(checkersWithCodes) ####################################################################### ## Annotations @@ -205,50 +135,50 @@ # Type ignores are provided by ast at the module level & we'll need them later # when deciding whether or not to emit errors for a given function - typeIgnoreLineno = {ti.lineno for ti in self.__tree.type_ignores} + typeIgnoreLineno = {ti.lineno for ti in self.tree.type_ignores} hasMypyIgnoreErrors = any( - "# mypy: ignore-errors" in line for line in self.__source[:5] + "# mypy: ignore-errors" in line for line in self.source[:5] ) - suppressNoneReturning = self.__args.get( + suppressNoneReturning = self.args.get( "SuppressNoneReturning", AnnotationsCheckerDefaultArgs["SuppressNoneReturning"], ) - suppressDummyArgs = self.__args.get( + suppressDummyArgs = self.args.get( "SuppressDummyArgs", AnnotationsCheckerDefaultArgs["SuppressDummyArgs"] ) - allowUntypedDefs = self.__args.get( + allowUntypedDefs = self.args.get( "AllowUntypedDefs", AnnotationsCheckerDefaultArgs["AllowUntypedDefs"] ) - allowUntypedNested = self.__args.get( + allowUntypedNested = self.args.get( "AllowUntypedNested", AnnotationsCheckerDefaultArgs["AllowUntypedNested"] ) - mypyInitReturn = self.__args.get( + mypyInitReturn = self.args.get( "MypyInitReturn", AnnotationsCheckerDefaultArgs["MypyInitReturn"] ) - allowStarArgAny = self.__args.get( + allowStarArgAny = self.args.get( "AllowStarArgAny", AnnotationsCheckerDefaultArgs["AllowStarArgAny"] ) - respectTypeIgnore = self.__args.get( + respectTypeIgnore = self.args.get( "RespectTypeIgnore", AnnotationsCheckerDefaultArgs["RespectTypeIgnore"] ) # Store decorator lists as sets for easier lookup dispatchDecorators = set( - self.__args.get( + self.args.get( "DispatchDecorators", AnnotationsCheckerDefaultArgs["DispatchDecorators"], ) ) overloadDecorators = set( - self.__args.get( + self.args.get( "OverloadDecorators", AnnotationsCheckerDefaultArgs["OverloadDecorators"], ) ) - visitor = FunctionVisitor(self.__source) - visitor.visit(self.__tree) + visitor = FunctionVisitor(self.source) + visitor.visit(self.tree) # Keep track of the last encountered function decorated by # `typing.overload`, if any. Per the `typing` module documentation, @@ -259,7 +189,7 @@ # Iterate over the arguments with missing type hints, by function. for function in visitor.functionDefinitions: if function.hasTypeComment: - self.__error(function.lineno - 1, function.col_offset, "A-402") + self.addErrorFromNode(function, "A-402") if function.isDynamicallyTyped() and ( allowUntypedDefs or (function.isNested and allowUntypedNested) @@ -284,7 +214,7 @@ }: continue - self.__error(function.lineno - 1, function.col_offset, "A-401") + self.addErrorFromNode(function, "A-401") # Before we iterate over the function's missing annotations, check # to see if it's the closing function def in a series of @@ -317,7 +247,7 @@ # Check for type comments here since we're not considering them as # typed args if arg.hasTypeComment: - self.__error(arg.lineno - 1, arg.col_offset, "A-402") + self.addErrorFromNode(arg, "A-402") if arg.argname == "return": # return annotations have multiple possible short-circuit @@ -384,9 +314,9 @@ ) if errorCode in ("A-001", "A-002", "A-003"): - self.__error(arg.lineno - 1, arg.col_offset, errorCode, arg.argname) + self.addErrorFromNode(arg, errorCode, arg.argname) else: - self.__error(arg.lineno - 1, arg.col_offset, errorCode) + self.addErrorFromNode(arg, errorCode) @lru_cache() # __IGNORE_WARNING_M-519__ def __returnErrorClassifier(self, isClassMethod, classDecoratorType, functionType): @@ -467,7 +397,7 @@ """ Private method to check for function annotation coverage. """ - minAnnotationsCoverage = self.__args.get( + minAnnotationsCoverage = self.args.get( "MinimumCoverage", AnnotationsCheckerDefaultArgs["MinimumCoverage"] ) if minAnnotationsCoverage == 0: @@ -476,7 +406,7 @@ functionDefs = [ f - for f in ast.walk(self.__tree) + for f in ast.walk(self.tree) if isinstance(f, (ast.AsyncFunctionDef, ast.FunctionDef)) ] if not functionDefs: @@ -495,7 +425,7 @@ * 100 ) if annotationsCoverage < minAnnotationsCoverage: - self.__error(0, 0, "A-881", annotationsCoverage) + self.addError(1, 0, "A-881", annotationsCoverage) def __hasTypeAnnotations(self, funcNode): """ @@ -538,17 +468,17 @@ """ Private method to check the type annotation complexity. """ - maxAnnotationComplexity = self.__args.get( + maxAnnotationComplexity = self.args.get( "MaximumComplexity", AnnotationsCheckerDefaultArgs["MaximumComplexity"] ) - maxAnnotationLength = self.__args.get( + maxAnnotationLength = self.args.get( "MaximumLength", AnnotationsCheckerDefaultArgs["MaximumLength"] ) typeAnnotations = [] functionDefs = [ f - for f in ast.walk(self.__tree) + for f in ast.walk(self.tree) if isinstance(f, (ast.AsyncFunctionDef, ast.FunctionDef)) ] for functionDef in functionDefs: @@ -559,28 +489,20 @@ typeAnnotations.append(functionDef.returns) typeAnnotations += [ a.annotation - for a in ast.walk(self.__tree) + for a in ast.walk(self.tree) if isinstance(a, ast.AnnAssign) and a.annotation ] for annotation in typeAnnotations: complexity = self.__getAnnotationComplexity(annotation) if complexity > maxAnnotationComplexity: - self.__error( - annotation.lineno - 1, - annotation.col_offset, - "A-891", - complexity, - maxAnnotationComplexity, + self.addErrorFromNode( + annotation, "A-891", complexity, maxAnnotationComplexity ) annotationLength = self.__getAnnotationLength(annotation) if annotationLength > maxAnnotationLength: - self.__error( - annotation.lineno - 1, - annotation.col_offset, - "A-892", - annotationLength, - maxAnnotationLength, + self.addErrorFromNode( + annotation, "A-892", annotationLength, maxAnnotationLength ) def __getAnnotationComplexity(self, annotationNode, defaultComplexity=1): @@ -663,30 +585,30 @@ # the __future__ typing import is only needed before Python 3.9 return - forceFutureAnnotations = self.__args.get( + forceFutureAnnotations = self.args.get( "ForceFutureAnnotations", AnnotationsCheckerDefaultArgs["ForceFutureAnnotations"], ) - checkFutureAnnotations = self.__args.get( + checkFutureAnnotations = self.args.get( "CheckFutureAnnotations", AnnotationsCheckerDefaultArgs["CheckFutureAnnotations"], ) visitor = AnnotationsFutureVisitor() - visitor.visit(self.__tree) + visitor.visit(self.tree) if visitor.importsFutureAnnotations(): return if visitor.hasTypingImports(): imports = ", ".join(visitor.getTypingImports()) - self.__error(0, 0, "A-871", imports) + self.addError(1, 0, "A-871", imports) elif forceFutureAnnotations: - self.__error(0, 0, "A-872") + self.addError(1, 0, "A-872") if checkFutureAnnotations and visitor.hasSimplifiedTypes(): simplifiedTypes = ", ".join(sorted(visitor.getSimplifiedTypes())) - self.__error(0, 0, "A-873", simplifiedTypes) + self.addError(1, 0, "A-873", simplifiedTypes) ####################################################################### ## check use of 'typing.Union' (see PEP 604) @@ -705,10 +627,10 @@ return visitor = AnnotationsUnionVisitor() - visitor.visit(self.__tree) + visitor.visit(self.tree) for node in visitor.getIssues(): - self.__error(node.lineno - 1, node.col_offset, "A-901") + self.addErrorFromNode(node, "A-901") ####################################################################### ## check use of 'typing.Union' (see PEP 604) @@ -728,17 +650,17 @@ if sys.version_info < (3, 9): # py 3.8: only if activated via __future__ import visitor = AnnotationsFutureImportVisitor() - visitor.visit(self.__tree) + visitor.visit(self.tree) if not visitor.futureImportPresent(): return visitor = AnnotationsDeprecationsVisitor( - self.__args.get( + self.args.get( "ExemptedTypingSymbols", AnnotationsCheckerDefaultArgs["ExemptedTypingSymbols"], ) ) - visitor.visit(self.__tree) + visitor.visit(self.tree) for node, (name, replacement) in visitor.getIssues(): - self.__error(node.lineno - 1, node.col_offset, "A-911", name, replacement) + self.addErrorFromNode(node, "A-911", name, replacement)
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Async/AsyncChecker.py Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Async/AsyncChecker.py Thu Feb 27 14:42:39 2025 +0100 @@ -7,24 +7,25 @@ Module implementing a checker for "async" related issues. """ - import copy +from CodeStyleTopicChecker import CodeStyleTopicChecker -class AsyncChecker: + +class AsyncChecker(CodeStyleTopicChecker): """ Class implementing a checker for "async" related issues. """ Codes = [ - "ASY100", - "ASY101", - "ASY102", - "ASY103", - "ASY104", - "ASY105", + "ASY-100", + "ASY-101", + "ASY-102", + "ASY-103", + "ASY-104", + "ASY-105", ] - Prefix = "ASY" + Category = "ASY" def __init__(self, source, filename, tree, select, ignore, expected, repeat, args): """ @@ -47,98 +48,25 @@ @param args dictionary of arguments for the various checks @type dict """ - self.__select = tuple(x for x in select if x.startswith(AsyncChecker.Prefix)) - self.__ignore = tuple(x for x in ignore if x.startswith(AsyncChecker.Prefix)) - self.__expected = expected[:] - self.__repeat = repeat - self.__filename = filename - self.__source = source[:] - self.__tree = copy.deepcopy(tree) - self.__args = args - - # statistics counters - self.counters = {} - - # collection of detected errors - self.errors = [] + super().__init__( + AsyncChecker.Category, + source, + filename, + tree, + select, + ignore, + expected, + repeat, + args, + ) checkersWithCodes = [ ( self.__checkSyncUses, - ("ASY100", "ASY101", "ASY102", "ASY103", "ASY104", "ASY105"), + ("ASY-100", "ASY-101", "ASY-102", "ASY-103", "ASY-104", "ASY-105"), ), ] - - self.__checkers = [] - for checker, codes in checkersWithCodes: - if any(not (code and self.__ignoreCode(code)) for code in codes): - self.__checkers.append(checker) - - def __ignoreCode(self, code): - """ - Private method to check if the message code should be ignored. - - @param code message code to check for - @type str - @return flag indicating to ignore the given code - @rtype bool - """ - return code in self.__ignore or ( - code.startswith(self.__ignore) and not code.startswith(self.__select) - ) - - def __error(self, lineNumber, offset, code, *args): - """ - Private method to record an issue. - - @param lineNumber line number of the issue - @type int - @param offset position within line of the issue - @type int - @param code message code - @type str - @param args arguments for the message - @type list - """ - if self.__ignoreCode(code): - return - - if code in self.counters: - self.counters[code] += 1 - else: - self.counters[code] = 1 - - # Don't care about expected codes - if code in self.__expected: - return - - if code and (self.counters[code] == 1 or self.__repeat): - # record the issue with one based line number - self.errors.append( - { - "file": self.__filename, - "line": lineNumber + 1, - "offset": offset, - "code": code, - "args": args, - } - ) - - def run(self): - """ - Public method to check the given source against miscellaneous - conditions. - """ - if not self.__filename: - # don't do anything, if essential data is missing - return - - if not self.__checkers: - # don't do anything, if no codes were selected - return - - for check in self.__checkers: - check() + self._initializeCheckers(checkersWithCodes) def __checkSyncUses(self): """ @@ -146,10 +74,7 @@ """ from .AsyncVisitor import AsyncVisitor - visitor = AsyncVisitor(self.__args, self) - visitor.visit(copy.deepcopy(self.__tree)) + visitor = AsyncVisitor(self.args, self) + visitor.visit(copy.deepcopy(self.tree)) for violation in visitor.violations: - if not self.__ignoreCode(violation[1]): - node = violation[0] - reason = violation[1] - self.__error(node.lineno - 1, node.col_offset, reason) + self.addErrorFromNode(violation[0], violation[1])
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Async/AsyncVisitor.py Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Async/AsyncVisitor.py Thu Feb 27 14:42:39 2025 +0100 @@ -147,7 +147,7 @@ and isinstance(inner.func, ast.Name) and inner.func.id == "open" ): - errorCode = "ASY101" + errorCode = "ASY-101" elif ( isinstance(inner, ast.withitem) @@ -155,7 +155,7 @@ and isinstance(inner.context_expr.func, ast.Name) and inner.context_expr.func.id == "open" ): - errorCode = "ASY103" + errorCode = "ASY-103" inner = inner.context_expr elif isinstance(inner, ast.Call): @@ -167,9 +167,9 @@ "request.urlopen", "urlopen", ): - errorCode = "ASY100" + errorCode = "ASY-100" elif funcName == "time.sleep": - errorCode = "ASY101" + errorCode = "ASY-101" else: match = re.fullmatch( r"(?P<package>{0}|os\.path|os|subprocess|urllib3)\." @@ -181,7 +181,7 @@ match.group("package") in self.HttpPackages and match.group("method") in self.HttpMethods ): - errorCode = "ASY100" + errorCode = "ASY-100" elif ( match.group("package") == "subprocess" @@ -190,19 +190,19 @@ match.group("package") == "os" and match.group("method") in self.OsWaitMethods ): - errorCode = "ASY101" + errorCode = "ASY-101" elif ( match.group("package") == "os" and match.group("method") in self.OsProcessMethods ): - errorCode = "ASY102" + errorCode = "ASY-102" elif ( match.group("package") == "os.path" and match.group("method") in self.OsPathFuncs ): - errorCode = "ASY104" + errorCode = "ASY-104" elif ( match.group("package") == "httpx" @@ -211,7 +211,7 @@ match.group("package") == "urllib3" and match.group("method") in self.Urllib3DangerousClasses ): - errorCode = "ASY105" + errorCode = "ASY-105" if errorCode: self.violations.append((inner, errorCode))
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Async/translations.py Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Async/translations.py Thu Feb 27 14:42:39 2025 +0100 @@ -11,25 +11,25 @@ from PyQt6.QtCore import QCoreApplication _asyncMessages = { - "ASY100": QCoreApplication.translate( + "ASY-100": QCoreApplication.translate( "AsyncChecker", "sync HTTP call in async function, use httpx.AsyncClient" ), - "ASY101": QCoreApplication.translate( + "ASY-101": QCoreApplication.translate( "AsyncChecker", "blocking sync call in async function, use framework equivalent" ), - "ASY102": QCoreApplication.translate( + "ASY-102": QCoreApplication.translate( "AsyncChecker", "sync process call in async function, use framework equivalent" ), - "ASY103": QCoreApplication.translate( + "ASY-103": QCoreApplication.translate( "AsyncChecker", "blocking sync context manager in async function," " use 'async with' statement", ), - "ASY104": QCoreApplication.translate( + "ASY-104": QCoreApplication.translate( "AsyncChecker", "avoid using os.path, prefer using 'trio.Path' or 'anyio.Path' objects", ), - "ASY105": QCoreApplication.translate( + "ASY-105": QCoreApplication.translate( "AsyncChecker", "use of potentially dangerous class in async function, use" " httpx.AsyncClient",
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py Thu Feb 27 14:42:39 2025 +0100 @@ -90,13 +90,16 @@ errorCode = code[0] + "-" + code[1:] if self._ignore_code(errorCode): return None + if errorCode in self.counters: self.counters[errorCode] += 1 else: self.counters[errorCode] = 1 + # Don't care about expected errors or warnings if errorCode in self.expected: return None + if errorCode and (self.counters[errorCode] == 1 or self.__repeat): self.errors.append( { @@ -107,6 +110,7 @@ "args": args, } ) + return errorCode
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleTopicChecker.py Thu Feb 27 14:42:39 2025 +0100 @@ -0,0 +1,157 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2025 Detlev Offenbach <detlev@die-offenbachs.de> +# + +""" +Module implementing the topic checker base class containing common methods. +""" + +import copy + + +class CodeStyleTopicChecker: + """ + Class implementing the topic checker base class. + """ + + def __init__( + self, category, source, filename, tree, select, ignore, expected, repeat, args + ): + """ + Constructor + + @param category checker category code (one to three uppercase characters + @type str + @param source source code to be checked + @type list of str + @param filename name of the source file + @type str + @param tree AST tree of the source code + @type ast.Module + @param select list of selected codes + @type list of str + @param ignore list of codes to be ignored + @type list of str + @param expected list of expected codes + @type list of str + @param repeat flag indicating to report each occurrence of a code + @type bool + @param args dictionary of arguments for the various checks + @type dict + """ + self.__category = category + + codeFilter = f"{category}-" + self.selected = tuple(x for x in select if x.startswith(codeFilter)) + self.ignored = tuple( + x for x in ignore if x.startswith(codeFilter) or x == category + ) + self.expected = [x for x in expected if x.startswith(codeFilter)] + + self.repeat = repeat + self.filename = filename + self.source = source[:] + self.tree = copy.deepcopy(tree) + self.args = args + + # statistics counters + self.counters = {} + + # collection of detected errors + self.errors = [] + + def _initializeCheckers(self, checkersWithCodes): + """ + Protected method to determine the list of check methods to be run. + + This list is determined considering the list if selected and ignored issue + codes. + + @param checkersWithCodes DESCRIPTION + @type TYPE + """ + # checkers to be run + self.__checkers = [] + + for checker, msgCodes in checkersWithCodes: + if any(not (msgCode and self._ignoreCode(msgCode)) for msgCode in msgCodes): + self.__checkers.append(checker) + + def _ignoreCode(self, code): + """ + Protected method to check if the message code should be ignored. + + @param code message code to check for + @type str + @return flag indicating to ignore the given code + @rtype bool + """ + return code in self.ignored or ( + code.startswith(self.ignored) and not code.startswith(self.selected) + ) + + def addError(self, lineNumber, offset, msgCode, *args): + """ + Public method to record an issue. + + @param lineNumber line number of the issue (one based) + @type int + @param offset position within line of the issue + @type int + @param msgCode message code + @type str + @param args arguments for the message + @type list + """ + if self._ignoreCode(msgCode): + return + + if msgCode in self.counters: + self.counters[msgCode] += 1 + else: + self.counters[msgCode] = 1 + + # Don't care about expected codes + if msgCode in self.expected: + return + + if msgCode and (self.counters[msgCode] == 1 or self.repeat): + # record the issue with one based line number + self.errors.append( + { + "file": self.filename, + "line": lineNumber, + "offset": offset, + "code": msgCode, + "args": args, + } + ) + + def addErrorFromNode(self, node, msgCode, *args): + """ + Public method to record an issue given the faulty ast node. + + @param node reference to the node containing the issue + @type ast.AST + @param msgCode message code + @type str + @param args arguments for the message + @type list + """ + self.addError(node.lineno, node.col_offset, msgCode, *args) + + def run(self): + """ + Public method to execute the relevant checks. + """ + if not self.filename: + # don't do anything, if essential data is missing + return + + if not self.__checkers: + # don't do anything, if no codes were selected + return + + for check in self.__checkers: + check()
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Complexity/ComplexityChecker.py Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Complexity/ComplexityChecker.py Thu Feb 27 14:42:39 2025 +0100 @@ -8,12 +8,13 @@ """ import ast -import copy + +from CodeStyleTopicChecker import CodeStyleTopicChecker from .mccabe import PathGraphingAstVisitor -class ComplexityChecker: +class ComplexityChecker(CodeStyleTopicChecker): """ Class implementing a checker for code complexity. """ @@ -23,6 +24,7 @@ "C-111", "C-112", ] + Category = "C" def __init__(self, source, filename, tree, select, ignore, args): """ @@ -41,12 +43,17 @@ @param args dictionary of arguments for the miscellaneous checks @type dict """ - self.__filename = filename - self.__source = source[:] - self.__tree = copy.deepcopy(tree) - self.__select = tuple(select) - self.__ignore = tuple(ignore) - self.__args = args + super().__init__( + ComplexityChecker.Category, + source, + filename, + tree, + select, + ignore, + [], + True, + args, + ) self.__defaultArgs = { "McCabeComplexity": 10, @@ -54,82 +61,11 @@ "LineComplexityScore": 10, } - # statistics counters - self.counters = {} - - # collection of detected errors - self.errors = [] - checkersWithCodes = [ (self.__checkMcCabeComplexity, ("C-101",)), (self.__checkLineComplexity, ("C-111", "C-112")), ] - - self.__checkers = [] - for checker, codes in checkersWithCodes: - if any(not (code and self.__ignoreCode(code)) for code in codes): - self.__checkers.append(checker) - - def __ignoreCode(self, code): - """ - Private method to check if the message code should be ignored. - - @param code message code to check for - @type str - @return flag indicating to ignore the given code - @rtype bool - """ - return code in self.__ignore or ( - code.startswith(self.__ignore) and not code.startswith(self.__select) - ) - - def __error(self, lineNumber, offset, code, *args): - """ - Private method to record an issue. - - @param lineNumber line number of the issue - @type int - @param offset position within line of the issue - @type int - @param code message code - @type str - @param args arguments for the message - @type list - """ - if self.__ignoreCode(code): - return - - if code in self.counters: - self.counters[code] += 1 - else: - self.counters[code] = 1 - - if code: - # record the issue with one based line number - self.errors.append( - { - "file": self.__filename, - "line": lineNumber, - "offset": offset, - "code": code, - "args": args, - } - ) - - def run(self): - """ - Public method to check the given source for code complexity. - """ - if not self.__filename or not self.__source: - # don't do anything, if essential data is missing - return - - if not self.__checkers: - # don't do anything, if no codes were selected - return - - for check in self.__checkers: - check() + self._initializeCheckers(checkersWithCodes) def __checkMcCabeComplexity(self): """ @@ -138,13 +74,13 @@ try: # create the AST again because it is modified by the checker tree = compile( - "".join(self.__source), self.__filename, "exec", ast.PyCF_ONLY_AST + "".join(self.source), self.filename, "exec", ast.PyCF_ONLY_AST ) except (SyntaxError, TypeError): # compile errors are already reported by the run() method return - maxComplexity = self.__args.get( + maxComplexity = self.args.get( "McCabeComplexity", self.__defaultArgs["McCabeComplexity"] ) @@ -152,7 +88,9 @@ visitor.preorder(tree, visitor) for graph in visitor.graphs.values(): if graph.complexity() > maxComplexity: - self.__error(graph.lineno, 0, "C-101", graph.entity, graph.complexity()) + self.addError( + graph.lineno + 1, 0, "C-101", graph.entity, graph.complexity() + ) def __checkLineComplexity(self): """ @@ -162,25 +100,25 @@ Complexity is defined as the number of AST nodes produced by a line of code. """ - maxLineComplexity = self.__args.get( + maxLineComplexity = self.args.get( "LineComplexity", self.__defaultArgs["LineComplexity"] ) - maxLineComplexityScore = self.__args.get( + maxLineComplexityScore = self.args.get( "LineComplexityScore", self.__defaultArgs["LineComplexityScore"] ) visitor = LineComplexityVisitor() - visitor.visit(self.__tree) + visitor.visit(self.tree) sortedItems = visitor.sortedList() score = visitor.score() for line, complexity in sortedItems: if complexity > maxLineComplexity: - self.__error(line, 0, "C-111", complexity) + self.addError(line + 1, 0, "C-111", complexity) if score > maxLineComplexityScore: - self.__error(0, 0, "C-112", score) + self.addError(1, 0, "C-112", score) class LineComplexityVisitor(ast.NodeVisitor): @@ -206,6 +144,7 @@ """ if hasattr(node, "lineno"): self.__count[node.lineno] = self.__count.get(node.lineno, 0) + 1 + self.generic_visit(node) def sortedList(self):
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/DocStyle/DocStyleChecker.py Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/DocStyle/DocStyleChecker.py Thu Feb 27 14:42:39 2025 +0100 @@ -13,6 +13,7 @@ # import ast +import collections import contextlib import tokenize @@ -23,6 +24,8 @@ except AttributeError: ast.AsyncFunctionDef = ast.FunctionDef +from CodeStyleTopicChecker import CodeStyleTopicChecker + class DocStyleContext: """ @@ -127,7 +130,7 @@ return self.__special -class DocStyleChecker: +class DocStyleChecker(CodeStyleTopicChecker): """ Class implementing a checker for documentation string conventions. """ @@ -189,6 +192,7 @@ "D-272", "D-273", ] + Category = "D" def __init__( self, @@ -221,21 +225,20 @@ @param docType type of the documentation strings (one of 'eric' or 'pep257') @type str """ - self.__select = tuple(select) - self.__ignore = tuple(ignore) - self.__expected = expected[:] - self.__repeat = repeat + super().__init__( + DocStyleChecker.Category, + source, + filename, + None, + select, + ignore, + expected, + repeat, + [], + ) + self.__maxLineLength = maxLineLength self.__docType = docType - self.__filename = filename - self.__source = source[:] - - # statistics counters - self.counters = {} - - # collection of detected errors - self.errors = [] - self.__lineNumber = 0 # caches @@ -331,63 +334,29 @@ ], } - self.__checkers = {} + self.__checkers = collections.defaultdict(list) for key, checkers in checkersWithCodes.items(): for checker, codes in checkers: - if any(not (code and self.__ignoreCode(code)) for code in codes): - if key not in self.__checkers: - self.__checkers[key] = [] + if any( + not (msgCode and self._ignoreCode(msgCode)) for msgCode in codes + ): self.__checkers[key].append(checker) - def __ignoreCode(self, code): - """ - Private method to check if the error code should be ignored. - - @param code message code to check for - @type str - @return flag indicating to ignore the given code - @rtype bool + def addError(self, lineNumber, offset, msgCode, *args): """ - return code in self.__ignore or ( - code.startswith(self.__ignore) and not code.startswith(self.__select) - ) + Public method to record an issue. - def __error(self, lineNumber, offset, code, *args): - """ - Private method to record an issue. - - @param lineNumber line number of the issue + @param lineNumber line number of the issue (zero based) @type int @param offset position within line of the issue @type int - @param code message code + @param msgCode message code @type str @param args arguments for the message @type list """ - if self.__ignoreCode(code): - return - - if code in self.counters: - self.counters[code] += 1 - else: - self.counters[code] = 1 - - # Don't care about expected codes - if code in self.__expected: - return - - if code and (self.counters[code] == 1 or self.__repeat): - # record the issue with one based line number - self.errors.append( - { - "file": self.__filename, - "line": lineNumber + 1, - "offset": offset, - "code": code, - "args": args, - } - ) + # call super class method with one based line number + super().addError(lineNumber + 1, offset, msgCode, *args) def __resetReadline(self): """ @@ -403,16 +372,16 @@ @rtype str """ self.__lineNumber += 1 - if self.__lineNumber > len(self.__source): + if self.__lineNumber > len(self.source): return "" - return self.__source[self.__lineNumber - 1] + return self.source[self.__lineNumber - 1] def run(self): """ Public method to check the given source for violations of doc string conventions. """ - if not self.__filename: + if not self.filename: # don't do anything, if essential data is missing return @@ -420,11 +389,11 @@ # don't do anything, if no codes were selected return - for keyword in self.__keywords: - if keyword in self.__checkers: - for check in self.__checkers[keyword]: - for context in self.__parseContexts(keyword): - docstring = self.__parseDocstring(context, keyword) + for key in self.__keywords: + if key in self.__checkers: + for check in self.__checkers[key]: + for context in self.__parseContexts(key): + docstring = self.__parseDocstring(context, key) check(docstring, context) def __getSummaryLine(self, docstringContext): @@ -599,7 +568,7 @@ kind, value, (line, char), _, _ = next(tokenGenerator) end = line - 1, char contexts.append( - DocStyleContext(self.__source[start[0] : end[0]], start[0], keyword) + DocStyleContext(self.source[start[0] : end[0]], start[0], keyword) ) except StopIteration: return contexts @@ -676,12 +645,12 @@ startLine = classContext.start() + start[0] endLine = classContext.start() + end[0] context = DocStyleContext( - self.__source[startLine:endLine], startLine, "def" + self.source[startLine:endLine], startLine, "def" ) if startLine > 0: - if self.__source[startLine - 1].strip() == "@staticmethod": + if self.source[startLine - 1].strip() == "@staticmethod": context.setSpecial("staticmethod") - elif self.__source[startLine - 1].strip() == "@classmethod": + elif self.source[startLine - 1].strip() == "@classmethod": context.setSpecial("classmethod") contexts.append(context) self.__methodsCache = contexts @@ -698,7 +667,7 @@ @rtype list of DocStyleContext """ if kind == "moduleDocstring": - return [DocStyleContext(self.__source, 0, "module")] + return [DocStyleContext(self.source, 0, "module")] if kind == "functionDocstring": return self.__parseFunctions() if kind == "classDocstring": @@ -709,7 +678,7 @@ return self.__parseFunctions() + self.__parseMethods() if kind == "docstring": return ( - [DocStyleContext(self.__source, 0, "module")] + [DocStyleContext(self.source, 0, "module")] + self.__parseFunctions() + self.__parseClasses() + self.__parseMethods() @@ -730,18 +699,18 @@ @type DocStyleContext """ if docstringContext is None: - self.__error(context.start(), 0, "D-101") + self.addError(context.start(), 0, "D-101") return docstring = docstringContext.ssource() if not docstring or not docstring.strip() or not docstring.strip("'\""): - self.__error(context.start(), 0, "D-101") + self.addError(context.start(), 0, "D-101") if ( self.__docType == "eric" and docstring.strip("'\"").strip() == "Module documentation goes here." ): - self.__error(docstringContext.end(), 0, "D-201") + self.addError(docstringContext.end(), 0, "D-201") return def __checkFunctionDocstring(self, docstringContext, context): @@ -764,20 +733,20 @@ code = "D-102" if docstringContext is None: - self.__error(context.start(), 0, code) + self.addError(context.start(), 0, code) return docstring = docstringContext.ssource() if not docstring or not docstring.strip() or not docstring.strip("'\""): - self.__error(context.start(), 0, code) + self.addError(context.start(), 0, code) if self.__docType == "eric": if docstring.strip("'\"").strip() == "Function documentation goes here.": - self.__error(docstringContext.end(), 0, "D-202.1") + self.addError(docstringContext.end(), 0, "D-202.1") return if "DESCRIPTION" in docstring or "TYPE" in docstring: - self.__error(docstringContext.end(), 0, "D-202.2") + self.addError(docstringContext.end(), 0, "D-202.2") return def __checkClassDocstring(self, docstringContext, context): @@ -800,19 +769,19 @@ code = "D-104" if docstringContext is None: - self.__error(context.start(), 0, code) + self.addError(context.start(), 0, code) return docstring = docstringContext.ssource() if not docstring or not docstring.strip() or not docstring.strip("'\""): - self.__error(context.start(), 0, code) + self.addError(context.start(), 0, code) return if ( self.__docType == "eric" and docstring.strip("'\"").strip() == "Class documentation goes here." ): - self.__error(docstringContext.end(), 0, "D-206") + self.addError(docstringContext.end(), 0, "D-206") return def __checkTripleDoubleQuotes(self, docstringContext, _context): @@ -830,7 +799,7 @@ docstring = docstringContext.ssource().strip() if not docstring.startswith(('"""', 'r"""', 'u"""')): - self.__error(docstringContext.start(), 0, "D-111") + self.addError(docstringContext.start(), 0, "D-111") def __checkBackslashes(self, docstringContext, _context): """ @@ -847,7 +816,7 @@ docstring = docstringContext.ssource().strip() if "\\" in docstring and not docstring.startswith('r"""'): - self.__error(docstringContext.start(), 0, "D-112") + self.addError(docstringContext.start(), 0, "D-112") def __checkOneLiner(self, docstringContext, context): """ @@ -875,7 +844,7 @@ # account for a trailing dot modLen += 1 if modLen <= self.__maxLineLength: - self.__error(docstringContext.start(), 0, "D-121") + self.addError(docstringContext.start(), 0, "D-121") def __checkIndent(self, docstringContext, context): """ @@ -902,7 +871,7 @@ 0 if context.contextType() == "module" else len(context.indent()) + 4 ) if indent != expectedIndent: - self.__error(docstringContext.start(), 0, "D-122") + self.addError(docstringContext.start(), 0, "D-122") def __checkSummary(self, docstringContext, _context): """ @@ -918,7 +887,7 @@ summary, lineNumber = self.__getSummaryLine(docstringContext) if summary == "": - self.__error(docstringContext.start() + lineNumber, 0, "D-130") + self.addError(docstringContext.start() + lineNumber, 0, "D-130") def __checkEndsWithPeriod(self, docstringContext, _context): """ @@ -934,7 +903,7 @@ summary, lineNumber = self.__getSummaryLine(docstringContext) if not summary.endswith("."): - self.__error(docstringContext.start() + lineNumber, 0, "D-131") + self.addError(docstringContext.start() + lineNumber, 0, "D-131") def __checkImperativeMood(self, docstringContext, _context): """ @@ -953,7 +922,7 @@ if summary: firstWord = summary.strip().split()[0] if firstWord.endswith("s") and not firstWord.endswith("ss"): - self.__error(docstringContext.start() + lineNumber, 0, "D-132") + self.addError(docstringContext.start() + lineNumber, 0, "D-132") def __checkNoSignature(self, docstringContext, context): """ @@ -974,7 +943,7 @@ " ", "" ) and functionName + "()" not in summary.replace(" ", ""): # report only, if it is not an abbreviated form (i.e. function() ) - self.__error(docstringContext.start() + lineNumber, 0, "D-133") + self.addError(docstringContext.start() + lineNumber, 0, "D-133") def __checkReturnType(self, docstringContext, context): """ @@ -1001,7 +970,7 @@ set(return_) - {tokenize.COMMENT, tokenize.NL, tokenize.NEWLINE} != set() ): - self.__error(docstringContext.end(), 0, "D-134") + self.addError(docstringContext.end(), 0, "D-134") def __checkNoBlankLineBefore(self, docstringContext, context): """ @@ -1026,7 +995,7 @@ return if not contextLines[cti - 1].strip(): - self.__error(docstringContext.start(), 0, "D-141") + self.addError(docstringContext.start(), 0, "D-141") def __checkBlankBeforeAndAfterClass(self, docstringContext, context): """ @@ -1064,9 +1033,9 @@ return if contextLines[start - 1].strip(): - self.__error(docstringContext.start(), 0, "D-142") + self.addError(docstringContext.start(), 0, "D-142") if contextLines[end + 1].strip(): - self.__error(docstringContext.end(), 0, "D-143") + self.addError(docstringContext.end(), 0, "D-143") def __checkBlankAfterSummary(self, docstringContext, _context): """ @@ -1088,7 +1057,7 @@ summary, lineNumber = self.__getSummaryLine(docstringContext) if len(docstrings) > 2 and docstrings[lineNumber + 1].strip(): - self.__error(docstringContext.start() + lineNumber, 0, "D-144") + self.addError(docstringContext.start() + lineNumber, 0, "D-144") def __checkBlankAfterLastParagraph(self, docstringContext, _context): """ @@ -1109,7 +1078,7 @@ return if docstrings[-2].strip(): - self.__error(docstringContext.end(), 0, "D-145") + self.addError(docstringContext.end(), 0, "D-145") ################################################################## ## Checking functionality below (eric specific ones) @@ -1130,9 +1099,9 @@ lines = docstringContext.source() if lines[0].strip().strip("ru\"'"): - self.__error(docstringContext.start(), 0, "D-221") + self.addError(docstringContext.start(), 0, "D-221") if lines[-1].strip().strip("\"'"): - self.__error(docstringContext.end(), 0, "D-222") + self.addError(docstringContext.end(), 0, "D-222") def __checkEricEndsWithPeriod(self, docstringContext, _context): """ @@ -1156,7 +1125,7 @@ and not summary.endswith(".") and summary.split(None, 1)[0].lower() != "constructor" ): - self.__error( + self.addError( docstringContext.start() + lineNumber + len(summaryLines) - 1, 0, "D-231", @@ -1184,13 +1153,13 @@ set(return_) - {tokenize.COMMENT, tokenize.NL, tokenize.NEWLINE} != set() ): - self.__error(docstringContext.end(), 0, "D-234r") + self.addError(docstringContext.end(), 0, "D-234r") else: if ( set(return_) - {tokenize.COMMENT, tokenize.NL, tokenize.NEWLINE} == set() ): - self.__error(docstringContext.end(), 0, "D-235r") + self.addError(docstringContext.end(), 0, "D-235r") def __checkEricYield(self, docstringContext, context): """ @@ -1211,10 +1180,10 @@ ] if "@yield" not in docstringContext.ssource(): if set(yield_) - {tokenize.COMMENT, tokenize.NL, tokenize.NEWLINE} != set(): - self.__error(docstringContext.end(), 0, "D-234y") + self.addError(docstringContext.end(), 0, "D-234y") else: if set(yield_) - {tokenize.COMMENT, tokenize.NL, tokenize.NEWLINE} == set(): - self.__error(docstringContext.end(), 0, "D-235y") + self.addError(docstringContext.end(), 0, "D-235y") def __checkEricFunctionArguments(self, docstringContext, context): """ @@ -1253,11 +1222,11 @@ if tagstring.count("@param") + tagstring.count("@keyparam") < len( argNames + kwNames ): - self.__error(docstringContext.end(), 0, "D-236") + self.addError(docstringContext.end(), 0, "D-236") elif tagstring.count("@param") + tagstring.count("@keyparam") > len( argNames + kwNames ): - self.__error(docstringContext.end(), 0, "D-237") + self.addError(docstringContext.end(), 0, "D-237") else: # extract @param and @keyparam from docstring args = [] @@ -1274,10 +1243,10 @@ # do the checks for name in kwNames: if name not in kwargs: - self.__error(docstringContext.end(), 0, "D-238") + self.addError(docstringContext.end(), 0, "D-238") return if argNames + kwNames != args: - self.__error(docstringContext.end(), 0, "D-239") + self.addError(docstringContext.end(), 0, "D-239") def __checkEricException(self, docstringContext, context): """ @@ -1317,10 +1286,10 @@ and "@raise" not in docstringContext.ssource() ): if exceptions - {tokenize.COMMENT, tokenize.NL, tokenize.NEWLINE} != set(): - self.__error(docstringContext.end(), 0, "D-250") + self.addError(docstringContext.end(), 0, "D-250") else: if exceptions - {tokenize.COMMENT, tokenize.NL, tokenize.NEWLINE} == set(): - self.__error(docstringContext.end(), 0, "D-251") + self.addError(docstringContext.end(), 0, "D-251") else: # step 1: extract documented exceptions documentedExceptions = set() @@ -1334,12 +1303,12 @@ # step 2: report undocumented exceptions for exception in raisedExceptions: if exception not in documentedExceptions: - self.__error(docstringContext.end(), 0, "D-252", exception) + self.addError(docstringContext.end(), 0, "D-252", exception) # step 3: report undefined signals for exception in documentedExceptions: if exception not in raisedExceptions: - self.__error(docstringContext.end(), 0, "D-253", exception) + self.addError(docstringContext.end(), 0, "D-253", exception) def __checkEricSignal(self, docstringContext, context): """ @@ -1368,10 +1337,10 @@ definedSignals.add(tokens[i - 2][1]) if "@signal" not in docstringContext.ssource() and definedSignals: - self.__error(docstringContext.end(), 0, "D-260") + self.addError(docstringContext.end(), 0, "D-260") elif "@signal" in docstringContext.ssource(): if not definedSignals: - self.__error(docstringContext.end(), 0, "D-261") + self.addError(docstringContext.end(), 0, "D-261") else: # step 1: extract documented signals documentedSignals = set() @@ -1388,12 +1357,12 @@ # step 2: report undocumented signals for signal in definedSignals: if signal not in documentedSignals: - self.__error(docstringContext.end(), 0, "D-262", signal) + self.addError(docstringContext.end(), 0, "D-262", signal) # step 3: report undefined signals for signal in documentedSignals: if signal not in definedSignals: - self.__error(docstringContext.end(), 0, "D-263", signal) + self.addError(docstringContext.end(), 0, "D-263", signal) def __checkEricBlankAfterSummary(self, docstringContext, _context): """ @@ -1418,7 +1387,7 @@ len(docstrings) - 2 > lineNumber + len(summaryLines) - 1 and docstrings[lineNumber + len(summaryLines)].strip() ): - self.__error(docstringContext.start() + lineNumber, 0, "D-246") + self.addError(docstringContext.start() + lineNumber, 0, "D-246") def __checkEricNoBlankBeforeAndAfterClassOrFunction( self, docstringContext, context @@ -1460,14 +1429,14 @@ if isClassContext: if not contextLines[start - 1].strip(): - self.__error(docstringContext.start(), 0, "D-242") + self.addError(docstringContext.start(), 0, "D-242") if not contextLines[end + 1].strip() and self.__docType == "eric": - self.__error(docstringContext.end(), 0, "D-243") + self.addError(docstringContext.end(), 0, "D-243") elif contextLines[end + 1].strip() and self.__docType == "eric_black": - self.__error(docstringContext.end(), 0, "D-143") + self.addError(docstringContext.end(), 0, "D-143") else: if not contextLines[start - 1].strip(): - self.__error(docstringContext.start(), 0, "D-244") + self.addError(docstringContext.start(), 0, "D-244") if not contextLines[end + 1].strip(): if ( self.__docType == "eric_black" @@ -1476,7 +1445,7 @@ ): return - self.__error(docstringContext.end(), 0, "D-245") + self.addError(docstringContext.end(), 0, "D-245") def __checkEricNBlankAfterLastParagraph(self, docstringContext, _context): """ @@ -1497,7 +1466,7 @@ return if not docstrings[-2].strip(): - self.__error(docstringContext.end(), 0, "D-247") + self.addError(docstringContext.end(), 0, "D-247") def __checkEricSummary(self, docstringContext, context): """ @@ -1522,24 +1491,24 @@ firstWord = summary.strip().split(None, 1)[0].lower() if functionName == "__init__": if firstWord != "constructor": - self.__error( + self.addError( docstringContext.start() + lineNumber, 0, "D-232", "constructor" ) elif functionName.startswith("__") and functionName.endswith("__"): if firstWord != "special": - self.__error( + self.addError( docstringContext.start() + lineNumber, 0, "D-232", "special" ) elif context.special() == "staticmethod": secondWord = summary.strip().split(None, 2)[1].lower() if firstWord != "static" and secondWord != "static": - self.__error( + self.addError( docstringContext.start() + lineNumber, 0, "D-232", "static" ) elif secondWord == "static": if functionName.startswith(("__", "on_")): if firstWord != "private": - self.__error( + self.addError( docstringContext.start() + lineNumber, 0, "D-232", @@ -1547,7 +1516,7 @@ ) elif functionName.startswith("_") or functionName.endswith("Event"): if firstWord != "protected": - self.__error( + self.addError( docstringContext.start() + lineNumber, 0, "D-232", @@ -1555,7 +1524,7 @@ ) else: if firstWord != "public": - self.__error( + self.addError( docstringContext.start() + lineNumber, 0, "D-232", @@ -1567,13 +1536,13 @@ ): secondWord = summary.strip().split(None, 2)[1].lower() if firstWord != "class" and secondWord != "class": - self.__error( + self.addError( docstringContext.start() + lineNumber, 0, "D-232", "class" ) elif secondWord == "class": if functionName.startswith(("__", "on_")): if firstWord != "private": - self.__error( + self.addError( docstringContext.start() + lineNumber, 0, "D-232", @@ -1581,7 +1550,7 @@ ) elif functionName.startswith("_") or functionName.endswith("Event"): if firstWord != "protected": - self.__error( + self.addError( docstringContext.start() + lineNumber, 0, "D-232", @@ -1589,7 +1558,7 @@ ) else: if firstWord != "public": - self.__error( + self.addError( docstringContext.start() + lineNumber, 0, "D-232", @@ -1597,17 +1566,17 @@ ) elif functionName.startswith(("__", "on_")): if firstWord != "private": - self.__error( + self.addError( docstringContext.start() + lineNumber, 0, "D-232", "private" ) elif functionName.startswith("_") or functionName.endswith("Event"): if firstWord != "protected": - self.__error( + self.addError( docstringContext.start() + lineNumber, 0, "D-232", "protected" ) else: if firstWord != "public": - self.__error( + self.addError( docstringContext.start() + lineNumber, 0, "D-232", "public" ) @@ -1642,7 +1611,7 @@ and lineno > 0 and lines[lineno - 1].strip() == "" ): - self.__error( + self.addError( docstringContext.start() + lineno, 0, "D-271", docToken ) @@ -1656,15 +1625,15 @@ docToken2 = "" if docToken in ("@param", "@keyparam") and docToken2 != "@type": - self.__error( + self.addError( docstringContext.start() + lineno, 0, "D-270", docToken, "@type" ) elif docToken == "@return" and docToken2 != "@rtype": - self.__error( + self.addError( docstringContext.start() + lineno, 0, "D-270", docToken, "@rtype" ) elif docToken == "@yield" and docToken2 != "@ytype": - self.__error( + self.addError( docstringContext.start() + lineno, 0, "D-270", docToken, "@ytype" ) @@ -1698,7 +1667,7 @@ # it is a tag line tag = strippedLine.split(None, 1)[0] with contextlib.suppress(KeyError): - self.__error( + self.addError( docstringContext.start() + lineno, 0, "D-272", @@ -1737,4 +1706,4 @@ tag = strippedLine.split(None, 1)[0] currentIndentation = len(line) - len(strippedLine) if currentIndentation != indentationLength: - self.__error(docstringContext.start() + lineno, 0, "D-273", tag) + self.addError(docstringContext.start() + lineno, 0, "D-273", tag)
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Imports/ImportsChecker.py Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Imports/ImportsChecker.py Thu Feb 27 14:42:39 2025 +0100 @@ -11,8 +11,10 @@ import copy import re +from CodeStyleTopicChecker import CodeStyleTopicChecker -class ImportsChecker: + +class ImportsChecker(CodeStyleTopicChecker): """ Class implementing a checker for import statements. """ @@ -28,6 +30,7 @@ "I-903", "I-904", ] + Category = "I" def __init__(self, source, filename, tree, select, ignore, expected, repeat, args): """ @@ -50,96 +53,23 @@ @param args dictionary of arguments for the various checks @type dict """ - self.__select = tuple(select) - self.__ignore = tuple(ignore) - self.__expected = expected[:] - self.__repeat = repeat - self.__filename = filename - self.__source = source[:] - self.__tree = copy.deepcopy(tree) - self.__args = args - - # statistics counters - self.counters = {} - - # collection of detected errors - self.errors = [] + super().__init__( + ImportsChecker.Category, + source, + filename, + tree, + select, + ignore, + expected, + repeat, + args, + ) checkersWithCodes = [ (self.__checkLocalImports, ("I-101", "I-102", "I-103")), (self.__tidyImports, ("I-901", "I-902", "I-903", "I-904")), ] - - self.__checkers = [] - for checker, codes in checkersWithCodes: - if any(not (code and self.__ignoreCode(code)) for code in codes): - self.__checkers.append(checker) - - def __ignoreCode(self, code): - """ - Private method to check if the message code should be ignored. - - @param code message code to check for - @type str - @return flag indicating to ignore the given code - @rtype bool - """ - return code in self.__ignore or ( - code.startswith(self.__ignore) and not code.startswith(self.__select) - ) - - def __error(self, lineNumber, offset, code, *args): - """ - Private method to record an issue. - - @param lineNumber line number of the issue - @type int - @param offset position within line of the issue - @type int - @param code message code - @type str - @param args arguments for the message - @type list - """ - if self.__ignoreCode(code): - return - - if code in self.counters: - self.counters[code] += 1 - else: - self.counters[code] = 1 - - # Don't care about expected codes - if code in self.__expected: - return - - if code and (self.counters[code] == 1 or self.__repeat): - # record the issue with one based line number - self.errors.append( - { - "file": self.__filename, - "line": lineNumber + 1, - "offset": offset, - "code": code, - "args": args, - } - ) - - def run(self): - """ - Public method to check the given source against miscellaneous - conditions. - """ - if not self.__filename: - # don't do anything, if essential data is missing - return - - if not self.__checkers: - # don't do anything, if no codes were selected - return - - for check in self.__checkers: - check() + self._initializeCheckers(checkersWithCodes) ####################################################################### ## Local imports @@ -153,13 +83,10 @@ """ from .LocalImportVisitor import LocalImportVisitor - visitor = LocalImportVisitor(self.__args, self) - visitor.visit(copy.deepcopy(self.__tree)) + visitor = LocalImportVisitor(self.args, self) + visitor.visit(copy.deepcopy(self.tree)) for violation in visitor.violations: - if not self.__ignoreCode(violation[1]): - node = violation[0] - reason = violation[1] - self.__error(node.lineno - 1, node.col_offset, reason) + self.addErrorFromNode(violation[0], violation[1]) ####################################################################### ## Tidy imports @@ -171,11 +98,11 @@ """ Private method to check various other import related topics. """ - self.__banRelativeImports = self.__args.get("BanRelativeImports", "") + self.__banRelativeImports = self.args.get("BanRelativeImports", "") self.__bannedModules = [] self.__bannedStructuredPatterns = [] self.__bannedUnstructuredPatterns = [] - for module in self.__args.get("BannedModules", []): + for module in self.args.get("BannedModules", []): module = module.strip() if "*" in module[:-1] or module == "*": # unstructured @@ -197,16 +124,16 @@ self.__bannedStructuredPatterns.sort(key=lambda x: len(x[0]), reverse=True) ruleMethods = [] - if not self.__ignoreCode("I-901"): + if not self._ignoreCode("I-901"): ruleMethods.append(self.__checkUnnecessaryAlias) - if not self.__ignoreCode("I-902") and bool(self.__bannedModules): + if not self._ignoreCode("I-902") and bool(self.__bannedModules): ruleMethods.append(self.__checkBannedImport) if ( - not self.__ignoreCode("I-903") and self.__banRelativeImports == "parents" - ) or (not self.__ignoreCode("I-904") and self.__banRelativeImports == "true"): + not self._ignoreCode("I-903") and self.__banRelativeImports == "parents" + ) or (not self._ignoreCode("I-904") and self.__banRelativeImports == "true"): ruleMethods.append(self.__checkBannedRelativeImports) - for node in ast.walk(self.__tree): + for node in ast.walk(self.tree): for method in ruleMethods: method(node) @@ -251,14 +178,14 @@ else: rewritten = f"import {importedName}" - self.__error(node.lineno - 1, node.col_offset, "I-901", rewritten) + self.addErrorFromNode(node, "I-901", rewritten) elif isinstance(node, ast.ImportFrom): for alias in node.names: if alias.name == alias.asname: rewritten = f"from {node.module} import {alias.name}" - self.__error(node.lineno - 1, node.col_offset, "I-901", rewritten) + self.addErrorFromNode(node, "I-901", rewritten) def __isModuleBanned(self, moduleName): """ @@ -326,7 +253,7 @@ continue else: warned.add(moduleName) - self.__error(node.lineno - 1, node.col_offset, "I-902", moduleName) + self.addErrorFromNode(node, "I-902", moduleName) def __checkBannedRelativeImports(self, node): """ @@ -347,4 +274,4 @@ msgCode = "I-904" if isinstance(node, ast.ImportFrom) and node.level > minNodeLevel: - self.__error(node.lineno - 1, node.col_offset, msgCode) + self.addErrorFromNode(node, msgCode)
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Logging/LoggingChecker.py Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Logging/LoggingChecker.py Thu Feb 27 14:42:39 2025 +0100 @@ -7,10 +7,10 @@ Module implementing a checker for logging related issues. """ -import copy +from CodeStyleTopicChecker import CodeStyleTopicChecker -class LoggingChecker: +class LoggingChecker(CodeStyleTopicChecker): """ Class implementing a checker for logging related issues. """ @@ -33,6 +33,7 @@ "L-114", "L-115", ] + Category = "L" def __init__(self, source, filename, tree, select, ignore, expected, repeat, args): """ @@ -55,20 +56,17 @@ @param args dictionary of arguments for the various checks @type dict """ - self.__select = tuple(select) - self.__ignore = tuple(ignore) - self.__expected = expected[:] - self.__repeat = repeat - self.__filename = filename - self.__source = source[:] - self.__tree = copy.deepcopy(tree) - self.__args = args - - # statistics counters - self.counters = {} - - # collection of detected errors - self.errors = [] + super().__init__( + LoggingChecker.Category, + source, + filename, + tree, + select, + ignore, + expected, + repeat, + args, + ) checkersWithCodes = [ ( @@ -92,77 +90,7 @@ ), ), ] - - self.__checkers = [] - for checker, codes in checkersWithCodes: - if any(not (code and self.__ignoreCode(code)) for code in codes): - self.__checkers.append(checker) - - def __ignoreCode(self, code): - """ - Private method to check if the message code should be ignored. - - @param code message code to check for - @type str - @return flag indicating to ignore the given code - @rtype bool - """ - return code in self.__ignore or ( - code.startswith(self.__ignore) and not code.startswith(self.__select) - ) - - def __error(self, lineNumber, offset, code, *args): - """ - Private method to record an issue. - - @param lineNumber line number of the issue - @type int - @param offset position within line of the issue - @type int - @param code message code - @type str - @param args arguments for the message - @type list - """ - if self.__ignoreCode(code): - return - - if code in self.counters: - self.counters[code] += 1 - else: - self.counters[code] = 1 - - # Don't care about expected codes - if code in self.__expected: - return - - if code and (self.counters[code] == 1 or self.__repeat): - # record the issue with one based line number - self.errors.append( - { - "file": self.__filename, - "line": lineNumber + 1, - "offset": offset, - "code": code, - "args": args, - } - ) - - def run(self): - """ - Public method to check the given source against miscellaneous - conditions. - """ - if not self.__filename: - # don't do anything, if essential data is missing - return - - if not self.__checkers: - # don't do anything, if no codes were selected - return - - for check in self.__checkers: - check() + self._initializeCheckers(checkersWithCodes) def __checkLogging(self): """ @@ -170,5 +98,5 @@ """ from .LoggingVisitor import LoggingVisitor - visitor = LoggingVisitor(errorCallback=self.__error) - visitor.visit(self.__tree) + visitor = LoggingVisitor(errorCallback=self.addErrorFromNode) + visitor.visit(self.tree)
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Logging/LoggingVisitor.py Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Logging/LoggingVisitor.py Thu Feb 27 14:42:39 2025 +0100 @@ -173,13 +173,9 @@ if node.module == "logging": for alias in node.names: if alias.name == "WARN": - if sys.version_info >= (3, 10): - lineno = alias.lineno - colOffset = alias.col_offset - else: - lineno = node.lineno - colOffset = node.col_offset - self.__error(lineno - 1, colOffset, "L-109") + self.__error( + alias if sys.version_info >= (3, 10) else node, "L-109" + ) if not alias.asname: self.__fromImports[alias.name] = node.module @@ -198,7 +194,7 @@ and node.value.id == self.__loggingName and node.attr == "WARN" ): - self.__error(node.lineno - 1, node.col_offset, "L-109") + self.__error(node, "L-109") self.generic_visit(node) @@ -223,7 +219,7 @@ and self.__fromImports.get("Logger") == "logging" ) ) and not self.__atModuleLevel(): - self.__error(node.lineno - 1, node.col_offset, "L-101") + self.__error(node, "L-101") if ( isinstance(node.func, ast.Attribute) @@ -236,7 +232,7 @@ and node.func.id in _LoggerMethods and self.__fromImports.get(node.func.id) == "logging" ): - self.__error(node.lineno - 1, node.col_offset, "L-115") + self.__error(node, "L-115") if ( self.__loggingName @@ -263,7 +259,7 @@ and isinstance(node.args[0], ast.Name) and node.args[0].id in self.GetLoggerNames ): - self.__error(node.args[0].lineno - 1, node.args[0].col_offset, "L-102") + self.__error(node.args[0], "L-102") if ( isinstance(node.func, ast.Attribute) @@ -277,7 +273,7 @@ # L108 if node.func.attr == "warn": - self.__error(node.lineno - 1, node.col_offset, "L-108") + self.__error(node, "L-108") # L103 extraKeys = [] @@ -301,14 +297,12 @@ for key, keyNode in extraKeys: if key in _LogrecordAttributes: - self.__error( - keyNode.lineno - 1, keyNode.col_offset, "L-103", repr(key) - ) + self.__error(keyNode, "L-103", repr(key)) if node.func.attr == "exception": # L104 if not excHandler: - self.__error(node.lineno - 1, node.col_offset, "L-104") + self.__error(node, "L-104") if any((excInfo := kw).arg == "exc_info" for kw in node.keywords): # L106 @@ -319,14 +313,14 @@ and isinstance(excInfo.value, ast.Name) and excInfo.value.id == excHandler.name ): - self.__error(excInfo.lineno - 1, excInfo.col_offset, "L-106") + self.__error(excInfo, "L-106") # L107 elif ( isinstance(excInfo.value, ast.Constant) and not excInfo.value.value ): - self.__error(excInfo.lineno - 1, excInfo.col_offset, "L-107") + self.__error(excInfo, "L-107") # L105 elif node.func.attr == "error" and excHandler is not None: @@ -343,7 +337,7 @@ rewritable = True if rewritable: - self.__error(node.lineno - 1, node.col_offset, "L-105") + self.__error(node, "L-105") # L114 elif ( @@ -352,7 +346,7 @@ and isinstance(excInfo.value, ast.Constant) and excInfo.value.value ): - self.__error(excInfo.lineno - 1, excInfo.col_offset, "L-114") + self.__error(excInfo, "L-114") # L110 if ( @@ -362,7 +356,7 @@ and excHandler is not None and node.args[0].id == excHandler.name ): - self.__error(node.args[0].lineno - 1, node.args[0].col_offset, "L-110") + self.__error(node.args[0], "L-110") msgArgKwarg = False if node.func.attr == "log" and len(node.args) >= 2: @@ -378,7 +372,7 @@ # L111 if isinstance(msgArg, ast.JoinedStr): - self.__error(msgArg.lineno - 1, msgArg.col_offset, "L-111a") + self.__error(msgArg, "L-111a") elif ( isinstance(msgArg, ast.Call) and isinstance(msgArg.func, ast.Attribute) @@ -386,16 +380,16 @@ and isinstance(msgArg.func.value.value, str) and msgArg.func.attr == "format" ): - self.__error(msgArg.lineno - 1, msgArg.col_offset, "L-111b") + self.__error(msgArg, "L-111b") elif ( isinstance(msgArg, ast.BinOp) and isinstance(msgArg.op, ast.Mod) and isinstance(msgArg.left, ast.Constant) and isinstance(msgArg.left.value, str) ): - self.__error(msgArg.lineno - 1, msgArg.col_offset, "L-111c") + self.__error(msgArg, "L-111c") elif isinstance(msgArg, ast.BinOp) and self.__isAddChainWithNonStr(msgArg): - self.__error(msgArg.lineno - 1, msgArg.col_offset, "L-111d") + self.__error(msgArg, "L-111d") # L112 if ( @@ -441,20 +435,12 @@ # L113 given = {cast(ast.Constant, k).value for k in dictNode.keys} if missing := modnames - given: - self.__error( - msgArg.lineno - 1, - msgArg.col_offset, - "L-113a", # missing keys - ", ".join([repr(k) for k in missing]), - ) + # missing keys + self.__error(msgArg, "L-113a", ", ".join([repr(k) for k in missing])) if missing := given - modnames: - self.__error( - msgArg.lineno - 1, - msgArg.col_offset, - "L-113b", # unreferenced keys - ", ".join([repr(k) for k in missing]), - ) + # unreferenced keys + self.__error(msgArg, "L-113b", ", ".join([repr(k) for k in missing])) return @@ -467,14 +453,7 @@ argCount = len(node.args) - 1 - (node.func.attr == "log") if modposCount > 0 and modposCount != argCount: - self.__error( - msgArg.lineno - 1, - msgArg.col_offset, - "L-112", - modposCount, - "'%'", # noqa: M-601 - argCount, - ) + self.__error(msgArg, "L-112", modposCount, "'%'", argCount) # noqa: M-601 return def __atModuleLevel(self):
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/BugBearVisitor.py Thu Feb 27 14:42:39 2025 +0100 @@ -0,0 +1,2101 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2025 Detlev Offenbach <detlev@die-offenbachs.de> +# + +""" +Module implementing a visitor to check for various potential issues. +""" + +import ast +import builtins +import contextlib +import itertools +import math +import re + +from collections import Counter, namedtuple +from dataclasses import dataclass +from keyword import iskeyword + +import AstUtilities + +####################################################################### +## adapted from: flake8-bugbear v24.12.12 +## +## Original: Copyright (c) 2016 Łukasz Langa +####################################################################### + +BugbearMutableLiterals = ("Dict", "List", "Set") +BugbearMutableComprehensions = ("ListComp", "DictComp", "SetComp") +BugbearMutableCalls = ( + "Counter", + "OrderedDict", + "collections.Counter", + "collections.OrderedDict", + "collections.defaultdict", + "collections.deque", + "defaultdict", + "deque", + "dict", + "list", + "set", +) +BugbearImmutableCalls = ( + "tuple", + "frozenset", + "types.MappingProxyType", + "MappingProxyType", + "re.compile", + "operator.attrgetter", + "operator.itemgetter", + "operator.methodcaller", + "attrgetter", + "itemgetter", + "methodcaller", +) + + +BugBearContext = namedtuple("BugBearContext", ["node", "stack"]) + + +def composeCallPath(node): + """ + Generator function to assemble the call path of a given node. + + @param node node to assemble call path for + @type ast.Node + @yield call path components + @ytype str + """ + if isinstance(node, ast.Attribute): + yield from composeCallPath(node.value) + yield node.attr + elif isinstance(node, ast.Call): + yield from composeCallPath(node.func) + elif isinstance(node, ast.Name): + yield node.id + + +@dataclass +class M540CaughtException: + """ + Class to hold the data for a caught exception. + """ + + name: str + hasNote: bool + + +class M541UnhandledKeyType: + """ + Class to hold a dictionary key of a type that we do not check for duplicates. + """ + + +class M541VariableKeyType: + """ + Class to hold the name of a variable key type. + """ + + def __init__(self, name): + """ + Constructor + + @param name name of the variable key type + @type str + """ + self.name = name + + +class BugBearVisitor(ast.NodeVisitor): + """ + Class implementing a node visitor to check for various topics. + """ + + CONTEXTFUL_NODES = ( + ast.Module, + ast.ClassDef, + ast.AsyncFunctionDef, + ast.FunctionDef, + ast.Lambda, + ast.ListComp, + ast.SetComp, + ast.DictComp, + ast.GeneratorExp, + ) + + FUNCTION_NODES = ( + ast.AsyncFunctionDef, + ast.FunctionDef, + ast.Lambda, + ) + + NodeWindowSize = 4 + + def __init__(self): + """ + Constructor + """ + super().__init__() + + self.nodeWindow = [] + self.violations = [] + self.contexts = [] + + self.__M523Seen = set() + self.__M505Imports = set() + self.__M540CaughtException = None + + self.__inTryStar = "" + + @property + def nodeStack(self): + """ + Public method to get a reference to the most recent node stack. + + @return reference to the most recent node stack + @rtype list + """ + if len(self.contexts) == 0: + return [] + + context, stack = self.contexts[-1] + return stack + + def __isIdentifier(self, arg): + """ + Private method to check if arg is a valid identifier. + + See https://docs.python.org/2/reference/lexical_analysis.html#identifiers + + @param arg reference to an argument node + @type ast.Node + @return flag indicating a valid identifier + @rtype TYPE + """ + if not AstUtilities.isString(arg): + return False + + return ( + re.match(r"^[A-Za-z_][A-Za-z0-9_]*$", AstUtilities.getValue(arg)) + is not None + ) + + def toNameStr(self, node): + """ + Public method to turn Name and Attribute nodes to strings, handling any + depth of attribute accesses. + + + @param node reference to the node + @type ast.Name or ast.Attribute + @return string representation + @rtype str + """ + if isinstance(node, ast.Name): + return node.id + elif isinstance(node, ast.Call): + return self.toNameStr(node.func) + elif isinstance(node, ast.Attribute): + inner = self.toNameStr(node.value) + if inner is None: + return None + return f"{inner}.{node.attr}" + else: + return None + + def __typesafeIssubclass(self, obj, classOrTuple): + """ + Private method implementing a type safe issubclass() function. + + @param obj reference to the object to be tested + @type Any + @param classOrTuple type to check against + @type type + @return flag indicating a subclass + @rtype bool + """ + try: + return issubclass(obj, classOrTuple) + except TypeError: + # User code specifies a type that is not a type in our current run. + # Might be their error, might be a difference in our environments. + # We don't know so we ignore this. + return False + + def __getAssignedNames(self, loopNode): + """ + Private method to get the names of a for loop. + + @param loopNode reference to the node to be processed + @type ast.For + @yield DESCRIPTION + @ytype TYPE + """ + loopTargets = (ast.For, ast.AsyncFor, ast.comprehension) + for node in self.__childrenInScope(loopNode): + if isinstance(node, (ast.Assign)): + for child in node.targets: + yield from self.__namesFromAssignments(child) + if isinstance(node, loopTargets + (ast.AnnAssign, ast.AugAssign)): + yield from self.__namesFromAssignments(node.target) + + def __namesFromAssignments(self, assignTarget): + """ + Private method to get names of an assignment. + + @param assignTarget reference to the node to be processed + @type ast.Node + @yield name of the assignment + @ytype str + """ + if isinstance(assignTarget, ast.Name): + yield assignTarget.id + elif isinstance(assignTarget, ast.Starred): + yield from self.__namesFromAssignments(assignTarget.value) + elif isinstance(assignTarget, (ast.List, ast.Tuple)): + for child in assignTarget.elts: + yield from self.__namesFromAssignments(child) + + def __childrenInScope(self, node): + """ + Private method to get all child nodes in the given scope. + + @param node reference to the node to be processed + @type ast.Node + @yield reference to a child node + @ytype ast.Node + """ + yield node + if not isinstance(node, BugBearVisitor.FUNCTION_NODES): + for child in ast.iter_child_nodes(node): + yield from self.__childrenInScope(child) + + def __flattenExcepthandler(self, node): + """ + Private method to flatten the list of exceptions handled by an except handler. + + @param node reference to the node to be processed + @type ast.Node + @yield reference to the exception type node + @ytype ast.Node + """ + if not isinstance(node, ast.Tuple): + yield node + return + + exprList = node.elts.copy() + while len(exprList): + expr = exprList.pop(0) + if isinstance(expr, ast.Starred) and isinstance( + expr.value, (ast.List, ast.Tuple) + ): + exprList.extend(expr.value.elts) + continue + yield expr + + def __checkRedundantExcepthandlers(self, names, node, inTryStar): + """ + Private method to check for redundant exception types in an exception handler. + + @param names list of exception types to be checked + @type list of ast.Name + @param node reference to the exception handler node + @type ast.ExceptionHandler + @param inTryStar character indicating an 'except*' handler + @type str + @return tuple containing the error data + @rtype tuple of (ast.Node, str, str, str, str) + """ + redundantExceptions = { + "OSError": { + # All of these are actually aliases of OSError since Python 3.3 + "IOError", + "EnvironmentError", + "WindowsError", + "mmap.error", + "socket.error", + "select.error", + }, + "ValueError": { + "binascii.Error", + }, + } + + # See if any of the given exception names could be removed, e.g. from: + # (MyError, MyError) # duplicate names # noqa: M-891 + # (MyError, BaseException) # everything derives from the Base # noqa: M-891 + # (Exception, TypeError) # builtins where one subclasses another + # noqa: M-891 + # (IOError, OSError) # IOError is an alias of OSError since Python3.3 + # noqa: M-891 + # but note that other cases are impractical to handle from the AST. + # We expect this is mostly useful for users who do not have the + # builtin exception hierarchy memorised, and include a 'shadowed' + # subtype without realising that it's redundant. + good = sorted(set(names), key=names.index) + if "BaseException" in good: + good = ["BaseException"] + # Remove redundant exceptions that the automatic system either handles + # poorly (usually aliases) or can't be checked (e.g. it's not an + # built-in exception). + for primary, equivalents in redundantExceptions.items(): + if primary in good: + good = [g for g in good if g not in equivalents] + + for name, other in itertools.permutations(tuple(good), 2): + if ( + self.__typesafeIssubclass( + getattr(builtins, name, type), getattr(builtins, other, ()) + ) + and name in good + ): + good.remove(name) + if good != names: + desc = good[0] if len(good) == 1 else "({0})".format(", ".join(good)) + as_ = " as " + node.name if node.name is not None else "" + return (node, "M-514", ", ".join(names), as_, desc, inTryStar) + + return None + + def __walkList(self, nodes): + """ + Private method to walk a given list of nodes. + + @param nodes list of nodes to walk + @type list of ast.Node + @yield node references as determined by the ast.walk() function + @ytype ast.Node + """ + for node in nodes: + yield from ast.walk(node) + + def __getNamesFromTuple(self, node): + """ + Private method to get the names from an ast.Tuple node. + + @param node ast node to be processed + @type ast.Tuple + @yield names + @ytype str + """ + for dim in node.elts: + if isinstance(dim, ast.Name): + yield dim.id + elif isinstance(dim, ast.Tuple): + yield from self.__getNamesFromTuple(dim) + + def __getDictCompLoopAndNamedExprVarNames(self, node): + """ + Private method to get the names of comprehension loop variables. + + @param node ast node to be processed + @type ast.DictComp + @yield loop variable names + @ytype str + """ + finder = NamedExprFinder() + for gen in node.generators: + if isinstance(gen.target, ast.Name): + yield gen.target.id + elif isinstance(gen.target, ast.Tuple): + yield from self.__getNamesFromTuple(gen.target) + + finder.visit(gen.ifs) + + yield from finder.getNames().keys() + + def __inClassInit(self): + """ + Private method to check, if we are inside an '__init__' method. + + @return flag indicating being within the '__init__' method + @rtype bool + """ + return ( + len(self.contexts) >= 2 + and isinstance(self.contexts[-2].node, ast.ClassDef) + and isinstance(self.contexts[-1].node, ast.FunctionDef) + and self.contexts[-1].node.name == "__init__" + ) + + def visit_Return(self, node): + """ + Public method to handle 'Return' nodes. + + @param node reference to the node to be processed + @type ast.Return + """ + if self.__inClassInit() and node.value is not None: + self.violations.append((node, "M-537")) + + self.generic_visit(node) + + def visit_Yield(self, node): + """ + Public method to handle 'Yield' nodes. + + @param node reference to the node to be processed + @type ast.Yield + """ + if self.__inClassInit(): + self.violations.append((node, "M-537")) + + self.generic_visit(node) + + def visit_YieldFrom(self, node) -> None: + """ + Public method to handle 'YieldFrom' nodes. + + @param node reference to the node to be processed + @type ast.YieldFrom + """ + if self.__inClassInit(): + self.violations.append((node, "M-537")) + + self.generic_visit(node) + + def visit(self, node): + """ + Public method to traverse a given AST node. + + @param node AST node to be traversed + @type ast.Node + """ + isContextful = isinstance(node, BugBearVisitor.CONTEXTFUL_NODES) + + if isContextful: + context = BugBearContext(node, []) + self.contexts.append(context) + + self.nodeStack.append(node) + self.nodeWindow.append(node) + self.nodeWindow = self.nodeWindow[-BugBearVisitor.NodeWindowSize :] + + super().visit(node) + + self.nodeStack.pop() + + if isContextful: + self.contexts.pop() + + self.__checkForM518(node) + + def visit_ExceptHandler(self, node): + """ + Public method to handle exception handlers. + + @param node reference to the node to be processed + @type ast.ExceptHandler + """ + if node.type is None: + # bare except is handled by pycodestyle already + self.generic_visit(node) + return + + oldM540CaughtException = self.__M540CaughtException + if node.name is None: + self.__M540CaughtException = None + else: + self.__M540CaughtException = M540CaughtException(node.name, False) + + names = self.__checkForM513_M514_M529_M530(node) + + if "BaseException" in names and not ExceptBaseExceptionVisitor(node).reRaised(): + self.violations.append((node, "M-536")) + + self.generic_visit(node) + + if ( + self.__M540CaughtException is not None + and self.__M540CaughtException.hasNote + ): + self.violations.append((node, "M-540")) + self.__M540CaughtException = oldM540CaughtException + + def visit_UAdd(self, node): + """ + Public method to handle unary additions. + + @param node reference to the node to be processed + @type ast.UAdd + """ + trailingNodes = list(map(type, self.nodeWindow[-4:])) + if trailingNodes == [ast.UnaryOp, ast.UAdd, ast.UnaryOp, ast.UAdd]: + originator = self.nodeWindow[-4] + self.violations.append((originator, "M-502")) + + self.generic_visit(node) + + def visit_Call(self, node): + """ + Public method to handle a function call. + + @param node reference to the node to be processed + @type ast.Call + """ + isM540AddNote = False + + if isinstance(node.func, ast.Attribute): + self.__checkForM505(node) + isM540AddNote = self.__checkForM540AddNote(node.func) + else: + with contextlib.suppress(AttributeError, IndexError): + # bad super() call + if isinstance(node.func, ast.Name) and node.func.id == "super": + args = node.args + if ( + len(args) == 2 + and isinstance(args[0], ast.Attribute) + and isinstance(args[0].value, ast.Name) + and args[0].value.id == "self" + and args[0].attr == "__class__" + ): + self.violations.append((node, "M-582")) + + # bad getattr and setattr + if ( + node.func.id in ("getattr", "hasattr") + and node.args[1].value == "__call__" + ): + self.violations.append((node, "M-504")) + if ( + node.func.id == "getattr" + and len(node.args) == 2 + and self.__isIdentifier(node.args[1]) + and iskeyword(AstUtilities.getValue(node.args[1])) + ): + self.violations.append((node, "M-509")) + elif ( + node.func.id == "setattr" + and len(node.args) == 3 + and self.__isIdentifier(node.args[1]) + and iskeyword(AstUtilities.getValue(node.args[1])) + ): + self.violations.append((node, "M-510")) + + self.__checkForM526(node) + + self.__checkForM528(node) + self.__checkForM534(node) + self.__checkForM539(node) + + # no need for copying, if used in nested calls it will be set to None + currentM540CaughtException = self.__M540CaughtException + if not isM540AddNote: + self.__checkForM540Usage(node.args) + self.__checkForM540Usage(node.keywords) + + self.generic_visit(node) + + if isM540AddNote: + # Avoid nested calls within the parameter list using the variable itself. + # e.g. `e.add_note(str(e))` + self.__M540CaughtException = currentM540CaughtException + + def visit_Module(self, node): + """ + Public method to handle a module node. + + @param node reference to the node to be processed + @type ast.Module + """ + self.generic_visit(node) + + def visit_Assign(self, node): + """ + Public method to handle assignments. + + @param node reference to the node to be processed + @type ast.Assign + """ + self.__checkForM540Usage(node.value) + if len(node.targets) == 1: + target = node.targets[0] + if ( + isinstance(target, ast.Attribute) + and isinstance(target.value, ast.Name) + and (target.value.id, target.attr) == ("os", "environ") + ): + self.violations.append((node, "M-503")) + + self.generic_visit(node) + + def visit_For(self, node): + """ + Public method to handle 'for' statements. + + @param node reference to the node to be processed + @type ast.For + """ + self.__checkForM507(node) + self.__checkForM520(node) + self.__checkForM523(node) + self.__checkForM531(node) + self.__checkForM569(node) + + self.generic_visit(node) + + def visit_AsyncFor(self, node): + """ + Public method to handle 'for' statements. + + @param node reference to the node to be processed + @type ast.AsyncFor + """ + self.__checkForM507(node) + self.__checkForM520(node) + self.__checkForM523(node) + self.__checkForM531(node) + + self.generic_visit(node) + + def visit_While(self, node): + """ + Public method to handle 'while' statements. + + @param node reference to the node to be processed + @type ast.While + """ + self.__checkForM523(node) + + self.generic_visit(node) + + def visit_ListComp(self, node): + """ + Public method to handle list comprehensions. + + @param node reference to the node to be processed + @type ast.ListComp + """ + self.__checkForM523(node) + + self.generic_visit(node) + + def visit_SetComp(self, node): + """ + Public method to handle set comprehensions. + + @param node reference to the node to be processed + @type ast.SetComp + """ + self.__checkForM523(node) + + self.generic_visit(node) + + def visit_DictComp(self, node): + """ + Public method to handle dictionary comprehensions. + + @param node reference to the node to be processed + @type ast.DictComp + """ + self.__checkForM523(node) + self.__checkForM535(node) + + self.generic_visit(node) + + def visit_GeneratorExp(self, node): + """ + Public method to handle generator expressions. + + @param node reference to the node to be processed + @type ast.GeneratorExp + """ + self.__checkForM523(node) + + self.generic_visit(node) + + def visit_Assert(self, node): + """ + Public method to handle 'assert' statements. + + @param node reference to the node to be processed + @type ast.Assert + """ + if ( + AstUtilities.isNameConstant(node.test) + and AstUtilities.getValue(node.test) is False + ): + self.violations.append((node, "M-511")) + + self.generic_visit(node) + + def visit_AsyncFunctionDef(self, node): + """ + Public method to handle async function definitions. + + @param node reference to the node to be processed + @type ast.AsyncFunctionDef + """ + self.__checkForM506_M508(node) + + self.generic_visit(node) + + def visit_FunctionDef(self, node): + """ + Public method to handle function definitions. + + @param node reference to the node to be processed + @type ast.FunctionDef + """ + self.__checkForM506_M508(node) + self.__checkForM519(node) + self.__checkForM521(node) + + self.generic_visit(node) + + def visit_ClassDef(self, node): + """ + Public method to handle class definitions. + + @param node reference to the node to be processed + @type ast.ClassDef + """ + self.__checkForM521(node) + self.__checkForM524_M527(node) + + self.generic_visit(node) + + def visit_Try(self, node): + """ + Public method to handle 'try' statements. + + @param node reference to the node to be processed + @type ast.Try + """ + self.__checkForM512(node) + self.__checkForM525(node) + + self.generic_visit(node) + + def visit_TryStar(self, node): + """ + Public method to handle 'except*' statements. + + @param node reference to the node to be processed + @type ast.TryStar + """ + outerTryStar = self.__inTryStar + self.__inTryStar = "*" + self.visit_Try(node) + self.__inTryStar = outerTryStar + + def visit_Compare(self, node): + """ + Public method to handle comparison statements. + + @param node reference to the node to be processed + @type ast.Compare + """ + self.__checkForM515(node) + + self.generic_visit(node) + + def visit_Raise(self, node): + """ + Public method to handle 'raise' statements. + + @param node reference to the node to be processed + @type ast.Raise + """ + if node.exc is None: + self.__M540CaughtException = None + else: + self.__checkForM540Usage(node.exc) + self.__checkForM540Usage(node.cause) + self.__checkForM516(node) + + self.generic_visit(node) + + def visit_With(self, node): + """ + Public method to handle 'with' statements. + + @param node reference to the node to be processed + @type ast.With + """ + self.__checkForM517(node) + self.__checkForM522(node) + + self.generic_visit(node) + + def visit_JoinedStr(self, node): + """ + Public method to handle f-string arguments. + + @param node reference to the node to be processed + @type ast.JoinedStr + """ + for value in node.values: + if isinstance(value, ast.FormattedValue): + return + + self.violations.append((node, "M-581")) + + def visit_AnnAssign(self, node): + """ + Public method to check annotated assign statements. + + @param node reference to the node to be processed + @type ast.AnnAssign + """ + self.__checkForM532(node) + self.__checkForM540Usage(node.value) + + self.generic_visit(node) + + def visit_Import(self, node): + """ + Public method to check imports. + + @param node reference to the node to be processed + @type ast.Import + """ + self.__checkForM505(node) + + self.generic_visit(node) + + def visit_ImportFrom(self, node): + """ + Public method to check from imports. + + @param node reference to the node to be processed + @type ast.Import + """ + self.visit_Import(node) + + def visit_Set(self, node): + """ + Public method to check a set. + + @param node reference to the node to be processed + @type ast.Set + """ + self.__checkForM533(node) + + self.generic_visit(node) + + def visit_Dict(self, node): + """ + Public method to check a dictionary. + + @param node reference to the node to be processed + @type ast.Dict + """ + self.__checkForM541(node) + + self.generic_visit(node) + + def __checkForM505(self, node): + """ + Private method to check the use of *strip(). + + @param node reference to the node to be processed + @type ast.Call + """ + if isinstance(node, ast.Import): + for name in node.names: + self.__M505Imports.add(name.asname or name.name) + elif isinstance(node, ast.ImportFrom): + for name in node.names: + self.__M505Imports.add(f"{node.module}.{name.name or name.asname}") + elif isinstance(node, ast.Call) and isinstance(node.func, ast.Attribute): + if node.func.attr not in ("lstrip", "rstrip", "strip"): + return # method name doesn't match + + if ( + isinstance(node.func.value, ast.Name) + and node.func.value.id in self.__M505Imports + ): + return # method is being run on an imported module + + if len(node.args) != 1 or not AstUtilities.isString(node.args[0]): + return # used arguments don't match the builtin strip + + value = AstUtilities.getValue(node.args[0]) + if len(value) == 1: + return # stripping just one character + + if len(value) == len(set(value)): + return # no characters appear more than once + + self.violations.append((node, "M-505")) + + def __checkForM506_M508(self, node): + """ + Private method to check the use of mutable literals, comprehensions and calls. + + @param node reference to the node to be processed + @type ast.AsyncFunctionDef or ast.FunctionDef + """ + visitor = FunctionDefDefaultsVisitor("M-506", "M-508") + visitor.visit(node.args.defaults + node.args.kw_defaults) + self.violations.extend(visitor.errors) + + def __checkForM507(self, node): + """ + Private method to check for unused loop variables. + + @param node reference to the node to be processed + @type ast.For or ast.AsyncFor + """ + targets = NameFinder() + targets.visit(node.target) + ctrlNames = set(filter(lambda s: not s.startswith("_"), targets.getNames())) + body = NameFinder() + for expr in node.body: + body.visit(expr) + usedNames = set(body.getNames()) + for name in sorted(ctrlNames - usedNames): + n = targets.getNames()[name][0] + self.violations.append((n, "M-507", name)) + + def __checkForM512(self, node): + """ + Private method to check for return/continue/break inside finally blocks. + + @param node reference to the node to be processed + @type ast.Try + """ + + def _loop(node, badNodeTypes): + if isinstance(node, (ast.AsyncFunctionDef, ast.FunctionDef)): + return + + if isinstance(node, (ast.While, ast.For)): + badNodeTypes = (ast.Return,) + + elif isinstance(node, badNodeTypes): + self.violations.append((node, "M-512", self.__inTryStar)) + + for child in ast.iter_child_nodes(node): + _loop(child, badNodeTypes) + + for child in node.finalbody: + _loop(child, (ast.Return, ast.Continue, ast.Break)) + + def __checkForM513_M514_M529_M530(self, node): + """ + Private method to check various exception handler situations. + + @param node reference to the node to be processed + @type ast.ExceptHandler + @return list of exception handler names + @rtype list of str + """ + handlers = self.__flattenExcepthandler(node.type) + names = [] + badHandlers = [] + ignoredHandlers = [] + + for handler in handlers: + if isinstance(handler, (ast.Name, ast.Attribute)): + name = self.toNameStr(handler) + if name is None: + ignoredHandlers.append(handler) + else: + names.append(name) + elif isinstance(handler, (ast.Call, ast.Starred)): + ignoredHandlers.append(handler) + else: + badHandlers.append(handler) + if badHandlers: + self.violations.append((node, "M-530")) + if len(names) == 0 and not badHandlers and not ignoredHandlers: + self.violations.append((node, "M-529", self.__inTryStar)) + elif ( + len(names) == 1 + and not badHandlers + and not ignoredHandlers + and isinstance(node.type, ast.Tuple) + ): + self.violations.append((node, "M-513", *names, self.__inTryStar)) + else: + maybeError = self.__checkRedundantExcepthandlers( + names, node, self.__inTryStar + ) + if maybeError is not None: + self.violations.append(maybeError) + return names + + def __checkForM515(self, node): + """ + Private method to check for pointless comparisons. + + @param node reference to the node to be processed + @type ast.Compare + """ + if isinstance(self.nodeStack[-2], ast.Expr): + self.violations.append((node, "M-515")) + + def __checkForM516(self, node): + """ + Private method to check for raising a literal instead of an exception. + + @param node reference to the node to be processed + @type ast.Raise + """ + if ( + AstUtilities.isNameConstant(node.exc) + or AstUtilities.isNumber(node.exc) + or AstUtilities.isString(node.exc) + ): + self.violations.append((node, "M-516")) + + def __checkForM517(self, node): + """ + Private method to check for use of the evil syntax + 'with assertRaises(Exception): or 'with pytest.raises(Exception):'. + + @param node reference to the node to be processed + @type ast.With + """ + item = node.items[0] + itemContext = item.context_expr + if ( + hasattr(itemContext, "func") + and ( + ( + isinstance(itemContext.func, ast.Attribute) + and ( + itemContext.func.attr == "assertRaises" + or ( + itemContext.func.attr == "raises" + and isinstance(itemContext.func.value, ast.Name) + and itemContext.func.value.id == "pytest" + and "match" not in (kwd.arg for kwd in itemContext.keywords) + ) + ) + ) + or ( + isinstance(itemContext.func, ast.Name) + and itemContext.func.id == "raises" + and isinstance(itemContext.func.ctx, ast.Load) + and "pytest.raises" in self.__M505Imports + and "match" not in (kwd.arg for kwd in itemContext.keywords) + ) + ) + and len(itemContext.args) == 1 + and isinstance(itemContext.args[0], ast.Name) + and itemContext.args[0].id in ("Exception", "BaseException") + and not item.optional_vars + ): + self.violations.append((node, "M-517")) + + def __checkForM518(self, node): + """ + Private method to check for useless expressions. + + @param node reference to the node to be processed + @type ast.FunctionDef + """ + if not isinstance(node, ast.Expr): + return + + if isinstance( + node.value, + (ast.List, ast.Set, ast.Dict, ast.Tuple), + ) or ( + isinstance(node.value, ast.Constant) + and ( + isinstance( + node.value.value, + (int, float, complex, bytes, bool), + ) + or node.value.value is None + ) + ): + self.violations.append((node, "M-518", node.value.__class__.__name__)) + + def __checkForM519(self, node): + """ + Private method to check for use of 'functools.lru_cache' or 'functools.cache'. + + @param node reference to the node to be processed + @type ast.FunctionDef + """ + caches = { + "functools.cache", + "functools.lru_cache", + "cache", + "lru_cache", + } + + if ( + len(node.decorator_list) == 0 + or len(self.contexts) < 2 + or not isinstance(self.contexts[-2].node, ast.ClassDef) + ): + return + + # Preserve decorator order so we can get the lineno from the decorator node + # rather than the function node (this location definition changes in Python 3.8) + resolvedDecorators = ( + ".".join(composeCallPath(decorator)) for decorator in node.decorator_list + ) + for idx, decorator in enumerate(resolvedDecorators): + if decorator in {"classmethod", "staticmethod"}: + return + + if decorator in caches: + self.violations.append((node.decorator_list[idx], "M-519")) + return + + def __checkForM520(self, node): + """ + Private method to check for a loop that modifies its iterable. + + @param node reference to the node to be processed + @type ast.For or ast.AsyncFor + """ + targets = NameFinder() + targets.visit(node.target) + ctrlNames = set(targets.getNames()) + + iterset = M520NameFinder() + iterset.visit(node.iter) + itersetNames = set(iterset.getNames()) + + for name in sorted(ctrlNames): + if name in itersetNames: + n = targets.getNames()[name][0] + self.violations.append((n, "M-520")) + + def __checkForM521(self, node): + """ + Private method to check for use of an f-string as docstring. + + @param node reference to the node to be processed + @type ast.FunctionDef or ast.ClassDef + """ + if ( + node.body + and isinstance(node.body[0], ast.Expr) + and isinstance(node.body[0].value, ast.JoinedStr) + ): + self.violations.append((node.body[0].value, "M-521")) + + def __checkForM522(self, node): + """ + Private method to check for use of an f-string as docstring. + + @param node reference to the node to be processed + @type ast.With + """ + item = node.items[0] + itemContext = item.context_expr + if ( + hasattr(itemContext, "func") + and hasattr(itemContext.func, "value") + and hasattr(itemContext.func.value, "id") + and itemContext.func.value.id == "contextlib" + and hasattr(itemContext.func, "attr") + and itemContext.func.attr == "suppress" + and len(itemContext.args) == 0 + ): + self.violations.append((node, "M-522")) + + def __checkForM523(self, loopNode): + """ + Private method to check that functions (including lambdas) do not use loop + variables. + + @param loopNode reference to the node to be processed + @type ast.For, ast.AsyncFor, ast.While, ast.ListComp, ast.SetComp,ast.DictComp, + or ast.GeneratorExp + """ + safe_functions = [] + suspiciousVariables = [] + for node in ast.walk(loopNode): + # check if function is immediately consumed to avoid false alarm + if isinstance(node, ast.Call): + # check for filter&reduce + if ( + isinstance(node.func, ast.Name) + and node.func.id in ("filter", "reduce", "map") + ) or ( + isinstance(node.func, ast.Attribute) + and node.func.attr == "reduce" + and isinstance(node.func.value, ast.Name) + and node.func.value.id == "functools" + ): + for arg in node.args: + if isinstance(arg, BugBearVisitor.FUNCTION_NODES): + safe_functions.append(arg) + + # check for key= + for keyword in node.keywords: + if keyword.arg == "key" and isinstance( + keyword.value, BugBearVisitor.FUNCTION_NODES + ): + safe_functions.append(keyword.value) + + # mark `return lambda: x` as safe + # does not (currently) check inner lambdas in a returned expression + # e.g. `return (lambda: x, ) + if isinstance(node, ast.Return) and isinstance( + node.value, BugBearVisitor.FUNCTION_NODES + ): + safe_functions.append(node.value) + + # find unsafe functions + if ( + isinstance(node, BugBearVisitor.FUNCTION_NODES) + and node not in safe_functions + ): + argnames = { + arg.arg for arg in ast.walk(node.args) if isinstance(arg, ast.arg) + } + if isinstance(node, ast.Lambda): + bodyNodes = ast.walk(node.body) + else: + bodyNodes = itertools.chain.from_iterable(map(ast.walk, node.body)) + errors = [] + for name in bodyNodes: + if isinstance(name, ast.Name) and name.id not in argnames: + if isinstance(name.ctx, ast.Load): + errors.append((name.lineno, name.col_offset, name.id, name)) + elif isinstance(name.ctx, ast.Store): + argnames.add(name.id) + for err in errors: + if err[2] not in argnames and err not in self.__M523Seen: + self.__M523Seen.add(err) # dedupe across nested loops + suspiciousVariables.append(err) + + if suspiciousVariables: + reassignedInLoop = set(self.__getAssignedNames(loopNode)) + + for err in sorted(suspiciousVariables): + if reassignedInLoop.issuperset(err[2]): + self.violations.append((err[3], "M-523", err[2])) + + def __checkForM524_M527(self, node): + """ + Private method to check for inheritance from abstract classes in abc and lack of + any methods decorated with abstract*. + + @param node reference to the node to be processed + @type ast.ClassDef + """ # __IGNORE_WARNING_D-234r__ + + def isAbcClass(value, name="ABC"): + if isinstance(value, ast.keyword): + return value.arg == "metaclass" and isAbcClass(value.value, "ABCMeta") + + # class foo(ABC) + # class foo(abc.ABC) + return (isinstance(value, ast.Name) and value.id == name) or ( + isinstance(value, ast.Attribute) + and value.attr == name + and isinstance(value.value, ast.Name) + and value.value.id == "abc" + ) + + def isAbstractDecorator(expr): + return (isinstance(expr, ast.Name) and expr.id[:8] == "abstract") or ( + isinstance(expr, ast.Attribute) and expr.attr[:8] == "abstract" + ) + + def isOverload(expr): + return (isinstance(expr, ast.Name) and expr.id == "overload") or ( + isinstance(expr, ast.Attribute) and expr.attr == "overload" + ) + + def emptyBody(body): + def isStrOrEllipsis(node): + return isinstance(node, ast.Constant) and ( + node.value is Ellipsis or isinstance(node.value, str) + ) + + # Function body consist solely of `pass`, `...`, and/or (doc)string literals + return all( + isinstance(stmt, ast.Pass) + or (isinstance(stmt, ast.Expr) and isStrOrEllipsis(stmt.value)) + for stmt in body + ) + + # don't check multiple inheritance + if len(node.bases) + len(node.keywords) > 1: + return + + # only check abstract classes + if not any(map(isAbcClass, (*node.bases, *node.keywords))): + return + + hasMethod = False + hasAbstractMethod = False + + if not any(map(isAbcClass, (*node.bases, *node.keywords))): + return + + for stmt in node.body: + # Ignore abc's that declares a class attribute that must be set + if isinstance(stmt, ast.AnnAssign) and stmt.value is None: + hasAbstractMethod = True + continue + + # only check function defs + if not isinstance(stmt, (ast.FunctionDef, ast.AsyncFunctionDef)): + continue + hasMethod = True + + hasAbstractDecorator = any(map(isAbstractDecorator, stmt.decorator_list)) + + hasAbstractMethod |= hasAbstractDecorator + + if ( + not hasAbstractDecorator + and emptyBody(stmt.body) + and not any(map(isOverload, stmt.decorator_list)) + ): + self.violations.append((stmt, "M-527", stmt.name)) + + if hasMethod and not hasAbstractMethod: + self.violations.append((node, "M-524", node.name)) + + def __checkForM525(self, node): + """ + Private method to check for exceptions being handled multiple times. + + @param node reference to the node to be processed + @type ast.Try + """ + seen = [] + + for handler in node.handlers: + if isinstance(handler.type, (ast.Name, ast.Attribute)): + name = ".".join(composeCallPath(handler.type)) + seen.append(name) + elif isinstance(handler.type, ast.Tuple): + # to avoid checking the same as M514, remove duplicates per except + uniques = set() + for entry in handler.type.elts: + name = ".".join(composeCallPath(entry)) + uniques.add(name) + seen.extend(uniques) + + # sort to have a deterministic output + duplicates = sorted({x for x in seen if seen.count(x) > 1}) + for duplicate in duplicates: + self.violations.append((node, "M-525", duplicate, self.__inTryStar)) + + def __checkForM526(self, node): + """ + Private method to check for Star-arg unpacking after keyword argument. + + @param node reference to the node to be processed + @type ast.Call + """ + if not node.keywords: + return + + starreds = [arg for arg in node.args if isinstance(arg, ast.Starred)] + if not starreds: + return + + firstKeyword = node.keywords[0].value + for starred in starreds: + if (starred.lineno, starred.col_offset) > ( + firstKeyword.lineno, + firstKeyword.col_offset, + ): + self.violations.append((node, "M-526")) + + def __checkForM528(self, node): + """ + Private method to check for warn without stacklevel. + + @param node reference to the node to be processed + @type ast.Call + """ + if ( + isinstance(node.func, ast.Attribute) + and node.func.attr == "warn" + and isinstance(node.func.value, ast.Name) + and node.func.value.id == "warnings" + and not any(kw.arg == "stacklevel" for kw in node.keywords) + and len(node.args) < 3 + and not any(isinstance(a, ast.Starred) for a in node.args) + and not any(kw.arg is None for kw in node.keywords) + ): + self.violations.append((node, "M-528")) + + def __checkForM531(self, loopNode): + """ + Private method to check that 'itertools.groupby' isn't iterated over more than + once. + + A warning is emitted when the generator returned by 'groupby()' is used + more than once inside a loop body or when it's used in a nested loop. + + @param loopNode reference to the node to be processed + @type ast.For or ast.AsyncFor + """ + # for <loop_node.target> in <loop_node.iter>: ... + if isinstance(loopNode.iter, ast.Call): + node = loopNode.iter + if (isinstance(node.func, ast.Name) and node.func.id in ("groupby",)) or ( + isinstance(node.func, ast.Attribute) + and node.func.attr == "groupby" + and isinstance(node.func.value, ast.Name) + and node.func.value.id == "itertools" + ): + # We have an invocation of groupby which is a simple unpacking + if isinstance(loopNode.target, ast.Tuple) and isinstance( + loopNode.target.elts[1], ast.Name + ): + groupName = loopNode.target.elts[1].id + else: + # Ignore any 'groupby()' invocation that isn't unpacked + return + + numUsages = 0 + for node in self.__walkList(loopNode.body): + # Handled nested loops + if isinstance(node, ast.For): + for nestedNode in self.__walkList(node.body): + if ( + isinstance(nestedNode, ast.Name) + and nestedNode.id == groupName + ): + self.violations.append((nestedNode, "M-531")) + + # Handle multiple uses + if isinstance(node, ast.Name) and node.id == groupName: + numUsages += 1 + if numUsages > 1: + self.violations.append((nestedNode, "M-531")) + + def __checkForM532(self, node): + """ + Private method to check for possible unintentional typing annotation. + + @param node reference to the node to be processed + @type ast.AnnAssign + """ + if ( + node.value is None + and hasattr(node.target, "value") + and isinstance(node.target.value, ast.Name) + and ( + isinstance(node.target, ast.Subscript) + or ( + isinstance(node.target, ast.Attribute) + and node.target.value.id != "self" + ) + ) + ): + self.violations.append((node, "M-532")) + + def __checkForM533(self, node): + """ + Private method to check a set for duplicate items. + + @param node reference to the node to be processed + @type ast.Set + """ + seen = set() + for elt in node.elts: + if not isinstance(elt, ast.Constant): + continue + if elt.value in seen: + self.violations.append((node, "M-533", repr(elt.value))) + else: + seen.add(elt.value) + + def __checkForM534(self, node): + """ + Private method to check that re.sub/subn/split arguments flags/count/maxsplit + are passed as keyword arguments. + + @param node reference to the node to be processed + @type ast.Call + """ + if not isinstance(node.func, ast.Attribute): + return + func = node.func + if not isinstance(func.value, ast.Name) or func.value.id != "re": + return + + def check(numArgs, paramName): + if len(node.args) > numArgs: + arg = node.args[numArgs] + self.violations.append((arg, "M-534", func.attr, paramName)) + + if func.attr in ("sub", "subn"): + check(3, "count") + elif func.attr == "split": + check(2, "maxsplit") + + def __checkForM535(self, node): + """ + Private method to check that a static key isn't used in a dict comprehension. + + Record a warning if a likely unchanging key is used - either a constant, + or a variable that isn't coming from the generator expression. + + @param node reference to the node to be processed + @type ast.DictComp + """ + if isinstance(node.key, ast.Constant): + self.violations.append((node, "M-535", node.key.value)) + elif isinstance( + node.key, ast.Name + ) and node.key.id not in self.__getDictCompLoopAndNamedExprVarNames(node): + self.violations.append((node, "M-535", node.key.id)) + + def __checkForM539(self, node): + """ + Private method to check for correct ContextVar usage. + + @param node reference to the node to be processed + @type ast.Call + """ + if not ( + (isinstance(node.func, ast.Name) and node.func.id == "ContextVar") + or ( + isinstance(node.func, ast.Attribute) + and node.func.attr == "ContextVar" + and isinstance(node.func.value, ast.Name) + and node.func.value.id == "contextvars" + ) + ): + return + + # ContextVar only takes one kw currently, but better safe than sorry + for kw in node.keywords: + if kw.arg == "default": + break + else: + return + + visitor = FunctionDefDefaultsVisitor("M-539", "M-539") + visitor.visit(kw.value) + self.violations.extend(visitor.errors) + + def __checkForM540AddNote(self, node): + """ + Private method to check add_note usage. + + @param node reference to the node to be processed + @type ast.Attribute + @return flag + @rtype bool + """ + if ( + node.attr == "add_note" + and isinstance(node.value, ast.Name) + and self.__M540CaughtException + and node.value.id == self.__M540CaughtException.name + ): + self.__M540CaughtException.hasNote = True + return True + + return False + + def __checkForM540Usage(self, node): + """ + Private method to check the usage of exceptions with added note. + + @param node reference to the node to be processed + @type ast.expr or None + """ # noqa: D-234y + + def superwalk(node: ast.AST | list[ast.AST]): + """ + Function to walk an AST node or a list of AST nodes. + + @param node reference to the node or a list of nodes to be processed + @type ast.AST or list[ast.AST] + @yield next node to be processed + @ytype ast.AST + """ + if isinstance(node, list): + for n in node: + yield from ast.walk(n) + else: + yield from ast.walk(node) + + if not self.__M540CaughtException or node is None: + return + + for n in superwalk(node): + if isinstance(n, ast.Name) and n.id == self.__M540CaughtException.name: + self.__M540CaughtException = None + break + + def __checkForM541(self, node): + """ + Private method to check for duplicate key value pairs in a dictionary literal. + + @param node reference to the node to be processed + @type ast.Dict + """ # noqa: D-234r + + def convertToValue(item): + """ + Function to extract the value of a given item. + + @param item node to extract value from + @type ast.Ast + @return value of the node + @rtype Any + """ + if isinstance(item, ast.Constant): + return item.value + elif isinstance(item, ast.Tuple): + return tuple(convertToValue(i) for i in item.elts) + elif isinstance(item, ast.Name): + return M541VariableKeyType(item.id) + else: + return M541UnhandledKeyType() + + keys = [convertToValue(key) for key in node.keys] + keyCounts = Counter(keys) + duplicateKeys = [key for key, count in keyCounts.items() if count > 1] + for key in duplicateKeys: + keyIndices = [i for i, iKey in enumerate(keys) if iKey == key] + seen = set() + for index in keyIndices: + value = convertToValue(node.values[index]) + if value in seen: + keyNode = node.keys[index] + self.violations.append((keyNode, "M-541")) + seen.add(value) + + def __checkForM569(self, node): + """ + Private method to check for changes to a loop's mutable iterable. + + @param node loop node to be checked + @type ast.For + """ + if isinstance(node.iter, ast.Name): + name = self.toNameStr(node.iter) + elif isinstance(node.iter, ast.Attribute): + name = self.toNameStr(node.iter) + else: + return + checker = M569Checker(name, self) + checker.visit(node.body) + for mutation in checker.mutations: + self.violations.append((mutation, "M-569")) + + +class M569Checker(ast.NodeVisitor): + """ + Class traversing a 'for' loop body to check for modifications to a loop's + mutable iterable. + """ + + # https://docs.python.org/3/library/stdtypes.html#mutable-sequence-types + MUTATING_FUNCTIONS = ( + "append", + "sort", + "reverse", + "remove", + "clear", + "extend", + "insert", + "pop", + "popitem", + ) + + def __init__(self, name, bugbear): + """ + Constructor + + @param name name of the iterator + @type str + @param bugbear reference to the bugbear visitor + @type BugBearVisitor + """ + self.__name = name + self.__bb = bugbear + self.mutations = [] + + def visit_Delete(self, node): + """ + Public method handling 'Delete' nodes. + + @param node reference to the node to be processed + @type ast.Delete + """ + for target in node.targets: + if isinstance(target, ast.Subscript): + name = self.__bb.toNameStr(target.value) + elif isinstance(target, (ast.Attribute, ast.Name)): + name = self.__bb.toNameStr(target) + else: + name = "" # fallback + self.generic_visit(target) + + if name == self.__name: + self.mutations.append(node) + + def visit_Call(self, node): + """ + Public method handling 'Call' nodes. + + @param node reference to the node to be processed + @type ast.Call + """ + if isinstance(node.func, ast.Attribute): + name = self.__bb.toNameStr(node.func.value) + functionObject = name + functionName = node.func.attr + + if ( + functionObject == self.__name + and functionName in self.MUTATING_FUNCTIONS + ): + self.mutations.append(node) + + self.generic_visit(node) + + def visit(self, node): + """ + Public method to inspect an ast node. + + Like super-visit but supports iteration over lists. + + @param node AST node to be traversed + @type TYPE + @return reference to the last processed node + @rtype ast.Node + """ + if not isinstance(node, list): + return super().visit(node) + + for elem in node: + super().visit(elem) + return node + + +class NamedExprFinder(ast.NodeVisitor): + """ + Class to extract names defined through an ast.NamedExpr. + """ + + def __init__(self): + """ + Constructor + """ + super().__init__() + + self.__names = {} + + def visit_NamedExpr(self, node: ast.NamedExpr): + """ + Public method handling 'NamedExpr' nodes. + + @param node reference to the node to be processed + @type ast.NamedExpr + """ + self.__names.setdefault(node.target.id, []).append(node.target) + + self.generic_visit(node) + + def visit(self, node): + """ + Public method to traverse a given AST node. + + Like super-visit but supports iteration over lists. + + @param node AST node to be traversed + @type TYPE + @return reference to the last processed node + @rtype ast.Node + """ + if not isinstance(node, list): + super().visit(node) + + for elem in node: + super().visit(elem) + + return node + + def getNames(self): + """ + Public method to return the extracted names and Name nodes. + + @return dictionary containing the names as keys and the list of nodes + @rtype dict + """ + return self.__names + + +class ExceptBaseExceptionVisitor(ast.NodeVisitor): + """ + Class to determine, if a 'BaseException' is re-raised. + """ + + def __init__(self, exceptNode): + """ + Constructor + + @param exceptNode exception node to be inspected + @type ast.ExceptHandler + """ + super().__init__() + self.__root = exceptNode + self.__reRaised = False + + def reRaised(self) -> bool: + """ + Public method to check, if the exception is re-raised. + + @return flag indicating a re-raised exception + @rtype bool + """ + self.visit(self.__root) + return self.__reRaised + + def visit_Raise(self, node): + """ + Public method to handle 'Raise' nodes. + + If we find a corresponding `raise` or `raise e` where e was from + `except BaseException as e:` then we mark re_raised as True and can + stop scanning. + + @param node reference to the node to be processed + @type ast.Raise + """ + if node.exc is None or ( + isinstance(node.exc, ast.Name) and node.exc.id == self.__root.name + ): + self.__reRaised = True + return + + super().generic_visit(node) + + def visit_ExceptHandler(self, node: ast.ExceptHandler): + """ + Public method to handle 'ExceptHandler' nodes. + + @param node reference to the node to be processed + @type ast.ExceptHandler + """ + if node is not self.__root: + return # entered a nested except - stop searching + + super().generic_visit(node) + + +class FunctionDefDefaultsVisitor(ast.NodeVisitor): + """ + Class used by M506, M508 and M539. + """ + + def __init__( + self, + errorCodeCalls, # M506 or M539 + errorCodeLiterals, # M508 or M539 + ): + """ + Constructor + + @param errorCodeCalls error code for ast.Call nodes + @type str + @param errorCodeLiterals error code for literal nodes + @type str + """ + self.__errorCodeCalls = errorCodeCalls + self.__errorCodeLiterals = errorCodeLiterals + for nodeType in BugbearMutableLiterals + BugbearMutableComprehensions: + setattr( + self, f"visit_{nodeType}", self.__visitMutableLiteralOrComprehension + ) + self.errors = [] + self.__argDepth = 0 + + super().__init__() + + def __visitMutableLiteralOrComprehension(self, node): + """ + Private method to flag mutable literals and comprehensions. + + @param node AST node to be processed + @type ast.Dict, ast.List, ast.Set, ast.ListComp, ast.DictComp or ast.SetComp + """ + # Flag M506 if mutable literal/comprehension is not nested. + # We only flag these at the top level of the expression as we + # cannot easily guarantee that nested mutable structures are not + # made immutable by outer operations, so we prefer no false positives. + # e.g. + # >>> def this_is_fine(a=frozenset({"a", "b", "c"})): ... + # + # >>> def this_is_not_fine_but_hard_to_detect(a=(lambda x: x)([1, 2, 3])) + # + # We do still search for cases of B008 within mutable structures though. + if self.__argDepth == 1: + self.errors.append((node, self.__errorCodeCalls)) + + # Check for nested functions. + self.generic_visit(node) + + def visit_Call(self, node): + """ + Public method to process Call nodes. + + @param node AST node to be processed + @type ast.Call + """ + callPath = ".".join(composeCallPath(node.func)) + if callPath in BugbearMutableCalls: + self.errors.append((node, self.__errorCodeCalls)) + self.generic_visit(node) + return + + if callPath in BugbearImmutableCalls: + self.generic_visit(node) + return + + # Check if function call is actually a float infinity/NaN literal + if callPath == "float" and len(node.args) == 1: + try: + value = float(ast.literal_eval(node.args[0])) + except Exception: # secok + pass + else: + if math.isfinite(value): + self.errors.append((node, self.__errorCodeLiterals)) + else: + self.errors.append((node, self.__errorCodeLiterals)) + + # Check for nested functions. + self.generic_visit(node) + + def visit_Lambda(self, node): + """ + Public method to process Lambda nodes. + + @param node AST node to be processed + @type ast.Lambda + """ + # Don't recurse into lambda expressions + # as they are evaluated at call time. + pass + + def visit(self, node): + """ + Public method to traverse an AST node or a list of AST nodes. + + This is an extended method that can also handle a list of AST nodes. + + @param node AST node or list of AST nodes to be processed + @type ast.AST or list of ast.AST + """ + self.__argDepth += 1 + if isinstance(node, list): + for elem in node: + if elem is not None: + super().visit(elem) + else: + super().visit(node) + self.__argDepth -= 1 + + +class NameFinder(ast.NodeVisitor): + """ + Class to extract a name out of a tree of nodes. + """ + + def __init__(self): + """ + Constructor + """ + super().__init__() + + self.__names = {} + + def visit_Name(self, node): + """ + Public method to handle 'Name' nodes. + + @param node reference to the node to be processed + @type ast.Name + """ + self.__names.setdefault(node.id, []).append(node) + + def visit(self, node): + """ + Public method to traverse a given AST node. + + @param node AST node to be traversed + @type ast.Node + @return reference to the last processed node + @rtype ast.Node + """ + if isinstance(node, list): + for elem in node: + super().visit(elem) + return node + else: + return super().visit(node) + + def getNames(self): + """ + Public method to return the extracted names and Name nodes. + + @return dictionary containing the names as keys and the list of nodes + @rtype dict + """ + return self.__names + + +class M520NameFinder(NameFinder): + """ + Class to extract a name out of a tree of nodes ignoring names defined within the + local scope of a comprehension. + """ + + def visit_GeneratorExp(self, node): + """ + Public method to handle a generator expressions. + + @param node reference to the node to be processed + @type ast.GeneratorExp + """ + self.visit(node.generators) + + def visit_ListComp(self, node): + """ + Public method to handle a list comprehension. + + @param node reference to the node to be processed + @type TYPE + """ + self.visit(node.generators) + + def visit_DictComp(self, node): + """ + Public method to handle a dictionary comprehension. + + @param node reference to the node to be processed + @type TYPE + """ + self.visit(node.generators) + + def visit_comprehension(self, node): + """ + Public method to handle the 'for' of a comprehension. + + @param node reference to the node to be processed + @type ast.comprehension + """ + self.visit(node.iter) + + def visit_Lambda(self, node): + """ + Public method to handle a Lambda function. + + @param node reference to the node to be processed + @type ast.Lambda + """ + self.visit(node.body) + for lambdaArg in node.args.args: + self.getNames().pop(lambdaArg.arg, None)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/DateTimeVisitor.py Thu Feb 27 14:42:39 2025 +0100 @@ -0,0 +1,218 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2025 Detlev Offenbach <detlev@die-offenbachs.de> +# + +""" +Module implementing a node visitor to check datetime function calls. +""" + +import ast + +import AstUtilities + + +class DateTimeVisitor(ast.NodeVisitor): + """ + Class implementing a node visitor to check datetime function calls. + + Note: This class is modeled after flake8_datetimez v20.10.0 checker. + """ + + def __init__(self): + """ + Constructor + """ + super().__init__() + + self.violations = [] + + def __getFromKeywords(self, keywords, name): + """ + Private method to get a keyword node given its name. + + @param keywords list of keyword argument nodes + @type list of ast.AST + @param name name of the keyword node + @type str + @return keyword node + @rtype ast.AST + """ + for keyword in keywords: + if keyword.arg == name: + return keyword + + return None + + def visit_Call(self, node): + """ + Public method to handle a function call. + + Every datetime related function call is check for use of the naive + variant (i.e. use without TZ info). + + @param node reference to the node to be processed + @type ast.Call + """ + # datetime.something() + isDateTimeClass = ( + isinstance(node.func, ast.Attribute) + and isinstance(node.func.value, ast.Name) + and node.func.value.id == "datetime" + ) + + # datetime.datetime.something() + isDateTimeModuleAndClass = ( + isinstance(node.func, ast.Attribute) + and isinstance(node.func.value, ast.Attribute) + and node.func.value.attr == "datetime" + and isinstance(node.func.value.value, ast.Name) + and node.func.value.value.id == "datetime" + ) + + if isDateTimeClass: + if node.func.attr == "datetime": + # datetime.datetime(2000, 1, 1, 0, 0, 0, 0, + # datetime.timezone.utc) + isCase1 = len(node.args) >= 8 and not ( + AstUtilities.isNameConstant(node.args[7]) + and AstUtilities.getValue(node.args[7]) is None + ) + + # datetime.datetime(2000, 1, 1, tzinfo=datetime.timezone.utc) + tzinfoKeyword = self.__getFromKeywords(node.keywords, "tzinfo") + isCase2 = tzinfoKeyword is not None and not ( + AstUtilities.isNameConstant(tzinfoKeyword.value) + and AstUtilities.getValue(tzinfoKeyword.value) is None + ) + + if not (isCase1 or isCase2): + self.violations.append((node, "M-301")) + + elif node.func.attr == "time": + # time(12, 10, 45, 0, datetime.timezone.utc) + isCase1 = len(node.args) >= 5 and not ( + AstUtilities.isNameConstant(node.args[4]) + and AstUtilities.getValue(node.args[4]) is None + ) + + # datetime.time(12, 10, 45, tzinfo=datetime.timezone.utc) + tzinfoKeyword = self.__getFromKeywords(node.keywords, "tzinfo") + isCase2 = tzinfoKeyword is not None and not ( + AstUtilities.isNameConstant(tzinfoKeyword.value) + and AstUtilities.getValue(tzinfoKeyword.value) is None + ) + + if not (isCase1 or isCase2): + self.violations.append((node, "M-321")) + + elif node.func.attr == "date": + self.violations.append((node, "M-311")) + + if isDateTimeClass or isDateTimeModuleAndClass: + if node.func.attr == "today": + self.violations.append((node, "M-302")) + + elif node.func.attr == "utcnow": + self.violations.append((node, "M-303")) + + elif node.func.attr == "utcfromtimestamp": + self.violations.append((node, "M-304")) + + elif node.func.attr in "now": + # datetime.now(UTC) + isCase1 = ( + len(node.args) == 1 + and len(node.keywords) == 0 + and not ( + AstUtilities.isNameConstant(node.args[0]) + and AstUtilities.getValue(node.args[0]) is None + ) + ) + + # datetime.now(tz=UTC) + tzKeyword = self.__getFromKeywords(node.keywords, "tz") + isCase2 = tzKeyword is not None and not ( + AstUtilities.isNameConstant(tzKeyword.value) + and AstUtilities.getValue(tzKeyword.value) is None + ) + + if not (isCase1 or isCase2): + self.violations.append((node, "M-305")) + + elif node.func.attr == "fromtimestamp": + # datetime.fromtimestamp(1234, UTC) + isCase1 = ( + len(node.args) == 2 + and len(node.keywords) == 0 + and not ( + AstUtilities.isNameConstant(node.args[1]) + and AstUtilities.getValue(node.args[1]) is None + ) + ) + + # datetime.fromtimestamp(1234, tz=UTC) + tzKeyword = self.__getFromKeywords(node.keywords, "tz") + isCase2 = tzKeyword is not None and not ( + AstUtilities.isNameConstant(tzKeyword.value) + and AstUtilities.getValue(tzKeyword.value) is None + ) + + if not (isCase1 or isCase2): + self.violations.append((node, "M-306")) + + elif node.func.attr == "strptime": + # datetime.strptime(...).replace(tzinfo=UTC) + parent = getattr(node, "_dtCheckerParent", None) + pparent = getattr(parent, "_dtCheckerParent", None) + if not ( + isinstance(parent, ast.Attribute) and parent.attr == "replace" + ) or not isinstance(pparent, ast.Call): + isCase1 = False + else: + tzinfoKeyword = self.__getFromKeywords(pparent.keywords, "tzinfo") + isCase1 = tzinfoKeyword is not None and not ( + AstUtilities.isNameConstant(tzinfoKeyword.value) + and AstUtilities.getValue(tzinfoKeyword.value) is None + ) + + if not isCase1: + self.violations.append((node, "M-307")) + + elif node.func.attr == "fromordinal": + self.violations.append((node, "M-308")) + + # date.something() + isDateClass = ( + isinstance(node.func, ast.Attribute) + and isinstance(node.func.value, ast.Name) + and node.func.value.id == "date" + ) + + # datetime.date.something() + isDateModuleAndClass = ( + isinstance(node.func, ast.Attribute) + and isinstance(node.func.value, ast.Attribute) + and node.func.value.attr == "date" + and isinstance(node.func.value.value, ast.Name) + and node.func.value.value.id == "datetime" + ) + + if isDateClass or isDateModuleAndClass: + if node.func.attr == "today": + self.violations.append((node, "M-312")) + + elif node.func.attr == "fromtimestamp": + self.violations.append((node, "M-313")) + + elif node.func.attr == "fromordinal": + self.violations.append((node, "M-314")) + + elif node.func.attr == "fromisoformat": + self.violations.append((node, "M-315")) + + self.generic_visit(node) + + +# +# eflag: noqa = M-891
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/DefaultMatchCaseVisitor.py Thu Feb 27 14:42:39 2025 +0100 @@ -0,0 +1,121 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2025 Detlev Offenbach <detlev@die-offenbachs.de> +# + +""" +Module implementing a node visitor to check default match cases. +""" + +import ast + + +class DefaultMatchCaseVisitor(ast.NodeVisitor): + """ + Class implementing a node visitor to check default match cases. + + Note: This class is modeled after flake8-spm v0.0.1. + """ + + def __init__(self): + """ + Constructor + """ + super().__init__() + + self.violations = [] + + def visit_Match(self, node): + """ + Public method to handle Match nodes. + + @param node reference to the node to be processed + @type ast.Match + """ + for badNode, issueCode in self.__badNodes(node): + self.violations.append((badNode, issueCode)) + + self.generic_visit(node) + + def __badNodes(self, node): + """ + Private method to yield bad match nodes. + + @param node reference to the node to be processed + @type ast.Match + @yield tuple containing a reference to bad match case node and the corresponding + issue code + @ytype tyuple of (ast.AST, str) + """ + for case in node.cases: + if self.__emptyMatchDefault(case): + if self.__lastStatementDoesNotRaise(case): + yield self.__findBadNode(case), "M-901" + elif self.__returnPrecedesExceptionRaising(case): + yield self.__findBadNode(case), "M-902" + + def __emptyMatchDefault(self, case): + """ + Private method to check for an empty default match case. + + @param case reference to the node to be processed + @type ast.match_case + @return flag indicating an empty default match case + @rtype bool + """ + pattern = case.pattern + return isinstance(pattern, ast.MatchAs) and ( + pattern.pattern is None + or ( + isinstance(pattern.pattern, ast.MatchAs) + and pattern.pattern.pattern is None + ) + ) + + def __lastStatementDoesNotRaise(self, case): + """ + Private method to check that the last case statement does not raise an + exception. + + @param case reference to the node to be processed + @type ast.match_case + @return flag indicating that the last case statement does not raise an + exception + @rtype bool + """ + return not isinstance(case.body[-1], ast.Raise) + + def __returnPrecedesExceptionRaising(self, case): + """ + Private method to check that no return precedes an exception raising. + + @param case reference to the node to be processed + @type ast.match_case + @return flag indicating that a return precedes an exception raising + @rtype bool + """ + returnIndex = -1 + raiseIndex = -1 + for index, body in enumerate(case.body): + if isinstance(body, ast.Return): + returnIndex = index + elif isinstance(body, ast.Raise): + raiseIndex = index + return returnIndex >= 0 and returnIndex < raiseIndex + + def __findBadNode(self, case) -> ast.AST: + """ + Private method returning a reference to the bad node of a case node. + + @param case reference to the node to be processed + @type ast.match_case + @return reference to the bad node + @rtype ast.AST + """ + for body in case.body: + # Handle special case when return precedes exception raising. + # In this case the bad node is that with the return statement. + if isinstance(body, ast.Return): + return body + + return case.body[-1]
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/MiscellaneousChecker.py Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/MiscellaneousChecker.py Thu Feb 27 14:42:39 2025 +0100 @@ -12,14 +12,10 @@ import contextlib import copy import itertools -import math import re import sys import tokenize -from collections import Counter, defaultdict, namedtuple -from dataclasses import dataclass -from keyword import iskeyword from string import Formatter try: @@ -37,58 +33,19 @@ import AstUtilities +from CodeStyleTopicChecker import CodeStyleTopicChecker + +from .BugBearVisitor import BugBearVisitor +from .DateTimeVisitor import DateTimeVisitor +from .DefaultMatchCaseVisitor import DefaultMatchCaseVisitor from .eradicate import Eradicator from .MiscellaneousDefaults import MiscellaneousCheckerDefaultArgs - -BugbearMutableLiterals = ("Dict", "List", "Set") -BugbearMutableComprehensions = ("ListComp", "DictComp", "SetComp") -BugbearMutableCalls = ( - "Counter", - "OrderedDict", - "collections.Counter", - "collections.OrderedDict", - "collections.defaultdict", - "collections.deque", - "defaultdict", - "deque", - "dict", - "list", - "set", -) -BugbearImmutableCalls = ( - "tuple", - "frozenset", - "types.MappingProxyType", - "MappingProxyType", - "re.compile", - "operator.attrgetter", - "operator.itemgetter", - "operator.methodcaller", - "attrgetter", - "itemgetter", - "methodcaller", -) +from .ReturnVisitor import ReturnVisitor +from .SysVersionVisitor import SysVersionVisitor +from .TextVisitor import TextVisitor -def composeCallPath(node): - """ - Generator function to assemble the call path of a given node. - - @param node node to assemble call path for - @type ast.Node - @yield call path components - @ytype str - """ - if isinstance(node, ast.Attribute): - yield from composeCallPath(node.value) - yield node.attr - elif isinstance(node, ast.Call): - yield from composeCallPath(node.func) - elif isinstance(node, ast.Name): - yield node.id - - -class MiscellaneousChecker: +class MiscellaneousChecker(CodeStyleTopicChecker): """ Class implementing a checker for miscellaneous checks. """ @@ -234,7 +191,7 @@ "M-801", ## one element tuple "M-811", - ## return statements + ## return statements # noqa: M-891 "M-831", "M-832", "M-833", @@ -251,6 +208,7 @@ "M-901", "M-902", ] + Category = "M" Formatter = Formatter() FormatFieldRegex = re.compile(r"^((?:\s|.)*?)(\..*|\[.*\])?$") @@ -282,16 +240,19 @@ @param args dictionary of arguments for the miscellaneous checks @type dict """ - self.__select = tuple(select) - self.__ignore = tuple(ignore) - self.__expected = expected[:] - self.__repeat = repeat - self.__filename = filename - self.__source = source[:] - self.__tree = copy.deepcopy(tree) - self.__args = args + super().__init__( + MiscellaneousChecker.Category, + source, + filename, + tree, + select, + ignore, + expected, + repeat, + args, + ) - linesIterator = iter(self.__source) + linesIterator = iter(self.source) self.__tokens = list(tokenize.generate_tokens(lambda: next(linesIterator))) self.__pep3101FormatRegex = re.compile( @@ -302,12 +263,6 @@ self.__eradicator = Eradicator() - # statistics counters - self.counters = {} - - # collection of detected errors - self.errors = [] - checkersWithCodes = [ (self.__checkCoding, ("M-101", "M-102")), (self.__checkCopyright, ("M-111", "M-112")), @@ -466,9 +421,10 @@ (self.__checkCommentedCode, ("M-891",)), (self.__checkDefaultMatchCase, ("M-901", "M-902")), ] + self._initializeCheckers(checkersWithCodes) # the eradicate whitelist - commentedCodeCheckerArgs = self.__args.get( + commentedCodeCheckerArgs = self.args.get( "CommentedCodeChecker", MiscellaneousCheckerDefaultArgs["CommentedCodeChecker"], ) @@ -480,77 +436,6 @@ commentedCodeCheckerWhitelist, extend_default=False ) - self.__checkers = [] - for checker, codes in checkersWithCodes: - if any(not (code and self.__ignoreCode(code)) for code in codes): - self.__checkers.append(checker) - - def __ignoreCode(self, code): - """ - Private method to check if the message code should be ignored. - - @param code message code to check for - @type str - @return flag indicating to ignore the given code - @rtype bool - """ - return code in self.__ignore or ( - code.startswith(self.__ignore) and not code.startswith(self.__select) - ) - - def __error(self, lineNumber, offset, code, *args): - """ - Private method to record an issue. - - @param lineNumber line number of the issue - @type int - @param offset position within line of the issue - @type int - @param code message code - @type str - @param args arguments for the message - @type list - """ - if self.__ignoreCode(code): - return - - if code in self.counters: - self.counters[code] += 1 - else: - self.counters[code] = 1 - - # Don't care about expected codes - if code in self.__expected: - return - - if code and (self.counters[code] == 1 or self.__repeat): - # record the issue with one based line number - self.errors.append( - { - "file": self.__filename, - "line": lineNumber + 1, - "offset": offset, - "code": code, - "args": args, - } - ) - - def run(self): - """ - Public method to check the given source against miscellaneous - conditions. - """ - if not self.__filename: - # don't do anything, if essential data is missing - return - - if not self.__checkers: - # don't do anything, if no codes were selected - return - - for check in self.__checkers: - check() - def __getCoding(self): """ Private method to get the defined coding of the source. @@ -558,7 +443,7 @@ @return tuple containing the line number and the coding @rtype tuple of int and str """ - for lineno, line in enumerate(self.__source[:5]): + for lineno, line in enumerate(self.source[:5], start=1): matched = re.search(r"coding[:=]\s*([-\w_.]+)", line, re.IGNORECASE) if matched: return lineno, matched.group(1) @@ -570,28 +455,28 @@ Private method to check the presence of a coding line and valid encodings. """ - if len(self.__source) == 0: + if len(self.source) == 0: return encodings = [ e.lower().strip() - for e in self.__args.get( + for e in self.args.get( "CodingChecker", MiscellaneousCheckerDefaultArgs["CodingChecker"] ).split(",") ] lineno, coding = self.__getCoding() if coding: if coding.lower() not in encodings: - self.__error(lineno, 0, "M-102", coding) + self.addError(lineno, 0, "M-102", coding) else: - self.__error(0, 0, "M-101") + self.addError(1, 0, "M-101") def __checkCopyright(self): """ Private method to check the presence of a copyright statement. """ - source = "".join(self.__source) - copyrightArgs = self.__args.get( + source = "".join(self.source) + copyrightArgs = self.args.get( "CopyrightChecker", MiscellaneousCheckerDefaultArgs["CopyrightChecker"] ) copyrightMinFileSize = copyrightArgs.get( @@ -612,7 +497,7 @@ copyrightRe = re.compile(copyrightRegexStr.format(author=r".*"), re.IGNORECASE) if not copyrightRe.search(topOfSource): - self.__error(0, 0, "M-111") + self.addError(1, 0, "M-111") return if copyrightAuthor: @@ -620,14 +505,14 @@ copyrightRegexStr.format(author=copyrightAuthor), re.IGNORECASE ) if not copyrightAuthorRe.search(topOfSource): - self.__error(0, 0, "M-112") + self.addError(1, 0, "M-112") def __checkCommentedCode(self): """ Private method to check for commented code. """ - source = "".join(self.__source) - commentedCodeCheckerArgs = self.__args.get( + source = "".join(self.source) + commentedCodeCheckerArgs = self.args.get( "CommentedCodeChecker", MiscellaneousCheckerDefaultArgs["CommentedCodeChecker"], ) @@ -638,7 +523,7 @@ for markedLine in self.__eradicator.commented_out_code_line_numbers( source, aggressive=aggressive ): - self.__error(markedLine - 1, 0, "M-891") + self.addError(markedLine, 0, "M-891") def __checkLineContinuation(self): """ @@ -646,7 +531,7 @@ """ # generate source lines without comments comments = [tok for tok in self.__tokens if tok[0] == tokenize.COMMENT] - stripped = self.__source[:] + stripped = self.source[:] for comment in comments: lineno = comment[3][0] start = comment[2][1] @@ -661,25 +546,25 @@ if strippedLine.endswith("\\") and not strippedLine.startswith( ("assert", "with") ): - self.__error(lineIndex, len(line), "M-841") + self.addError(lineIndex + 1, len(line), "M-841") def __checkPrintStatements(self): """ Private method to check for print statements. """ - for node in ast.walk(self.__tree): + for node in ast.walk(self.tree): if ( isinstance(node, ast.Call) and getattr(node.func, "id", None) == "print" ) or (hasattr(ast, "Print") and isinstance(node, ast.Print)): - self.__error(node.lineno - 1, node.col_offset, "M-801") + self.addErrorFromNode(node, "M-801") def __checkTuple(self): """ Private method to check for one element tuples. """ - for node in ast.walk(self.__tree): + for node in ast.walk(self.tree): if isinstance(node, ast.Tuple) and len(node.elts) == 1: - self.__error(node.lineno - 1, node.col_offset, "M-811") + self.addErrorFromNode(node, "M-811") def __checkFuture(self): """ @@ -687,7 +572,7 @@ """ expectedImports = { i.strip() - for i in self.__args.get("FutureChecker", "").split(",") + for i in self.args.get("FutureChecker", "").split(",") if bool(i.strip()) } if len(expectedImports) == 0: @@ -698,7 +583,7 @@ node = None hasCode = False - for node in ast.walk(self.__tree): + for node in ast.walk(self.tree): if isinstance(node, ast.ImportFrom) and node.module == "__future__": imports |= {name.name for name in node.names} elif isinstance(node, ast.Expr): @@ -714,26 +599,17 @@ if imports < expectedImports: if imports: - self.__error( - node.lineno - 1, - node.col_offset, - "M-701", - ", ".join(expectedImports), - ", ".join(imports), + self.addErrorFromNode( + node, "M-701", ", ".join(expectedImports), ", ".join(imports) ) else: - self.__error( - node.lineno - 1, - node.col_offset, - "M-702", - ", ".join(expectedImports), - ) + self.addErrorFromNode(node, "M-702", ", ".join(expectedImports)) def __checkPep3101(self): """ Private method to check for old style string formatting. """ - for lineno, line in enumerate(self.__source): + for lineno, line in enumerate(self.source, start=1): match = self.__pep3101FormatRegex.search(line) if match: lineLen = len(line) @@ -750,7 +626,7 @@ c = line[pos] if c in "diouxXeEfFgGcrs": formatter += c - self.__error(lineno, formatPos, "M-601", formatter) + self.addError(lineno, formatPos, "M-601", formatter) def __checkFormatString(self): """ @@ -762,7 +638,7 @@ coding = "utf-8" visitor = TextVisitor() - visitor.visit(self.__tree) + visitor.visit(self.tree) for node in visitor.nodes: text = node.value if isinstance(text, bytes): @@ -773,12 +649,12 @@ fields, implicit, explicit = self.__getFields(text) if implicit: if node in visitor.calls: - self.__error(node.lineno - 1, node.col_offset, "M-611") + self.addErrorFromNode(node, "M-611") else: if node.is_docstring: - self.__error(node.lineno - 1, node.col_offset, "M-612") + self.addErrorFromNode(node, "M-612") else: - self.__error(node.lineno - 1, node.col_offset, "M-613") + self.addErrorFromNode(node, "M-613") if node in visitor.calls: call, strArgs = visitor.calls[node] @@ -798,7 +674,7 @@ else: names.add(fieldMatch.group(1)) - keywords = {keyword.arg for keyword in call.keywords} + keywords = {kw.arg for kw in call.keywords} numArgs = len(call.args) if strArgs: numArgs -= 1 @@ -816,35 +692,31 @@ # parameters but at least check if the args are used if hasKwArgs and not names: # No names but kwargs - self.__error(call.lineno - 1, call.col_offset, "M-623") + self.addErrorFromNode(call, "M-623") if hasStarArgs and not numbers: # No numbers but args - self.__error(call.lineno - 1, call.col_offset, "M-624") + self.addErrorFromNode(call, "M-624") if not hasKwArgs and not hasStarArgs: # can actually verify numbers and names for number in sorted(numbers): if number >= numArgs: - self.__error( - call.lineno - 1, call.col_offset, "M-621", number - ) + self.addErrorFromNode(call, "M-621", number) for name in sorted(names): if name not in keywords: - self.__error( - call.lineno - 1, call.col_offset, "M-622", name - ) + self.addErrorFromNode(call, "M-622", name) for arg in range(numArgs): if arg not in numbers: - self.__error(call.lineno - 1, call.col_offset, "M-631", arg) + self.addErrorFromNode(call, "M-631", arg) - for keyword in keywords: - if keyword not in names: - self.__error(call.lineno - 1, call.col_offset, "M-632", keyword) + for kw in keywords: + if kw not in names: + self.addErrorFromNode(call, "M-632", kw) if implicit and explicit: - self.__error(call.lineno - 1, call.col_offset, "M-625") + self.addErrorFromNode(call, "M-625") def __getFields(self, string): """ @@ -887,11 +759,11 @@ with contextlib.suppress(AttributeError): functionDefs.append(ast.AsyncFunctionDef) - ignoreBuiltinAssignments = self.__args.get( + ignoreBuiltinAssignments = self.args.get( "BuiltinsChecker", MiscellaneousCheckerDefaultArgs["BuiltinsChecker"] ) - for node in ast.walk(self.__tree): + for node in ast.walk(self.tree): if isinstance(node, ast.Assign): # assign statement for element in node.targets: @@ -904,45 +776,33 @@ ): # ignore compatibility assignments continue - self.__error( - element.lineno - 1, element.col_offset, "M-131", element.id - ) + self.addErrorFromNode(element, "M-131", element.id) elif isinstance(element, (ast.Tuple, ast.List)): for tupleElement in element.elts: if ( isinstance(tupleElement, ast.Name) and tupleElement.id in self.__builtins ): - self.__error( - tupleElement.lineno - 1, - tupleElement.col_offset, - "M-131", - tupleElement.id, + self.addErrorFromNode( + tupleElement, "M-131", tupleElement.id ) elif isinstance(node, ast.For): # for loop target = node.target if isinstance(target, ast.Name) and target.id in self.__builtins: - self.__error( - target.lineno - 1, target.col_offset, "M-131", target.id - ) + self.addErrorFromNode(target, "M-131", target.id) elif isinstance(target, (ast.Tuple, ast.List)): for element in target.elts: if ( isinstance(element, ast.Name) and element.id in self.__builtins ): - self.__error( - element.lineno - 1, - element.col_offset, - "M-131", - element.id, - ) + self.addErrorFromNode(element, "M-131", element.id) elif any(isinstance(node, functionDef) for functionDef in functionDefs): # (asynchronous) function definition for arg in node.args.args: if isinstance(arg, ast.arg) and arg.arg in self.__builtins: - self.__error(arg.lineno - 1, arg.col_offset, "M-132", arg.arg) + self.addErrorFromNode(arg, "M-132", arg.arg) def __checkComprehensions(self): """ @@ -959,7 +819,7 @@ visitedMapCalls = set() - for node in ast.walk(self.__tree): + for node in ast.walk(self.tree): if isinstance(node, ast.Call) and isinstance(node.func, ast.Name): numPositionalArgs = len(node.args) numKeywordArgs = len(node.keywords) @@ -973,7 +833,7 @@ "list": "M-180", "set": "M-181", }[node.func.id] - self.__error(node.lineno - 1, node.col_offset, errorCode) + self.addErrorFromNode(node, errorCode) elif ( numPositionalArgs == 1 @@ -987,7 +847,7 @@ errorCode = "M-182" else: errorCode = "M-184" - self.__error(node.lineno - 1, node.col_offset, errorCode) + self.addErrorFromNode(node, errorCode) elif ( numPositionalArgs == 1 @@ -1000,9 +860,7 @@ "any": "M-199", "all": "M-199", }[node.func.id] - self.__error( - node.lineno - 1, node.col_offset, errorCode, node.func.id - ) + self.addErrorFromNode(node, errorCode, node.func.id) elif numPositionalArgs == 1 and ( isinstance(node.args[0], ast.Tuple) @@ -1014,9 +872,8 @@ "tuple": "M-189a", "list": "M-190a", }[node.func.id] - self.__error( - node.lineno - 1, - node.col_offset, + self.addErrorFromNode( + node, errorCode, type(node.args[0]).__name__.lower(), node.func.id, @@ -1032,12 +889,7 @@ type_ = "dict" else: type_ = "dict comprehension" - self.__error( - node.lineno - 1, - node.col_offset, - "M-198", - type_, - ) + self.addErrorFromNode(node, "M-198", type_) elif ( numPositionalArgs == 1 @@ -1059,9 +911,8 @@ "set": "M-185", "dict": "M-186", }[node.func.id] - self.__error( - node.lineno - 1, - node.col_offset, + self.addErrorFromNode( + node, errorCode, type(node.args[0]).__name__.lower(), node.func.id, @@ -1077,9 +928,7 @@ and numKeywordArgs == 0 and node.func.id in ("tuple", "list") ): - self.__error( - node.lineno - 1, node.col_offset, "M-188", node.func.id - ) + self.addErrorFromNode(node, "M-188", node.func.id) elif ( node.func.id in {"list", "reversed"} @@ -1100,17 +949,12 @@ ) if reverseFlagValue is None: - self.__error( - node.lineno - 1, - node.col_offset, - "M-193a", - node.func.id, - node.args[0].func.id, + self.addErrorFromNode( + node, "M-193a", node.func.id, node.args[0].func.id ) else: - self.__error( - node.lineno - 1, - node.col_offset, + self.addErrorFromNode( + node, "M-193b", node.func.id, node.args[0].func.id, @@ -1118,12 +962,8 @@ ) else: - self.__error( - node.lineno - 1, - node.col_offset, - "M-193c", - node.func.id, - node.args[0].func.id, + self.addErrorFromNode( + node, "M-193c", node.func.id, node.args[0].func.id ) elif ( @@ -1143,12 +983,8 @@ or (node.func.id == "set" and node.args[0].func.id == "set") ) ): - self.__error( - node.lineno - 1, - node.col_offset, - "M-194", - node.args[0].func.id, - node.func.id, + self.addErrorFromNode( + node, "M-194", node.args[0].func.id, node.func.id ) elif ( @@ -1163,9 +999,7 @@ and isinstance(node.args[0].slice.step.operand, ast.Constant) and node.args[0].slice.step.operand.n == 1 ): - self.__error( - node.lineno - 1, node.col_offset, "M-195", node.func.id - ) + self.addErrorFromNode(node, "M-195", node.func.id) elif ( node.func.id == "map" @@ -1173,12 +1007,7 @@ and len(node.args) == 2 and isinstance(node.args[0], ast.Lambda) ): - self.__error( - node.lineno - 1, - node.col_offset, - "M-197", - "generator expression", - ) + self.addErrorFromNode(node, "M-197", "generator expression") elif ( node.func.id in ("list", "set", "dict") @@ -1206,9 +1035,7 @@ if rewriteable: comprehensionType = f"{node.func.id} comprehension" - self.__error( - node.lineno - 1, node.col_offset, "M-197", comprehensionType - ) + self.addErrorFromNode(node, "M-197", comprehensionType) elif isinstance(node, (ast.DictComp, ast.ListComp, ast.SetComp)) and ( len(node.generators) == 1 @@ -1231,12 +1058,7 @@ and isinstance(node.generators[0].target.elts[1], ast.Name) and node.generators[0].target.elts[1].id == node.value.id ): - self.__error( - node.lineno - 1, - node.col_offset, - "M-196", - compType[node.__class__], - ) + self.addErrorFromNode(node, "M-196", compType[node.__class__]) elif ( isinstance(node, ast.DictComp) @@ -1245,12 +1067,7 @@ and isinstance(node.generators[0].target, ast.Name) and node.key.id == node.generators[0].target.id ): - self.__error( - node.lineno - 1, - node.col_offset, - "M-200", - compType[node.__class__], - ) + self.addErrorFromNode(node, "M-200", compType[node.__class__]) def __dictShouldBeChecked(self, node): """ @@ -1265,8 +1082,9 @@ return False if ( - "__IGNORE_WARNING__" in self.__source[node.lineno - 1] - or "__IGNORE_WARNING_M251__" in self.__source[node.lineno - 1] + "__IGNORE_WARNING__" in self.source[node.lineno - 1] + or "__IGNORE_WARNING_M-251__" in self.source[node.lineno - 1] + or "noqa: M-251" in self.source[node.lineno - 1] ): return False @@ -1277,52 +1095,39 @@ """ Private method to check, if dictionary keys appear in sorted order. """ - for node in ast.walk(self.__tree): + for node in ast.walk(self.tree): if isinstance(node, ast.Dict) and self.__dictShouldBeChecked(node): for key1, key2 in zip(node.keys, node.keys[1:]): if key2.value < key1.value: - self.__error( - key2.lineno - 1, - key2.col_offset, - "M-251", - key2.value, - key1.value, - ) + self.addErrorFromNode(key2, "M-251", key2.value, key1.value) def __checkGettext(self): """ Private method to check the 'gettext' import statement. """ - for node in ast.walk(self.__tree): + for node in ast.walk(self.tree): if isinstance(node, ast.ImportFrom) and any( name.asname == "_" for name in node.names ): - self.__error( - node.lineno - 1, node.col_offset, "M-711", node.names[0].name - ) + self.addErrorFromNode(node, "M-711", node.names[0].name) def __checkBugBear(self): """ Private method for bugbear checks. """ visitor = BugBearVisitor() - visitor.visit(self.__tree) + visitor.visit(self.tree) for violation in visitor.violations: - node = violation[0] - reason = violation[1] - params = violation[2:] - self.__error(node.lineno - 1, node.col_offset, reason, *params) + self.addErrorFromNode(*violation) def __checkReturn(self): """ Private method to check return statements. """ visitor = ReturnVisitor() - visitor.visit(self.__tree) + visitor.visit(self.tree) for violation in visitor.violations: - node = violation[0] - reason = violation[1] - self.__error(node.lineno - 1, node.col_offset, reason) + self.addErrorFromNode(*violation) def __checkDateTime(self): """ @@ -1330,7 +1135,7 @@ """ # step 1: generate an augmented node tree containing parent info # for each child node - tree = copy.deepcopy(self.__tree) + tree = copy.deepcopy(self.tree) for node in ast.walk(tree): for childNode in ast.iter_child_nodes(node): childNode._dtCheckerParent = node @@ -1339,27 +1144,23 @@ visitor = DateTimeVisitor() visitor.visit(tree) for violation in visitor.violations: - node = violation[0] - reason = violation[1] - self.__error(node.lineno - 1, node.col_offset, reason) + self.addErrorFromNode(*violation) def __checkSysVersion(self): """ Private method to check the use of sys.version and sys.version_info. """ visitor = SysVersionVisitor() - visitor.visit(self.__tree) + visitor.visit(self.tree) for violation in visitor.violations: - node = violation[0] - reason = violation[1] - self.__error(node.lineno - 1, node.col_offset, reason) + self.addErrorFromNode(*violation) def __checkProperties(self): """ Private method to check for issue with property related methods. """ properties = [] - for node in ast.walk(self.__tree): + for node in ast.walk(self.tree): if isinstance(node, ast.ClassDef): properties.clear() @@ -1371,12 +1172,7 @@ propertyCount += 1 properties.append(node.name) if len(node.args.args) != 1: - self.__error( - node.lineno - 1, - node.col_offset, - "M-260", - len(node.args.args), - ) + self.addErrorFromNode(node, "M-260", len(node.args.args)) if isinstance(decorator, ast.Attribute): # property setter method @@ -1384,27 +1180,16 @@ propertyCount += 1 if node.name != decorator.value.id: if node.name in properties: - self.__error( - node.lineno - 1, - node.col_offset, - "M-265", - node.name, - decorator.value.id, + self.addErrorFromNode( + node, "M-265", node.name, decorator.value.id ) else: - self.__error( - node.lineno - 1, - node.col_offset, - "M-263", - decorator.value.id, - node.name, + self.addErrorFromNode( + node, "M-263", decorator.value.id, node.name ) if len(node.args.args) != 2: - self.__error( - node.lineno - 1, - node.col_offset, - "M-261", - len(node.args.args), + self.addErrorFromNode( + node, "M-261", len(node.args.args) ) # property deleter method @@ -1412,31 +1197,20 @@ propertyCount += 1 if node.name != decorator.value.id: if node.name in properties: - self.__error( - node.lineno - 1, - node.col_offset, - "M-266", - node.name, - decorator.value.id, + self.addErrorFromNode( + node, "M-266", node.name, decorator.value.id ) else: - self.__error( - node.lineno - 1, - node.col_offset, - "M-264", - decorator.value.id, - node.name, + self.addErrorFromNode( + node, "M-264", decorator.value.id, node.name ) if len(node.args.args) != 1: - self.__error( - node.lineno - 1, - node.col_offset, - "M-262", - len(node.args.args), + self.addErrorFromNode( + node, "M-262", len(node.args.args) ) if propertyCount > 1: - self.__error(node.lineno - 1, node.col_offset, "M-267", node.name) + self.addErrorFromNode(node, "M-267", node.name) ####################################################################### ## The following methods check for implicitly concatenated strings. @@ -1509,8 +1283,8 @@ ) for a, b in pairwise(tokensWithoutWhitespace): if self.__isImplicitStringConcat(a, b): - self.__error( - a.end[0] - 1, + self.addError( + a.end[0], a.end[1], "M-851" if a.end[0] == b.start[0] else "M-852", ) @@ -1519,7 +1293,7 @@ """ Private method to check for explicitly concatenated strings. """ - for node in ast.walk(self.__tree): + for node in ast.walk(self.tree): if ( isinstance(node, ast.BinOp) and isinstance(node.op, ast.Add) @@ -1529,7 +1303,7 @@ for operand in (node.left, node.right) ) ): - self.__error(node.lineno - 1, node.col_offset, "M-853") + self.addErrorFromNode(node, "M-853") ################################################################################# ## The following method checks default match cases. @@ -1540,3038 +1314,6 @@ Private method to check the default match case. """ visitor = DefaultMatchCaseVisitor() - visitor.visit(self.__tree) + visitor.visit(self.tree) for violation in visitor.violations: - node = violation[0] - reason = violation[1] - self.__error(node.lineno - 1, node.col_offset, reason) - - -class TextVisitor(ast.NodeVisitor): - """ - Class implementing a node visitor for bytes and str instances. - - It tries to detect docstrings as string of the first expression of each - module, class or function. - """ - - # modeled after the string format flake8 extension - - def __init__(self): - """ - Constructor - """ - super().__init__() - self.nodes = [] - self.calls = {} - - def __addNode(self, node): - """ - Private method to add a node to our list of nodes. - - @param node reference to the node to add - @type ast.AST - """ - if not hasattr(node, "is_docstring"): - node.is_docstring = False - self.nodes.append(node) - - def visit_Constant(self, node): - """ - Public method to handle constant nodes. - - @param node reference to the bytes node - @type ast.Constant - """ - if AstUtilities.isBaseString(node): - self.__addNode(node) - else: - super().generic_visit(node) - - def __visitDefinition(self, node): - """ - Private method handling class and function definitions. - - @param node reference to the node to handle - @type ast.FunctionDef, ast.AsyncFunctionDef or ast.ClassDef - """ - # Manually traverse class or function definition - # * Handle decorators normally - # * Use special check for body content - # * Don't handle the rest (e.g. bases) - for decorator in node.decorator_list: - self.visit(decorator) - self.__visitBody(node) - - def __visitBody(self, node): - """ - Private method to traverse the body of the node manually. - - If the first node is an expression which contains a string or bytes it - marks that as a docstring. - - @param node reference to the node to traverse - @type ast.AST - """ - if ( - node.body - and isinstance(node.body[0], ast.Expr) - and AstUtilities.isBaseString(node.body[0].value) - ): - node.body[0].value.is_docstring = True - - for subnode in node.body: - self.visit(subnode) - - def visit_Module(self, node): - """ - Public method to handle a module. - - @param node reference to the node to handle - @type ast.Module - """ - self.__visitBody(node) - - def visit_ClassDef(self, node): - """ - Public method to handle a class definition. - - @param node reference to the node to handle - @type ast.ClassDef - """ - # Skipped nodes: ('name', 'bases', 'keywords', 'starargs', 'kwargs') - self.__visitDefinition(node) - - def visit_FunctionDef(self, node): - """ - Public method to handle a function definition. - - @param node reference to the node to handle - @type ast.FunctionDef - """ - # Skipped nodes: ('name', 'args', 'returns') - self.__visitDefinition(node) - - def visit_AsyncFunctionDef(self, node): - """ - Public method to handle an asynchronous function definition. - - @param node reference to the node to handle - @type ast.AsyncFunctionDef - """ - # Skipped nodes: ('name', 'args', 'returns') - self.__visitDefinition(node) - - def visit_Call(self, node): - """ - Public method to handle a function call. - - @param node reference to the node to handle - @type ast.Call - """ - if isinstance(node.func, ast.Attribute) and node.func.attr == "format": - if AstUtilities.isBaseString(node.func.value): - self.calls[node.func.value] = (node, False) - elif ( - isinstance(node.func.value, ast.Name) - and node.func.value.id == "str" - and node.args - and AstUtilities.isBaseString(node.args[0]) - ): - self.calls[node.args[0]] = (node, True) - super().generic_visit(node) - - -####################################################################### -## BugBearVisitor -## -## adapted from: flake8-bugbear v24.12.12 -## -## Original: Copyright (c) 2016 Łukasz Langa -####################################################################### - -BugBearContext = namedtuple("BugBearContext", ["node", "stack"]) - - -@dataclass -class M540CaughtException: - """ - Class to hold the data for a caught exception. - """ - - name: str - hasNote: bool - - -class M541UnhandledKeyType: - """ - Class to hold a dictionary key of a type that we do not check for duplicates. - """ - - -class M541VariableKeyType: - """ - Class to hold the name of a variable key type. - """ - - def __init__(self, name): - """ - Constructor - - @param name name of the variable key type - @type str - """ - self.name = name - - -class BugBearVisitor(ast.NodeVisitor): - """ - Class implementing a node visitor to check for various topics. - """ - - CONTEXTFUL_NODES = ( - ast.Module, - ast.ClassDef, - ast.AsyncFunctionDef, - ast.FunctionDef, - ast.Lambda, - ast.ListComp, - ast.SetComp, - ast.DictComp, - ast.GeneratorExp, - ) - - FUNCTION_NODES = ( - ast.AsyncFunctionDef, - ast.FunctionDef, - ast.Lambda, - ) - - NodeWindowSize = 4 - - def __init__(self): - """ - Constructor - """ - super().__init__() - - self.nodeWindow = [] - self.violations = [] - self.contexts = [] - - self.__M523Seen = set() - self.__M505Imports = set() - self.__M540CaughtException = None - - self.__inTryStar = "" - - @property - def nodeStack(self): - """ - Public method to get a reference to the most recent node stack. - - @return reference to the most recent node stack - @rtype list - """ - if len(self.contexts) == 0: - return [] - - context, stack = self.contexts[-1] - return stack - - def __isIdentifier(self, arg): - """ - Private method to check if arg is a valid identifier. - - See https://docs.python.org/2/reference/lexical_analysis.html#identifiers - - @param arg reference to an argument node - @type ast.Node - @return flag indicating a valid identifier - @rtype TYPE - """ - if not AstUtilities.isString(arg): - return False - - return ( - re.match(r"^[A-Za-z_][A-Za-z0-9_]*$", AstUtilities.getValue(arg)) - is not None - ) - - def toNameStr(self, node): - """ - Public method to turn Name and Attribute nodes to strings, handling any - depth of attribute accesses. - - - @param node reference to the node - @type ast.Name or ast.Attribute - @return string representation - @rtype str - """ - if isinstance(node, ast.Name): - return node.id - elif isinstance(node, ast.Call): - return self.toNameStr(node.func) - elif isinstance(node, ast.Attribute): - inner = self.toNameStr(node.value) - if inner is None: - return None - return f"{inner}.{node.attr}" - else: - return None - - def __typesafeIssubclass(self, obj, classOrTuple): - """ - Private method implementing a type safe issubclass() function. - - @param obj reference to the object to be tested - @type Any - @param classOrTuple type to check against - @type type - @return flag indicating a subclass - @rtype bool - """ - try: - return issubclass(obj, classOrTuple) - except TypeError: - # User code specifies a type that is not a type in our current run. - # Might be their error, might be a difference in our environments. - # We don't know so we ignore this. - return False - - def __getAssignedNames(self, loopNode): - """ - Private method to get the names of a for loop. - - @param loopNode reference to the node to be processed - @type ast.For - @yield DESCRIPTION - @ytype TYPE - """ - loopTargets = (ast.For, ast.AsyncFor, ast.comprehension) - for node in self.__childrenInScope(loopNode): - if isinstance(node, (ast.Assign)): - for child in node.targets: - yield from self.__namesFromAssignments(child) - if isinstance(node, loopTargets + (ast.AnnAssign, ast.AugAssign)): - yield from self.__namesFromAssignments(node.target) - - def __namesFromAssignments(self, assignTarget): - """ - Private method to get names of an assignment. - - @param assignTarget reference to the node to be processed - @type ast.Node - @yield name of the assignment - @ytype str - """ - if isinstance(assignTarget, ast.Name): - yield assignTarget.id - elif isinstance(assignTarget, ast.Starred): - yield from self.__namesFromAssignments(assignTarget.value) - elif isinstance(assignTarget, (ast.List, ast.Tuple)): - for child in assignTarget.elts: - yield from self.__namesFromAssignments(child) - - def __childrenInScope(self, node): - """ - Private method to get all child nodes in the given scope. - - @param node reference to the node to be processed - @type ast.Node - @yield reference to a child node - @ytype ast.Node - """ - yield node - if not isinstance(node, BugBearVisitor.FUNCTION_NODES): - for child in ast.iter_child_nodes(node): - yield from self.__childrenInScope(child) - - def __flattenExcepthandler(self, node): - """ - Private method to flatten the list of exceptions handled by an except handler. - - @param node reference to the node to be processed - @type ast.Node - @yield reference to the exception type node - @ytype ast.Node - """ - if not isinstance(node, ast.Tuple): - yield node - return - - exprList = node.elts.copy() - while len(exprList): - expr = exprList.pop(0) - if isinstance(expr, ast.Starred) and isinstance( - expr.value, (ast.List, ast.Tuple) - ): - exprList.extend(expr.value.elts) - continue - yield expr - - def __checkRedundantExcepthandlers(self, names, node, inTryStar): - """ - Private method to check for redundant exception types in an exception handler. - - @param names list of exception types to be checked - @type list of ast.Name - @param node reference to the exception handler node - @type ast.ExceptionHandler - @param inTryStar character indicating an 'except*' handler - @type str - @return tuple containing the error data - @rtype tuple of (ast.Node, str, str, str, str) - """ - redundantExceptions = { - "OSError": { - # All of these are actually aliases of OSError since Python 3.3 - "IOError", - "EnvironmentError", - "WindowsError", - "mmap.error", - "socket.error", - "select.error", - }, - "ValueError": { - "binascii.Error", - }, - } - - # See if any of the given exception names could be removed, e.g. from: - # (MyError, MyError) # duplicate names - # (MyError, BaseException) # everything derives from the Base - # (Exception, TypeError) # builtins where one subclasses another - # (IOError, OSError) # IOError is an alias of OSError since Python3.3 - # but note that other cases are impractical to handle from the AST. - # We expect this is mostly useful for users who do not have the - # builtin exception hierarchy memorised, and include a 'shadowed' - # subtype without realising that it's redundant. - good = sorted(set(names), key=names.index) - if "BaseException" in good: - good = ["BaseException"] - # Remove redundant exceptions that the automatic system either handles - # poorly (usually aliases) or can't be checked (e.g. it's not an - # built-in exception). - for primary, equivalents in redundantExceptions.items(): - if primary in good: - good = [g for g in good if g not in equivalents] - - for name, other in itertools.permutations(tuple(good), 2): - if ( - self.__typesafeIssubclass( - getattr(builtins, name, type), getattr(builtins, other, ()) - ) - and name in good - ): - good.remove(name) - if good != names: - desc = good[0] if len(good) == 1 else "({0})".format(", ".join(good)) - as_ = " as " + node.name if node.name is not None else "" - return (node, "M-514", ", ".join(names), as_, desc, inTryStar) - - return None - - def __walkList(self, nodes): - """ - Private method to walk a given list of nodes. - - @param nodes list of nodes to walk - @type list of ast.Node - @yield node references as determined by the ast.walk() function - @ytype ast.Node - """ - for node in nodes: - yield from ast.walk(node) - - def __getNamesFromTuple(self, node): - """ - Private method to get the names from an ast.Tuple node. - - @param node ast node to be processed - @type ast.Tuple - @yield names - @ytype str - """ - for dim in node.elts: - if isinstance(dim, ast.Name): - yield dim.id - elif isinstance(dim, ast.Tuple): - yield from self.__getNamesFromTuple(dim) - - def __getDictCompLoopAndNamedExprVarNames(self, node): - """ - Private method to get the names of comprehension loop variables. - - @param node ast node to be processed - @type ast.DictComp - @yield loop variable names - @ytype str - """ - finder = NamedExprFinder() - for gen in node.generators: - if isinstance(gen.target, ast.Name): - yield gen.target.id - elif isinstance(gen.target, ast.Tuple): - yield from self.__getNamesFromTuple(gen.target) - - finder.visit(gen.ifs) - - yield from finder.getNames().keys() - - def __inClassInit(self): - """ - Private method to check, if we are inside an '__init__' method. - - @return flag indicating being within the '__init__' method - @rtype bool - """ - return ( - len(self.contexts) >= 2 - and isinstance(self.contexts[-2].node, ast.ClassDef) - and isinstance(self.contexts[-1].node, ast.FunctionDef) - and self.contexts[-1].node.name == "__init__" - ) - - def visit_Return(self, node): - """ - Public method to handle 'Return' nodes. - - @param node reference to the node to be processed - @type ast.Return - """ - if self.__inClassInit() and node.value is not None: - self.violations.append((node, "M-537")) - - self.generic_visit(node) - - def visit_Yield(self, node): - """ - Public method to handle 'Yield' nodes. - - @param node reference to the node to be processed - @type ast.Yield - """ - if self.__inClassInit(): - self.violations.append((node, "M-537")) - - self.generic_visit(node) - - def visit_YieldFrom(self, node) -> None: - """ - Public method to handle 'YieldFrom' nodes. - - @param node reference to the node to be processed - @type ast.YieldFrom - """ - if self.__inClassInit(): - self.violations.append((node, "M-537")) - - self.generic_visit(node) - - def visit(self, node): - """ - Public method to traverse a given AST node. - - @param node AST node to be traversed - @type ast.Node - """ - isContextful = isinstance(node, BugBearVisitor.CONTEXTFUL_NODES) - - if isContextful: - context = BugBearContext(node, []) - self.contexts.append(context) - - self.nodeStack.append(node) - self.nodeWindow.append(node) - self.nodeWindow = self.nodeWindow[-BugBearVisitor.NodeWindowSize :] - - super().visit(node) - - self.nodeStack.pop() - - if isContextful: - self.contexts.pop() - - self.__checkForM518(node) - - def visit_ExceptHandler(self, node): - """ - Public method to handle exception handlers. - - @param node reference to the node to be processed - @type ast.ExceptHandler - """ - if node.type is None: - # bare except is handled by pycodestyle already - self.generic_visit(node) - return - - oldM540CaughtException = self.__M540CaughtException - if node.name is None: - self.__M540CaughtException = None - else: - self.__M540CaughtException = M540CaughtException(node.name, False) - - names = self.__checkForM513_M514_M529_M530(node) - - if "BaseException" in names and not ExceptBaseExceptionVisitor(node).reRaised(): - self.violations.append((node, "M-536")) - - self.generic_visit(node) - - if ( - self.__M540CaughtException is not None - and self.__M540CaughtException.hasNote - ): - self.violations.append((node, "M-540")) - self.__M540CaughtException = oldM540CaughtException - - def visit_UAdd(self, node): - """ - Public method to handle unary additions. - - @param node reference to the node to be processed - @type ast.UAdd - """ - trailingNodes = list(map(type, self.nodeWindow[-4:])) - if trailingNodes == [ast.UnaryOp, ast.UAdd, ast.UnaryOp, ast.UAdd]: - originator = self.nodeWindow[-4] - self.violations.append((originator, "M-502")) - - self.generic_visit(node) - - def visit_Call(self, node): - """ - Public method to handle a function call. - - @param node reference to the node to be processed - @type ast.Call - """ - isM540AddNote = False - - if isinstance(node.func, ast.Attribute): - self.__checkForM505(node) - isM540AddNote = self.__checkForM540AddNote(node.func) - else: - with contextlib.suppress(AttributeError, IndexError): - # bad super() call - if isinstance(node.func, ast.Name) and node.func.id == "super": - args = node.args - if ( - len(args) == 2 - and isinstance(args[0], ast.Attribute) - and isinstance(args[0].value, ast.Name) - and args[0].value.id == "self" - and args[0].attr == "__class__" - ): - self.violations.append((node, "M-582")) - - # bad getattr and setattr - if ( - node.func.id in ("getattr", "hasattr") - and node.args[1].value == "__call__" - ): - self.violations.append((node, "M-504")) - if ( - node.func.id == "getattr" - and len(node.args) == 2 - and self.__isIdentifier(node.args[1]) - and iskeyword(AstUtilities.getValue(node.args[1])) - ): - self.violations.append((node, "M-509")) - elif ( - node.func.id == "setattr" - and len(node.args) == 3 - and self.__isIdentifier(node.args[1]) - and iskeyword(AstUtilities.getValue(node.args[1])) - ): - self.violations.append((node, "M-510")) - - self.__checkForM526(node) - - self.__checkForM528(node) - self.__checkForM534(node) - self.__checkForM539(node) - - # no need for copying, if used in nested calls it will be set to None - currentM540CaughtException = self.__M540CaughtException - if not isM540AddNote: - self.__checkForM540Usage(node.args) - self.__checkForM540Usage(node.keywords) - - self.generic_visit(node) - - if isM540AddNote: - # Avoid nested calls within the parameter list using the variable itself. - # e.g. `e.add_note(str(e))` - self.__M540CaughtException = currentM540CaughtException - - def visit_Module(self, node): - """ - Public method to handle a module node. - - @param node reference to the node to be processed - @type ast.Module - """ - self.generic_visit(node) - - def visit_Assign(self, node): - """ - Public method to handle assignments. - - @param node reference to the node to be processed - @type ast.Assign - """ - self.__checkForM540Usage(node.value) - if len(node.targets) == 1: - target = node.targets[0] - if ( - isinstance(target, ast.Attribute) - and isinstance(target.value, ast.Name) - and (target.value.id, target.attr) == ("os", "environ") - ): - self.violations.append((node, "M-503")) - - self.generic_visit(node) - - def visit_For(self, node): - """ - Public method to handle 'for' statements. - - @param node reference to the node to be processed - @type ast.For - """ - self.__checkForM507(node) - self.__checkForM520(node) - self.__checkForM523(node) - self.__checkForM531(node) - self.__checkForM569(node) - - self.generic_visit(node) - - def visit_AsyncFor(self, node): - """ - Public method to handle 'for' statements. - - @param node reference to the node to be processed - @type ast.AsyncFor - """ - self.__checkForM507(node) - self.__checkForM520(node) - self.__checkForM523(node) - self.__checkForM531(node) - - self.generic_visit(node) - - def visit_While(self, node): - """ - Public method to handle 'while' statements. - - @param node reference to the node to be processed - @type ast.While - """ - self.__checkForM523(node) - - self.generic_visit(node) - - def visit_ListComp(self, node): - """ - Public method to handle list comprehensions. - - @param node reference to the node to be processed - @type ast.ListComp - """ - self.__checkForM523(node) - - self.generic_visit(node) - - def visit_SetComp(self, node): - """ - Public method to handle set comprehensions. - - @param node reference to the node to be processed - @type ast.SetComp - """ - self.__checkForM523(node) - - self.generic_visit(node) - - def visit_DictComp(self, node): - """ - Public method to handle dictionary comprehensions. - - @param node reference to the node to be processed - @type ast.DictComp - """ - self.__checkForM523(node) - self.__checkForM535(node) - - self.generic_visit(node) - - def visit_GeneratorExp(self, node): - """ - Public method to handle generator expressions. - - @param node reference to the node to be processed - @type ast.GeneratorExp - """ - self.__checkForM523(node) - - self.generic_visit(node) - - def visit_Assert(self, node): - """ - Public method to handle 'assert' statements. - - @param node reference to the node to be processed - @type ast.Assert - """ - if ( - AstUtilities.isNameConstant(node.test) - and AstUtilities.getValue(node.test) is False - ): - self.violations.append((node, "M-511")) - - self.generic_visit(node) - - def visit_AsyncFunctionDef(self, node): - """ - Public method to handle async function definitions. - - @param node reference to the node to be processed - @type ast.AsyncFunctionDef - """ - self.__checkForM506_M508(node) - - self.generic_visit(node) - - def visit_FunctionDef(self, node): - """ - Public method to handle function definitions. - - @param node reference to the node to be processed - @type ast.FunctionDef - """ - self.__checkForM506_M508(node) - self.__checkForM519(node) - self.__checkForM521(node) - - self.generic_visit(node) - - def visit_ClassDef(self, node): - """ - Public method to handle class definitions. - - @param node reference to the node to be processed - @type ast.ClassDef - """ - self.__checkForM521(node) - self.__checkForM524_M527(node) - - self.generic_visit(node) - - def visit_Try(self, node): - """ - Public method to handle 'try' statements. - - @param node reference to the node to be processed - @type ast.Try - """ - self.__checkForM512(node) - self.__checkForM525(node) - - self.generic_visit(node) - - def visit_TryStar(self, node): - """ - Public method to handle 'except*' statements. - - @param node reference to the node to be processed - @type ast.TryStar - """ - outerTryStar = self.__inTryStar - self.__inTryStar = "*" - self.visit_Try(node) - self.__inTryStar = outerTryStar - - def visit_Compare(self, node): - """ - Public method to handle comparison statements. - - @param node reference to the node to be processed - @type ast.Compare - """ - self.__checkForM515(node) - - self.generic_visit(node) - - def visit_Raise(self, node): - """ - Public method to handle 'raise' statements. - - @param node reference to the node to be processed - @type ast.Raise - """ - if node.exc is None: - self.__M540CaughtException = None - else: - self.__checkForM540Usage(node.exc) - self.__checkForM540Usage(node.cause) - self.__checkForM516(node) - - self.generic_visit(node) - - def visit_With(self, node): - """ - Public method to handle 'with' statements. - - @param node reference to the node to be processed - @type ast.With - """ - self.__checkForM517(node) - self.__checkForM522(node) - - self.generic_visit(node) - - def visit_JoinedStr(self, node): - """ - Public method to handle f-string arguments. - - @param node reference to the node to be processed - @type ast.JoinedStr - """ - for value in node.values: - if isinstance(value, ast.FormattedValue): - return - - self.violations.append((node, "M-581")) - - def visit_AnnAssign(self, node): - """ - Public method to check annotated assign statements. - - @param node reference to the node to be processed - @type ast.AnnAssign - """ - self.__checkForM532(node) - self.__checkForM540Usage(node.value) - - self.generic_visit(node) - - def visit_Import(self, node): - """ - Public method to check imports. - - @param node reference to the node to be processed - @type ast.Import - """ - self.__checkForM505(node) - - self.generic_visit(node) - - def visit_ImportFrom(self, node): - """ - Public method to check from imports. - - @param node reference to the node to be processed - @type ast.Import - """ - self.visit_Import(node) - - def visit_Set(self, node): - """ - Public method to check a set. - - @param node reference to the node to be processed - @type ast.Set - """ - self.__checkForM533(node) - - self.generic_visit(node) - - def visit_Dict(self, node): - """ - Public method to check a dictionary. - - @param node reference to the node to be processed - @type ast.Dict - """ - self.__checkForM541(node) - - self.generic_visit(node) - - def __checkForM505(self, node): - """ - Private method to check the use of *strip(). - - @param node reference to the node to be processed - @type ast.Call - """ - if isinstance(node, ast.Import): - for name in node.names: - self.__M505Imports.add(name.asname or name.name) - elif isinstance(node, ast.ImportFrom): - for name in node.names: - self.__M505Imports.add(f"{node.module}.{name.name or name.asname}") - elif isinstance(node, ast.Call) and isinstance(node.func, ast.Attribute): - if node.func.attr not in ("lstrip", "rstrip", "strip"): - return # method name doesn't match - - if ( - isinstance(node.func.value, ast.Name) - and node.func.value.id in self.__M505Imports - ): - return # method is being run on an imported module - - if len(node.args) != 1 or not AstUtilities.isString(node.args[0]): - return # used arguments don't match the builtin strip - - value = AstUtilities.getValue(node.args[0]) - if len(value) == 1: - return # stripping just one character - - if len(value) == len(set(value)): - return # no characters appear more than once - - self.violations.append((node, "M-505")) - - def __checkForM506_M508(self, node): - """ - Private method to check the use of mutable literals, comprehensions and calls. - - @param node reference to the node to be processed - @type ast.AsyncFunctionDef or ast.FunctionDef - """ - visitor = FunctionDefDefaultsVisitor("M-506", "M-508") - visitor.visit(node.args.defaults + node.args.kw_defaults) - self.violations.extend(visitor.errors) - - def __checkForM507(self, node): - """ - Private method to check for unused loop variables. - - @param node reference to the node to be processed - @type ast.For or ast.AsyncFor - """ - targets = NameFinder() - targets.visit(node.target) - ctrlNames = set(filter(lambda s: not s.startswith("_"), targets.getNames())) - body = NameFinder() - for expr in node.body: - body.visit(expr) - usedNames = set(body.getNames()) - for name in sorted(ctrlNames - usedNames): - n = targets.getNames()[name][0] - self.violations.append((n, "M-507", name)) - - def __checkForM512(self, node): - """ - Private method to check for return/continue/break inside finally blocks. - - @param node reference to the node to be processed - @type ast.Try - """ - - def _loop(node, badNodeTypes): - if isinstance(node, (ast.AsyncFunctionDef, ast.FunctionDef)): - return - - if isinstance(node, (ast.While, ast.For)): - badNodeTypes = (ast.Return,) - - elif isinstance(node, badNodeTypes): - self.violations.append((node, "M-512", self.__inTryStar)) - - for child in ast.iter_child_nodes(node): - _loop(child, badNodeTypes) - - for child in node.finalbody: - _loop(child, (ast.Return, ast.Continue, ast.Break)) - - def __checkForM513_M514_M529_M530(self, node): - """ - Private method to check various exception handler situations. - - @param node reference to the node to be processed - @type ast.ExceptHandler - @return list of exception handler names - @rtype list of str - """ - handlers = self.__flattenExcepthandler(node.type) - names = [] - badHandlers = [] - ignoredHandlers = [] - - for handler in handlers: - if isinstance(handler, (ast.Name, ast.Attribute)): - name = self.toNameStr(handler) - if name is None: - ignoredHandlers.append(handler) - else: - names.append(name) - elif isinstance(handler, (ast.Call, ast.Starred)): - ignoredHandlers.append(handler) - else: - badHandlers.append(handler) - if badHandlers: - self.violations.append((node, "M-530")) - if len(names) == 0 and not badHandlers and not ignoredHandlers: - self.violations.append((node, "M-529", self.__inTryStar)) - elif ( - len(names) == 1 - and not badHandlers - and not ignoredHandlers - and isinstance(node.type, ast.Tuple) - ): - self.violations.append((node, "M-513", *names, self.__inTryStar)) - else: - maybeError = self.__checkRedundantExcepthandlers( - names, node, self.__inTryStar - ) - if maybeError is not None: - self.violations.append(maybeError) - return names - - def __checkForM515(self, node): - """ - Private method to check for pointless comparisons. - - @param node reference to the node to be processed - @type ast.Compare - """ - if isinstance(self.nodeStack[-2], ast.Expr): - self.violations.append((node, "M-515")) - - def __checkForM516(self, node): - """ - Private method to check for raising a literal instead of an exception. - - @param node reference to the node to be processed - @type ast.Raise - """ - if ( - AstUtilities.isNameConstant(node.exc) - or AstUtilities.isNumber(node.exc) - or AstUtilities.isString(node.exc) - ): - self.violations.append((node, "M-516")) - - def __checkForM517(self, node): - """ - Private method to check for use of the evil syntax - 'with assertRaises(Exception): or 'with pytest.raises(Exception):'. - - @param node reference to the node to be processed - @type ast.With - """ - item = node.items[0] - itemContext = item.context_expr - if ( - hasattr(itemContext, "func") - and ( - ( - isinstance(itemContext.func, ast.Attribute) - and ( - itemContext.func.attr == "assertRaises" - or ( - itemContext.func.attr == "raises" - and isinstance(itemContext.func.value, ast.Name) - and itemContext.func.value.id == "pytest" - and "match" not in (kwd.arg for kwd in itemContext.keywords) - ) - ) - ) - or ( - isinstance(itemContext.func, ast.Name) - and itemContext.func.id == "raises" - and isinstance(itemContext.func.ctx, ast.Load) - and "pytest.raises" in self.__M505Imports - and "match" not in (kwd.arg for kwd in itemContext.keywords) - ) - ) - and len(itemContext.args) == 1 - and isinstance(itemContext.args[0], ast.Name) - and itemContext.args[0].id in ("Exception", "BaseException") - and not item.optional_vars - ): - self.violations.append((node, "M-517")) - - def __checkForM518(self, node): - """ - Private method to check for useless expressions. - - @param node reference to the node to be processed - @type ast.FunctionDef - """ - if not isinstance(node, ast.Expr): - return - - if isinstance( - node.value, - (ast.List, ast.Set, ast.Dict, ast.Tuple), - ) or ( - isinstance(node.value, ast.Constant) - and ( - isinstance( - node.value.value, - (int, float, complex, bytes, bool), - ) - or node.value.value is None - ) - ): - self.violations.append((node, "M-518", node.value.__class__.__name__)) - - def __checkForM519(self, node): - """ - Private method to check for use of 'functools.lru_cache' or 'functools.cache'. - - @param node reference to the node to be processed - @type ast.FunctionDef - """ - caches = { - "functools.cache", - "functools.lru_cache", - "cache", - "lru_cache", - } - - if ( - len(node.decorator_list) == 0 - or len(self.contexts) < 2 - or not isinstance(self.contexts[-2].node, ast.ClassDef) - ): - return - - # Preserve decorator order so we can get the lineno from the decorator node - # rather than the function node (this location definition changes in Python 3.8) - resolvedDecorators = ( - ".".join(composeCallPath(decorator)) for decorator in node.decorator_list - ) - for idx, decorator in enumerate(resolvedDecorators): - if decorator in {"classmethod", "staticmethod"}: - return - - if decorator in caches: - self.violations.append((node.decorator_list[idx], "M-519")) - return - - def __checkForM520(self, node): - """ - Private method to check for a loop that modifies its iterable. - - @param node reference to the node to be processed - @type ast.For or ast.AsyncFor - """ - targets = NameFinder() - targets.visit(node.target) - ctrlNames = set(targets.getNames()) - - iterset = M520NameFinder() - iterset.visit(node.iter) - itersetNames = set(iterset.getNames()) - - for name in sorted(ctrlNames): - if name in itersetNames: - n = targets.getNames()[name][0] - self.violations.append((n, "M-520")) - - def __checkForM521(self, node): - """ - Private method to check for use of an f-string as docstring. - - @param node reference to the node to be processed - @type ast.FunctionDef or ast.ClassDef - """ - if ( - node.body - and isinstance(node.body[0], ast.Expr) - and isinstance(node.body[0].value, ast.JoinedStr) - ): - self.violations.append((node.body[0].value, "M-521")) - - def __checkForM522(self, node): - """ - Private method to check for use of an f-string as docstring. - - @param node reference to the node to be processed - @type ast.With - """ - item = node.items[0] - itemContext = item.context_expr - if ( - hasattr(itemContext, "func") - and hasattr(itemContext.func, "value") - and hasattr(itemContext.func.value, "id") - and itemContext.func.value.id == "contextlib" - and hasattr(itemContext.func, "attr") - and itemContext.func.attr == "suppress" - and len(itemContext.args) == 0 - ): - self.violations.append((node, "M-522")) - - def __checkForM523(self, loopNode): - """ - Private method to check that functions (including lambdas) do not use loop - variables. - - @param loopNode reference to the node to be processed - @type ast.For, ast.AsyncFor, ast.While, ast.ListComp, ast.SetComp,ast.DictComp, - or ast.GeneratorExp - """ - safe_functions = [] - suspiciousVariables = [] - for node in ast.walk(loopNode): - # check if function is immediately consumed to avoid false alarm - if isinstance(node, ast.Call): - # check for filter&reduce - if ( - isinstance(node.func, ast.Name) - and node.func.id in ("filter", "reduce", "map") - ) or ( - isinstance(node.func, ast.Attribute) - and node.func.attr == "reduce" - and isinstance(node.func.value, ast.Name) - and node.func.value.id == "functools" - ): - for arg in node.args: - if isinstance(arg, BugBearVisitor.FUNCTION_NODES): - safe_functions.append(arg) - - # check for key= - for keyword in node.keywords: - if keyword.arg == "key" and isinstance( - keyword.value, BugBearVisitor.FUNCTION_NODES - ): - safe_functions.append(keyword.value) - - # mark `return lambda: x` as safe - # does not (currently) check inner lambdas in a returned expression - # e.g. `return (lambda: x, ) - if isinstance(node, ast.Return) and isinstance( - node.value, BugBearVisitor.FUNCTION_NODES - ): - safe_functions.append(node.value) - - # find unsafe functions - if ( - isinstance(node, BugBearVisitor.FUNCTION_NODES) - and node not in safe_functions - ): - argnames = { - arg.arg for arg in ast.walk(node.args) if isinstance(arg, ast.arg) - } - if isinstance(node, ast.Lambda): - bodyNodes = ast.walk(node.body) - else: - bodyNodes = itertools.chain.from_iterable(map(ast.walk, node.body)) - errors = [] - for name in bodyNodes: - if isinstance(name, ast.Name) and name.id not in argnames: - if isinstance(name.ctx, ast.Load): - errors.append((name.lineno, name.col_offset, name.id, name)) - elif isinstance(name.ctx, ast.Store): - argnames.add(name.id) - for err in errors: - if err[2] not in argnames and err not in self.__M523Seen: - self.__M523Seen.add(err) # dedupe across nested loops - suspiciousVariables.append(err) - - if suspiciousVariables: - reassignedInLoop = set(self.__getAssignedNames(loopNode)) - - for err in sorted(suspiciousVariables): - if reassignedInLoop.issuperset(err[2]): - self.violations.append((err[3], "M-523", err[2])) - - def __checkForM524_M527(self, node): - """ - Private method to check for inheritance from abstract classes in abc and lack of - any methods decorated with abstract*. - - @param node reference to the node to be processed - @type ast.ClassDef - """ # __IGNORE_WARNING_D-234r__ - - def isAbcClass(value, name="ABC"): - if isinstance(value, ast.keyword): - return value.arg == "metaclass" and isAbcClass(value.value, "ABCMeta") - - # class foo(ABC) - # class foo(abc.ABC) - return (isinstance(value, ast.Name) and value.id == name) or ( - isinstance(value, ast.Attribute) - and value.attr == name - and isinstance(value.value, ast.Name) - and value.value.id == "abc" - ) - - def isAbstractDecorator(expr): - return (isinstance(expr, ast.Name) and expr.id[:8] == "abstract") or ( - isinstance(expr, ast.Attribute) and expr.attr[:8] == "abstract" - ) - - def isOverload(expr): - return (isinstance(expr, ast.Name) and expr.id == "overload") or ( - isinstance(expr, ast.Attribute) and expr.attr == "overload" - ) - - def emptyBody(body): - def isStrOrEllipsis(node): - return isinstance(node, ast.Constant) and ( - node.value is Ellipsis or isinstance(node.value, str) - ) - - # Function body consist solely of `pass`, `...`, and/or (doc)string literals - return all( - isinstance(stmt, ast.Pass) - or (isinstance(stmt, ast.Expr) and isStrOrEllipsis(stmt.value)) - for stmt in body - ) - - # don't check multiple inheritance - if len(node.bases) + len(node.keywords) > 1: - return - - # only check abstract classes - if not any(map(isAbcClass, (*node.bases, *node.keywords))): - return - - hasMethod = False - hasAbstractMethod = False - - if not any(map(isAbcClass, (*node.bases, *node.keywords))): - return - - for stmt in node.body: - # Ignore abc's that declares a class attribute that must be set - if isinstance(stmt, ast.AnnAssign) and stmt.value is None: - hasAbstractMethod = True - continue - - # only check function defs - if not isinstance(stmt, (ast.FunctionDef, ast.AsyncFunctionDef)): - continue - hasMethod = True - - hasAbstractDecorator = any(map(isAbstractDecorator, stmt.decorator_list)) - - hasAbstractMethod |= hasAbstractDecorator - - if ( - not hasAbstractDecorator - and emptyBody(stmt.body) - and not any(map(isOverload, stmt.decorator_list)) - ): - self.violations.append((stmt, "M-527", stmt.name)) - - if hasMethod and not hasAbstractMethod: - self.violations.append((node, "M-524", node.name)) - - def __checkForM525(self, node): - """ - Private method to check for exceptions being handled multiple times. - - @param node reference to the node to be processed - @type ast.Try - """ - seen = [] - - for handler in node.handlers: - if isinstance(handler.type, (ast.Name, ast.Attribute)): - name = ".".join(composeCallPath(handler.type)) - seen.append(name) - elif isinstance(handler.type, ast.Tuple): - # to avoid checking the same as M514, remove duplicates per except - uniques = set() - for entry in handler.type.elts: - name = ".".join(composeCallPath(entry)) - uniques.add(name) - seen.extend(uniques) - - # sort to have a deterministic output - duplicates = sorted({x for x in seen if seen.count(x) > 1}) - for duplicate in duplicates: - self.violations.append((node, "M-525", duplicate, self.__inTryStar)) - - def __checkForM526(self, node): - """ - Private method to check for Star-arg unpacking after keyword argument. - - @param node reference to the node to be processed - @type ast.Call - """ - if not node.keywords: - return - - starreds = [arg for arg in node.args if isinstance(arg, ast.Starred)] - if not starreds: - return - - firstKeyword = node.keywords[0].value - for starred in starreds: - if (starred.lineno, starred.col_offset) > ( - firstKeyword.lineno, - firstKeyword.col_offset, - ): - self.violations.append((node, "M-526")) - - def __checkForM528(self, node): - """ - Private method to check for warn without stacklevel. - - @param node reference to the node to be processed - @type ast.Call - """ - if ( - isinstance(node.func, ast.Attribute) - and node.func.attr == "warn" - and isinstance(node.func.value, ast.Name) - and node.func.value.id == "warnings" - and not any(kw.arg == "stacklevel" for kw in node.keywords) - and len(node.args) < 3 - and not any(isinstance(a, ast.Starred) for a in node.args) - and not any(kw.arg is None for kw in node.keywords) - ): - self.violations.append((node, "M-528")) - - def __checkForM531(self, loopNode): - """ - Private method to check that 'itertools.groupby' isn't iterated over more than - once. - - A warning is emitted when the generator returned by 'groupby()' is used - more than once inside a loop body or when it's used in a nested loop. - - @param loopNode reference to the node to be processed - @type ast.For or ast.AsyncFor - """ - # for <loop_node.target> in <loop_node.iter>: ... - if isinstance(loopNode.iter, ast.Call): - node = loopNode.iter - if (isinstance(node.func, ast.Name) and node.func.id in ("groupby",)) or ( - isinstance(node.func, ast.Attribute) - and node.func.attr == "groupby" - and isinstance(node.func.value, ast.Name) - and node.func.value.id == "itertools" - ): - # We have an invocation of groupby which is a simple unpacking - if isinstance(loopNode.target, ast.Tuple) and isinstance( - loopNode.target.elts[1], ast.Name - ): - groupName = loopNode.target.elts[1].id - else: - # Ignore any 'groupby()' invocation that isn't unpacked - return - - numUsages = 0 - for node in self.__walkList(loopNode.body): - # Handled nested loops - if isinstance(node, ast.For): - for nestedNode in self.__walkList(node.body): - if ( - isinstance(nestedNode, ast.Name) - and nestedNode.id == groupName - ): - self.violations.append((nestedNode, "M-531")) - - # Handle multiple uses - if isinstance(node, ast.Name) and node.id == groupName: - numUsages += 1 - if numUsages > 1: - self.violations.append((nestedNode, "M-531")) - - def __checkForM532(self, node): - """ - Private method to check for possible unintentional typing annotation. - - @param node reference to the node to be processed - @type ast.AnnAssign - """ - if ( - node.value is None - and hasattr(node.target, "value") - and isinstance(node.target.value, ast.Name) - and ( - isinstance(node.target, ast.Subscript) - or ( - isinstance(node.target, ast.Attribute) - and node.target.value.id != "self" - ) - ) - ): - self.violations.append((node, "M-532")) - - def __checkForM533(self, node): - """ - Private method to check a set for duplicate items. - - @param node reference to the node to be processed - @type ast.Set - """ - seen = set() - for elt in node.elts: - if not isinstance(elt, ast.Constant): - continue - if elt.value in seen: - self.violations.append((node, "M-533", repr(elt.value))) - else: - seen.add(elt.value) - - def __checkForM534(self, node): - """ - Private method to check that re.sub/subn/split arguments flags/count/maxsplit - are passed as keyword arguments. - - @param node reference to the node to be processed - @type ast.Call - """ - if not isinstance(node.func, ast.Attribute): - return - func = node.func - if not isinstance(func.value, ast.Name) or func.value.id != "re": - return - - def check(numArgs, paramName): - if len(node.args) > numArgs: - arg = node.args[numArgs] - self.violations.append((arg, "M-534", func.attr, paramName)) - - if func.attr in ("sub", "subn"): - check(3, "count") - elif func.attr == "split": - check(2, "maxsplit") - - def __checkForM535(self, node): - """ - Private method to check that a static key isn't used in a dict comprehension. - - Record a warning if a likely unchanging key is used - either a constant, - or a variable that isn't coming from the generator expression. - - @param node reference to the node to be processed - @type ast.DictComp - """ - if isinstance(node.key, ast.Constant): - self.violations.append((node, "M-535", node.key.value)) - elif isinstance( - node.key, ast.Name - ) and node.key.id not in self.__getDictCompLoopAndNamedExprVarNames(node): - self.violations.append((node, "M-535", node.key.id)) - - def __checkForM539(self, node): - """ - Private method to check for correct ContextVar usage. - - @param node reference to the node to be processed - @type ast.Call - """ - if not ( - (isinstance(node.func, ast.Name) and node.func.id == "ContextVar") - or ( - isinstance(node.func, ast.Attribute) - and node.func.attr == "ContextVar" - and isinstance(node.func.value, ast.Name) - and node.func.value.id == "contextvars" - ) - ): - return - - # ContextVar only takes one kw currently, but better safe than sorry - for kw in node.keywords: - if kw.arg == "default": - break - else: - return - - visitor = FunctionDefDefaultsVisitor("M-539", "M-539") - visitor.visit(kw.value) - self.violations.extend(visitor.errors) - - def __checkForM540AddNote(self, node): - """ - Private method to check add_note usage. - - @param node reference to the node to be processed - @type ast.Attribute - @return flag - @rtype bool - """ - if ( - node.attr == "add_note" - and isinstance(node.value, ast.Name) - and self.__M540CaughtException - and node.value.id == self.__M540CaughtException.name - ): - self.__M540CaughtException.hasNote = True - return True - - return False - - def __checkForM540Usage(self, node): - """ - Private method to check the usage of exceptions with added note. - - @param node reference to the node to be processed - @type ast.expr or None - """ # noqa: D-234y - - def superwalk(node: ast.AST | list[ast.AST]): - """ - Function to walk an AST node or a list of AST nodes. - - @param node reference to the node or a list of nodes to be processed - @type ast.AST or list[ast.AST] - @yield next node to be processed - @ytype ast.AST - """ - if isinstance(node, list): - for n in node: - yield from ast.walk(n) - else: - yield from ast.walk(node) - - if not self.__M540CaughtException or node is None: - return - - for n in superwalk(node): - if isinstance(n, ast.Name) and n.id == self.__M540CaughtException.name: - self.__M540CaughtException = None - break - - def __checkForM541(self, node): - """ - Private method to check for duplicate key value pairs in a dictionary literal. - - @param node reference to the node to be processed - @type ast.Dict - """ # noqa: D-234r - - def convertToValue(item): - """ - Function to extract the value of a given item. - - @param item node to extract value from - @type ast.Ast - @return value of the node - @rtype Any - """ - if isinstance(item, ast.Constant): - return item.value - elif isinstance(item, ast.Tuple): - return tuple(convertToValue(i) for i in item.elts) - elif isinstance(item, ast.Name): - return M541VariableKeyType(item.id) - else: - return M541UnhandledKeyType() - - keys = [convertToValue(key) for key in node.keys] - keyCounts = Counter(keys) - duplicateKeys = [key for key, count in keyCounts.items() if count > 1] - for key in duplicateKeys: - keyIndices = [i for i, iKey in enumerate(keys) if iKey == key] - seen = set() - for index in keyIndices: - value = convertToValue(node.values[index]) - if value in seen: - keyNode = node.keys[index] - self.violations.append((keyNode, "M-541")) - seen.add(value) - - def __checkForM569(self, node): - """ - Private method to check for changes to a loop's mutable iterable. - - @param node loop node to be checked - @type ast.For - """ - if isinstance(node.iter, ast.Name): - name = self.toNameStr(node.iter) - elif isinstance(node.iter, ast.Attribute): - name = self.toNameStr(node.iter) - else: - return - checker = M569Checker(name, self) - checker.visit(node.body) - for mutation in checker.mutations: - self.violations.append((mutation, "M-569")) - - -class M569Checker(ast.NodeVisitor): - """ - Class traversing a 'for' loop body to check for modifications to a loop's - mutable iterable. - """ - - # https://docs.python.org/3/library/stdtypes.html#mutable-sequence-types - MUTATING_FUNCTIONS = ( - "append", - "sort", - "reverse", - "remove", - "clear", - "extend", - "insert", - "pop", - "popitem", - ) - - def __init__(self, name, bugbear): - """ - Constructor - - @param name name of the iterator - @type str - @param bugbear reference to the bugbear visitor - @type BugBearVisitor - """ - self.__name = name - self.__bb = bugbear - self.mutations = [] - - def visit_Delete(self, node): - """ - Public method handling 'Delete' nodes. - - @param node reference to the node to be processed - @type ast.Delete - """ - for target in node.targets: - if isinstance(target, ast.Subscript): - name = self.__bb.toNameStr(target.value) - elif isinstance(target, (ast.Attribute, ast.Name)): - name = self.__bb.toNameStr(target) - else: - name = "" # fallback - self.generic_visit(target) - - if name == self.__name: - self.mutations.append(node) - - def visit_Call(self, node): - """ - Public method handling 'Call' nodes. - - @param node reference to the node to be processed - @type ast.Call - """ - if isinstance(node.func, ast.Attribute): - name = self.__bb.toNameStr(node.func.value) - functionObject = name - functionName = node.func.attr - - if ( - functionObject == self.__name - and functionName in self.MUTATING_FUNCTIONS - ): - self.mutations.append(node) - - self.generic_visit(node) - - def visit(self, node): - """ - Public method to inspect an ast node. - - Like super-visit but supports iteration over lists. - - @param node AST node to be traversed - @type TYPE - @return reference to the last processed node - @rtype ast.Node - """ - if not isinstance(node, list): - return super().visit(node) - - for elem in node: - super().visit(elem) - return node - - -class ExceptBaseExceptionVisitor(ast.NodeVisitor): - """ - Class to determine, if a 'BaseException' is re-raised. - """ - - def __init__(self, exceptNode): - """ - Constructor - - @param exceptNode exception node to be inspected - @type ast.ExceptHandler - """ - super().__init__() - self.__root = exceptNode - self.__reRaised = False - - def reRaised(self) -> bool: - """ - Public method to check, if the exception is re-raised. - - @return flag indicating a re-raised exception - @rtype bool - """ - self.visit(self.__root) - return self.__reRaised - - def visit_Raise(self, node): - """ - Public method to handle 'Raise' nodes. - - If we find a corresponding `raise` or `raise e` where e was from - `except BaseException as e:` then we mark re_raised as True and can - stop scanning. - - @param node reference to the node to be processed - @type ast.Raise - """ - if node.exc is None or ( - isinstance(node.exc, ast.Name) and node.exc.id == self.__root.name - ): - self.__reRaised = True - return - - super().generic_visit(node) - - def visit_ExceptHandler(self, node: ast.ExceptHandler): - """ - Public method to handle 'ExceptHandler' nodes. - - @param node reference to the node to be processed - @type ast.ExceptHandler - """ - if node is not self.__root: - return # entered a nested except - stop searching - - super().generic_visit(node) - - -class NameFinder(ast.NodeVisitor): - """ - Class to extract a name out of a tree of nodes. - """ - - def __init__(self): - """ - Constructor - """ - super().__init__() - - self.__names = {} - - def visit_Name(self, node): - """ - Public method to handle 'Name' nodes. - - @param node reference to the node to be processed - @type ast.Name - """ - self.__names.setdefault(node.id, []).append(node) - - def visit(self, node): - """ - Public method to traverse a given AST node. - - @param node AST node to be traversed - @type ast.Node - @return reference to the last processed node - @rtype ast.Node - """ - if isinstance(node, list): - for elem in node: - super().visit(elem) - return node - else: - return super().visit(node) - - def getNames(self): - """ - Public method to return the extracted names and Name nodes. - - @return dictionary containing the names as keys and the list of nodes - @rtype dict - """ - return self.__names - - -class NamedExprFinder(ast.NodeVisitor): - """ - Class to extract names defined through an ast.NamedExpr. - """ - - def __init__(self): - """ - Constructor - """ - super().__init__() - - self.__names = {} - - def visit_NamedExpr(self, node: ast.NamedExpr): - """ - Public method handling 'NamedExpr' nodes. - - @param node reference to the node to be processed - @type ast.NamedExpr - """ - self.__names.setdefault(node.target.id, []).append(node.target) - - self.generic_visit(node) - - def visit(self, node): - """ - Public method to traverse a given AST node. - - Like super-visit but supports iteration over lists. - - @param node AST node to be traversed - @type TYPE - @return reference to the last processed node - @rtype ast.Node - """ - if not isinstance(node, list): - super().visit(node) - - for elem in node: - super().visit(elem) - - return node - - def getNames(self): - """ - Public method to return the extracted names and Name nodes. - - @return dictionary containing the names as keys and the list of nodes - @rtype dict - """ - return self.__names - - -class FunctionDefDefaultsVisitor(ast.NodeVisitor): - """ - Class used by M506, M508 and M539. - """ - - def __init__( - self, - errorCodeCalls, # M506 or M539 - errorCodeLiterals, # M508 or M539 - ): - """ - Constructor - - @param errorCodeCalls error code for ast.Call nodes - @type str - @param errorCodeLiterals error code for literal nodes - @type str - """ - self.__errorCodeCalls = errorCodeCalls - self.__errorCodeLiterals = errorCodeLiterals - for nodeType in BugbearMutableLiterals + BugbearMutableComprehensions: - setattr( - self, f"visit_{nodeType}", self.__visitMutableLiteralOrComprehension - ) - self.errors = [] - self.__argDepth = 0 - - super().__init__() - - def __visitMutableLiteralOrComprehension(self, node): - """ - Private method to flag mutable literals and comprehensions. - - @param node AST node to be processed - @type ast.Dict, ast.List, ast.Set, ast.ListComp, ast.DictComp or ast.SetComp - """ - # Flag M506 if mutable literal/comprehension is not nested. - # We only flag these at the top level of the expression as we - # cannot easily guarantee that nested mutable structures are not - # made immutable by outer operations, so we prefer no false positives. - # e.g. - # >>> def this_is_fine(a=frozenset({"a", "b", "c"})): ... - # - # >>> def this_is_not_fine_but_hard_to_detect(a=(lambda x: x)([1, 2, 3])) - # - # We do still search for cases of B008 within mutable structures though. - if self.__argDepth == 1: - self.errors.append((node, self.__errorCodeCalls)) - - # Check for nested functions. - self.generic_visit(node) - - def visit_Call(self, node): - """ - Public method to process Call nodes. - - @param node AST node to be processed - @type ast.Call - """ - callPath = ".".join(composeCallPath(node.func)) - if callPath in BugbearMutableCalls: - self.errors.append((node, self.__errorCodeCalls)) - self.generic_visit(node) - return - - if callPath in BugbearImmutableCalls: - self.generic_visit(node) - return - - # Check if function call is actually a float infinity/NaN literal - if callPath == "float" and len(node.args) == 1: - try: - value = float(ast.literal_eval(node.args[0])) - except Exception: # secok - pass - else: - if math.isfinite(value): - self.errors.append((node, self.__errorCodeLiterals)) - else: - self.errors.append((node, self.__errorCodeLiterals)) - - # Check for nested functions. - self.generic_visit(node) - - def visit_Lambda(self, node): - """ - Public method to process Lambda nodes. - - @param node AST node to be processed - @type ast.Lambda - """ - # Don't recurse into lambda expressions - # as they are evaluated at call time. - pass - - def visit(self, node): - """ - Public method to traverse an AST node or a list of AST nodes. - - This is an extended method that can also handle a list of AST nodes. - - @param node AST node or list of AST nodes to be processed - @type ast.AST or list of ast.AST - """ - self.__argDepth += 1 - if isinstance(node, list): - for elem in node: - if elem is not None: - super().visit(elem) - else: - super().visit(node) - self.__argDepth -= 1 - - -class M520NameFinder(NameFinder): - """ - Class to extract a name out of a tree of nodes ignoring names defined within the - local scope of a comprehension. - """ - - def visit_GeneratorExp(self, node): - """ - Public method to handle a generator expressions. - - @param node reference to the node to be processed - @type ast.GeneratorExp - """ - self.visit(node.generators) - - def visit_ListComp(self, node): - """ - Public method to handle a list comprehension. - - @param node reference to the node to be processed - @type TYPE - """ - self.visit(node.generators) - - def visit_DictComp(self, node): - """ - Public method to handle a dictionary comprehension. - - @param node reference to the node to be processed - @type TYPE - """ - self.visit(node.generators) - - def visit_comprehension(self, node): - """ - Public method to handle the 'for' of a comprehension. - - @param node reference to the node to be processed - @type ast.comprehension - """ - self.visit(node.iter) - - def visit_Lambda(self, node): - """ - Public method to handle a Lambda function. - - @param node reference to the node to be processed - @type ast.Lambda - """ - self.visit(node.body) - for lambdaArg in node.args.args: - self.getNames().pop(lambdaArg.arg, None) - - -class ReturnVisitor(ast.NodeVisitor): - """ - Class implementing a node visitor to check return statements. - """ - - Assigns = "assigns" - Refs = "refs" - Returns = "returns" - - def __init__(self): - """ - Constructor - """ - super().__init__() - - self.__stack = [] - self.violations = [] - self.__loopCount = 0 - - @property - def assigns(self): - """ - Public method to get the Assign nodes. - - @return dictionary containing the node name as key and line number - as value - @rtype dict - """ - return self.__stack[-1][ReturnVisitor.Assigns] - - @property - def refs(self): - """ - Public method to get the References nodes. - - @return dictionary containing the node name as key and line number - as value - @rtype dict - """ - return self.__stack[-1][ReturnVisitor.Refs] - - @property - def returns(self): - """ - Public method to get the Return nodes. - - @return dictionary containing the node name as key and line number - as value - @rtype dict - """ - return self.__stack[-1][ReturnVisitor.Returns] - - def visit_For(self, node): - """ - Public method to handle a for loop. - - @param node reference to the for node to handle - @type ast.For - """ - self.__visitLoop(node) - - def visit_AsyncFor(self, node): - """ - Public method to handle an async for loop. - - @param node reference to the async for node to handle - @type ast.AsyncFor - """ - self.__visitLoop(node) - - def visit_While(self, node): - """ - Public method to handle a while loop. - - @param node reference to the while node to handle - @type ast.While - """ - self.__visitLoop(node) - - def __visitLoop(self, node): - """ - Private method to handle loop nodes. - - @param node reference to the loop node to handle - @type ast.For, ast.AsyncFor or ast.While - """ - self.__loopCount += 1 - self.generic_visit(node) - self.__loopCount -= 1 - - def __visitWithStack(self, node): - """ - Private method to traverse a given function node using a stack. - - @param node AST node to be traversed - @type ast.FunctionDef or ast.AsyncFunctionDef - """ - self.__stack.append( - { - ReturnVisitor.Assigns: defaultdict(list), - ReturnVisitor.Refs: defaultdict(list), - ReturnVisitor.Returns: [], - } - ) - - self.generic_visit(node) - self.__checkFunction(node) - self.__stack.pop() - - def visit_FunctionDef(self, node): - """ - Public method to handle a function definition. - - @param node reference to the node to handle - @type ast.FunctionDef - """ - self.__visitWithStack(node) - - def visit_AsyncFunctionDef(self, node): - """ - Public method to handle a function definition. - - @param node reference to the node to handle - @type ast.AsyncFunctionDef - """ - self.__visitWithStack(node) - - def visit_Return(self, node): - """ - Public method to handle a return node. - - @param node reference to the node to handle - @type ast.Return - """ - self.returns.append(node) - self.generic_visit(node) - - def visit_Assign(self, node): - """ - Public method to handle an assign node. - - @param node reference to the node to handle - @type ast.Assign - """ - if not self.__stack: - return - - self.generic_visit(node.value) - - target = node.targets[0] - if isinstance(target, ast.Tuple) and not isinstance(node.value, ast.Tuple): - # skip unpacking assign - return - - self.__visitAssignTarget(target) - - def visit_Name(self, node): - """ - Public method to handle a name node. - - @param node reference to the node to handle - @type ast.Name - """ - if self.__stack: - self.refs[node.id].append(node.lineno) - - def __visitAssignTarget(self, node): - """ - Private method to handle an assign target node. - - @param node reference to the node to handle - @type ast.AST - """ - if isinstance(node, ast.Tuple): - for elt in node.elts: - self.__visitAssignTarget(elt) - return - - if not self.__loopCount and isinstance(node, ast.Name): - self.assigns[node.id].append(node.lineno) - return - - self.generic_visit(node) - - def __checkFunction(self, node): - """ - Private method to check a function definition node. - - @param node reference to the node to check - @type ast.AsyncFunctionDef or ast.FunctionDef - """ - if not self.returns or not node.body: - return - - if len(node.body) == 1 and isinstance(node.body[-1], ast.Return): - # skip functions that consist of `return None` only - return - - if not self.__resultExists(): - self.__checkUnnecessaryReturnNone() - return - - self.__checkImplicitReturnValue() - self.__checkImplicitReturn(node.body[-1]) - - for n in self.returns: - if n.value: - self.__checkUnnecessaryAssign(n.value) - - def __isNone(self, node): - """ - Private method to check, if a node value is None. - - @param node reference to the node to check - @type ast.AST - @return flag indicating the node contains a None value - @rtype bool - """ - return AstUtilities.isNameConstant(node) and AstUtilities.getValue(node) is None - - def __isFalse(self, node): - """ - Private method to check, if a node value is False. - - @param node reference to the node to check - @type ast.AST - @return flag indicating the node contains a False value - @rtype bool - """ - return ( - AstUtilities.isNameConstant(node) and AstUtilities.getValue(node) is False - ) - - def __resultExists(self): - """ - Private method to check the existance of a return result. - - @return flag indicating the existence of a return result - @rtype bool - """ - for node in self.returns: - value = node.value - if value and not self.__isNone(value): - return True - - return False - - def __checkImplicitReturnValue(self): - """ - Private method to check for implicit return values. - """ - for node in self.returns: - if not node.value: - self.violations.append((node, "M-832")) - - def __checkUnnecessaryReturnNone(self): - """ - Private method to check for an unnecessary 'return None' statement. - """ - for node in self.returns: - if self.__isNone(node.value): - self.violations.append((node, "M-831")) - - def __checkImplicitReturn(self, node): - """ - Private method to check for an implicit return statement. - - @param node reference to the node to check - @type ast.AST - """ - if isinstance(node, ast.If): - if not node.body or not node.orelse: - self.violations.append((node, "M-833")) - return - - self.__checkImplicitReturn(node.body[-1]) - self.__checkImplicitReturn(node.orelse[-1]) - return - - if isinstance(node, (ast.For, ast.AsyncFor)) and node.orelse: - self.__checkImplicitReturn(node.orelse[-1]) - return - - if isinstance(node, (ast.With, ast.AsyncWith)): - self.__checkImplicitReturn(node.body[-1]) - return - - if isinstance(node, ast.Assert) and self.__isFalse(node.test): - return - - try: - okNodes = (ast.Return, ast.Raise, ast.While, ast.Try) - except AttributeError: - okNodes = (ast.Return, ast.Raise, ast.While) - if not isinstance(node, okNodes): - self.violations.append((node, "M-833")) - - def __checkUnnecessaryAssign(self, node): - """ - Private method to check for an unnecessary assign statement. - - @param node reference to the node to check - @type ast.AST - """ - if not isinstance(node, ast.Name): - return - - varname = node.id - returnLineno = node.lineno - - if varname not in self.assigns: - return - - if varname not in self.refs: - self.violations.append((node, "M-834")) - return - - if self.__hasRefsBeforeNextAssign(varname, returnLineno): - return - - self.violations.append((node, "M-834")) - - def __hasRefsBeforeNextAssign(self, varname, returnLineno): - """ - Private method to check for references before a following assign - statement. - - @param varname variable name to check for - @type str - @param returnLineno line number of the return statement - @type int - @return flag indicating the existence of references - @rtype bool - """ - beforeAssign = 0 - afterAssign = None - - for lineno in sorted(self.assigns[varname]): - if lineno > returnLineno: - afterAssign = lineno - break - - if lineno <= returnLineno: - beforeAssign = lineno - - for lineno in self.refs[varname]: - if lineno == returnLineno: - continue - - if afterAssign: - if beforeAssign < lineno <= afterAssign: - return True - - elif beforeAssign < lineno: - return True - - return False - - -class DateTimeVisitor(ast.NodeVisitor): - """ - Class implementing a node visitor to check datetime function calls. - - Note: This class is modeled after flake8_datetimez checker. - """ - - def __init__(self): - """ - Constructor - """ - super().__init__() - - self.violations = [] - - def __getFromKeywords(self, keywords, name): - """ - Private method to get a keyword node given its name. - - @param keywords list of keyword argument nodes - @type list of ast.AST - @param name name of the keyword node - @type str - @return keyword node - @rtype ast.AST - """ - for keyword in keywords: - if keyword.arg == name: - return keyword - - return None - - def visit_Call(self, node): - """ - Public method to handle a function call. - - Every datetime related function call is check for use of the naive - variant (i.e. use without TZ info). - - @param node reference to the node to be processed - @type ast.Call - """ - # datetime.something() - isDateTimeClass = ( - isinstance(node.func, ast.Attribute) - and isinstance(node.func.value, ast.Name) - and node.func.value.id == "datetime" - ) - - # datetime.datetime.something() - isDateTimeModuleAndClass = ( - isinstance(node.func, ast.Attribute) - and isinstance(node.func.value, ast.Attribute) - and node.func.value.attr == "datetime" - and isinstance(node.func.value.value, ast.Name) - and node.func.value.value.id == "datetime" - ) - - if isDateTimeClass: - if node.func.attr == "datetime": - # datetime.datetime(2000, 1, 1, 0, 0, 0, 0, - # datetime.timezone.utc) - isCase1 = len(node.args) >= 8 and not ( - AstUtilities.isNameConstant(node.args[7]) - and AstUtilities.getValue(node.args[7]) is None - ) - - # datetime.datetime(2000, 1, 1, tzinfo=datetime.timezone.utc) - tzinfoKeyword = self.__getFromKeywords(node.keywords, "tzinfo") - isCase2 = tzinfoKeyword is not None and not ( - AstUtilities.isNameConstant(tzinfoKeyword.value) - and AstUtilities.getValue(tzinfoKeyword.value) is None - ) - - if not (isCase1 or isCase2): - self.violations.append((node, "M-301")) - - elif node.func.attr == "time": - # time(12, 10, 45, 0, datetime.timezone.utc) - isCase1 = len(node.args) >= 5 and not ( - AstUtilities.isNameConstant(node.args[4]) - and AstUtilities.getValue(node.args[4]) is None - ) - - # datetime.time(12, 10, 45, tzinfo=datetime.timezone.utc) - tzinfoKeyword = self.__getFromKeywords(node.keywords, "tzinfo") - isCase2 = tzinfoKeyword is not None and not ( - AstUtilities.isNameConstant(tzinfoKeyword.value) - and AstUtilities.getValue(tzinfoKeyword.value) is None - ) - - if not (isCase1 or isCase2): - self.violations.append((node, "M-321")) - - elif node.func.attr == "date": - self.violations.append((node, "M-311")) - - if isDateTimeClass or isDateTimeModuleAndClass: - if node.func.attr == "today": - self.violations.append((node, "M-302")) - - elif node.func.attr == "utcnow": - self.violations.append((node, "M-303")) - - elif node.func.attr == "utcfromtimestamp": - self.violations.append((node, "M-304")) - - elif node.func.attr in "now": - # datetime.now(UTC) - isCase1 = ( - len(node.args) == 1 - and len(node.keywords) == 0 - and not ( - AstUtilities.isNameConstant(node.args[0]) - and AstUtilities.getValue(node.args[0]) is None - ) - ) - - # datetime.now(tz=UTC) - tzKeyword = self.__getFromKeywords(node.keywords, "tz") - isCase2 = tzKeyword is not None and not ( - AstUtilities.isNameConstant(tzKeyword.value) - and AstUtilities.getValue(tzKeyword.value) is None - ) - - if not (isCase1 or isCase2): - self.violations.append((node, "M-305")) - - elif node.func.attr == "fromtimestamp": - # datetime.fromtimestamp(1234, UTC) - isCase1 = ( - len(node.args) == 2 - and len(node.keywords) == 0 - and not ( - AstUtilities.isNameConstant(node.args[1]) - and AstUtilities.getValue(node.args[1]) is None - ) - ) - - # datetime.fromtimestamp(1234, tz=UTC) - tzKeyword = self.__getFromKeywords(node.keywords, "tz") - isCase2 = tzKeyword is not None and not ( - AstUtilities.isNameConstant(tzKeyword.value) - and AstUtilities.getValue(tzKeyword.value) is None - ) - - if not (isCase1 or isCase2): - self.violations.append((node, "M-306")) - - elif node.func.attr == "strptime": - # datetime.strptime(...).replace(tzinfo=UTC) - parent = getattr(node, "_dtCheckerParent", None) - pparent = getattr(parent, "_dtCheckerParent", None) - if not ( - isinstance(parent, ast.Attribute) and parent.attr == "replace" - ) or not isinstance(pparent, ast.Call): - isCase1 = False - else: - tzinfoKeyword = self.__getFromKeywords(pparent.keywords, "tzinfo") - isCase1 = tzinfoKeyword is not None and not ( - AstUtilities.isNameConstant(tzinfoKeyword.value) - and AstUtilities.getValue(tzinfoKeyword.value) is None - ) - - if not isCase1: - self.violations.append((node, "M-307")) - - elif node.func.attr == "fromordinal": - self.violations.append((node, "M-308")) - - # date.something() - isDateClass = ( - isinstance(node.func, ast.Attribute) - and isinstance(node.func.value, ast.Name) - and node.func.value.id == "date" - ) - - # datetime.date.something() - isDateModuleAndClass = ( - isinstance(node.func, ast.Attribute) - and isinstance(node.func.value, ast.Attribute) - and node.func.value.attr == "date" - and isinstance(node.func.value.value, ast.Name) - and node.func.value.value.id == "datetime" - ) - - if isDateClass or isDateModuleAndClass: - if node.func.attr == "today": - self.violations.append((node, "M-312")) - - elif node.func.attr == "fromtimestamp": - self.violations.append((node, "M-313")) - - elif node.func.attr == "fromordinal": - self.violations.append((node, "M-314")) - - elif node.func.attr == "fromisoformat": - self.violations.append((node, "M-315")) - - self.generic_visit(node) - - -class SysVersionVisitor(ast.NodeVisitor): - """ - Class implementing a node visitor to check the use of sys.version and - sys.version_info. - - Note: This class is modeled after flake8-2020 v1.8.1. - """ - - def __init__(self): - """ - Constructor - """ - super().__init__() - - self.violations = [] - self.__fromImports = {} - - def visit_ImportFrom(self, node): - """ - Public method to handle a from ... import ... statement. - - @param node reference to the node to be processed - @type ast.ImportFrom - """ - for alias in node.names: - if node.module is not None and not alias.asname: - self.__fromImports[alias.name] = node.module - - self.generic_visit(node) - - def __isSys(self, attr, node): - """ - Private method to check for a reference to sys attribute. - - @param attr attribute name - @type str - @param node reference to the node to be checked - @type ast.Node - @return flag indicating a match - @rtype bool - """ - match = False - if ( - isinstance(node, ast.Attribute) - and isinstance(node.value, ast.Name) - and node.value.id == "sys" - and node.attr == attr - ) or ( - isinstance(node, ast.Name) - and node.id == attr - and self.__fromImports.get(node.id) == "sys" - ): - match = True - - return match - - def __isSysVersionUpperSlice(self, node, n): - """ - Private method to check the upper slice of sys.version. - - @param node reference to the node to be checked - @type ast.Node - @param n slice value to check against - @type int - @return flag indicating a match - @rtype bool - """ - return ( - self.__isSys("version", node.value) - and isinstance(node.slice, ast.Slice) - and node.slice.lower is None - and AstUtilities.isNumber(node.slice.upper) - and AstUtilities.getValue(node.slice.upper) == n - and node.slice.step is None - ) - - def visit_Subscript(self, node): - """ - Public method to handle a subscript. - - @param node reference to the node to be processed - @type ast.Subscript - """ - if self.__isSysVersionUpperSlice(node, 1): - self.violations.append((node.value, "M-423")) - elif self.__isSysVersionUpperSlice(node, 3): - self.violations.append((node.value, "M-401")) - elif ( - self.__isSys("version", node.value) - and isinstance(node.slice, ast.Index) - and AstUtilities.isNumber(node.slice.value) - and AstUtilities.getValue(node.slice.value) == 2 - ): - self.violations.append((node.value, "M-402")) - elif ( - self.__isSys("version", node.value) - and isinstance(node.slice, ast.Index) - and AstUtilities.isNumber(node.slice.value) - and AstUtilities.getValue(node.slice.value) == 0 - ): - self.violations.append((node.value, "M-421")) - - self.generic_visit(node) - - def visit_Compare(self, node): - """ - Public method to handle a comparison. - - @param node reference to the node to be processed - @type ast.Compare - """ - if ( - isinstance(node.left, ast.Subscript) - and self.__isSys("version_info", node.left.value) - and isinstance(node.left.slice, ast.Index) - and AstUtilities.isNumber(node.left.slice.value) - and AstUtilities.getValue(node.left.slice.value) == 0 - and len(node.ops) == 1 - and isinstance(node.ops[0], ast.Eq) - and AstUtilities.isNumber(node.comparators[0]) - and AstUtilities.getValue(node.comparators[0]) == 3 - ): - self.violations.append((node.left, "M-411")) - elif ( - self.__isSys("version", node.left) - and len(node.ops) == 1 - and isinstance(node.ops[0], (ast.Lt, ast.LtE, ast.Gt, ast.GtE)) - and AstUtilities.isString(node.comparators[0]) - ): - if len(AstUtilities.getValue(node.comparators[0])) == 1: - errorCode = "M-422" - else: - errorCode = "M-403" - self.violations.append((node.left, errorCode)) - elif ( - isinstance(node.left, ast.Subscript) - and self.__isSys("version_info", node.left.value) - and isinstance(node.left.slice, ast.Index) - and AstUtilities.isNumber(node.left.slice.value) - and AstUtilities.getValue(node.left.slice.value) == 1 - and len(node.ops) == 1 - and isinstance(node.ops[0], (ast.Lt, ast.LtE, ast.Gt, ast.GtE)) - and AstUtilities.isNumber(node.comparators[0]) - ): - self.violations.append((node, "M-413")) - elif ( - isinstance(node.left, ast.Attribute) - and self.__isSys("version_info", node.left.value) - and node.left.attr == "minor" - and len(node.ops) == 1 - and isinstance(node.ops[0], (ast.Lt, ast.LtE, ast.Gt, ast.GtE)) - and AstUtilities.isNumber(node.comparators[0]) - ): - self.violations.append((node, "M-414")) - - self.generic_visit(node) - - def visit_Attribute(self, node): - """ - Public method to handle an attribute. - - @param node reference to the node to be processed - @type ast.Attribute - """ - if ( - isinstance(node.value, ast.Name) - and node.value.id == "six" - and node.attr == "PY3" - ): - self.violations.append((node, "M-412")) - - self.generic_visit(node) - - def visit_Name(self, node): - """ - Public method to handle an name. - - @param node reference to the node to be processed - @type ast.Name - """ - if node.id == "PY3" and self.__fromImports.get(node.id) == "six": - self.violations.append((node, "M-412")) - - self.generic_visit(node) - - -class DefaultMatchCaseVisitor(ast.NodeVisitor): - """ - Class implementing a node visitor to check default match cases. - - Note: This class is modeled after flake8-spm v0.0.1. - """ - - def __init__(self): - """ - Constructor - """ - super().__init__() - - self.violations = [] - - def visit_Match(self, node): - """ - Public method to handle Match nodes. - - @param node reference to the node to be processed - @type ast.Match - """ - for badNode, issueCode in self.__badNodes(node): - self.violations.append((badNode, issueCode)) - - self.generic_visit(node) - - def __badNodes(self, node): - """ - Private method to yield bad match nodes. - - @param node reference to the node to be processed - @type ast.Match - @yield tuple containing a reference to bad match case node and the corresponding - issue code - @ytype tyuple of (ast.AST, str) - """ - for case in node.cases: - if self.__emptyMatchDefault(case): - if self.__lastStatementDoesNotRaise(case): - yield self.__findBadNode(case), "M-901" - elif self.__returnPrecedesExceptionRaising(case): - yield self.__findBadNode(case), "M-902" - - def __emptyMatchDefault(self, case): - """ - Private method to check for an empty default match case. - - @param case reference to the node to be processed - @type ast.match_case - @return flag indicating an empty default match case - @rtype bool - """ - pattern = case.pattern - return isinstance(pattern, ast.MatchAs) and ( - pattern.pattern is None - or ( - isinstance(pattern.pattern, ast.MatchAs) - and pattern.pattern.pattern is None - ) - ) - - def __lastStatementDoesNotRaise(self, case): - """ - Private method to check that the last case statement does not raise an - exception. - - @param case reference to the node to be processed - @type ast.match_case - @return flag indicating that the last case statement does not raise an - exception - @rtype bool - """ - return not isinstance(case.body[-1], ast.Raise) - - def __returnPrecedesExceptionRaising(self, case): - """ - Private method to check that no return precedes an exception raising. - - @param case reference to the node to be processed - @type ast.match_case - @return flag indicating that a return precedes an exception raising - @rtype bool - """ - returnIndex = -1 - raiseIndex = -1 - for index, body in enumerate(case.body): - if isinstance(body, ast.Return): - returnIndex = index - elif isinstance(body, ast.Raise): - raiseIndex = index - return returnIndex >= 0 and returnIndex < raiseIndex - - def __findBadNode(self, case) -> ast.AST: - """ - Private method returning a reference to the bad node of a case node. - - @param case reference to the node to be processed - @type ast.match_case - @return reference to the bad node - @rtype ast.AST - """ - for body in case.body: - # Handle special case when return precedes exception raising. - # In this case the bad node is that with the return statement. - if isinstance(body, ast.Return): - return body - - return case.body[-1] - - -# -# eflag: noqa = M-891 + self.addErrorFromNode(*violation)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/ReturnVisitor.py Thu Feb 27 14:42:39 2025 +0100 @@ -0,0 +1,444 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2025 Detlev Offenbach <detlev@die-offenbachs.de> +# + +""" +Module implementing a node visitor to check return statements. +""" + +import ast + +from collections import defaultdict + +import AstUtilities + + +class ReturnVisitor(ast.NodeVisitor): + """ + Class implementing a node visitor to check return statements. + + Note 1: This class is modeled after flake8-return v1.2.0 checker without + checking for superfluous return. + Note 2: This class is a combination of the main visitor class and the various + mixin classes of of the above checker. + """ + + Assigns = "assigns" + Loops = "loops" + Refs = "refs" + Returns = "returns" + Tries = "tries" + + def __init__(self): + """ + Constructor + """ + super().__init__() + + self.violations = [] + + self.__stack = [] + + @property + def assigns(self): + """ + Public method to get the Assign nodes. + + @return dictionary containing the node name as key and line number + as value + @rtype dict + """ + return self.__stack[-1][ReturnVisitor.Assigns] + + @property + def refs(self): + """ + Public method to get the References nodes. + + @return dictionary containing the node name as key and line number + as value + @rtype dict + """ + return self.__stack[-1][ReturnVisitor.Refs] + + @property + def tries(self): + """ + Public method to get the Try nodes. + + @return dictionary containing the node name as key and line number + as value + @rtype dict + """ + return self.__stack[-1][ReturnVisitor.Tries] + + @property + def loops(self): + """ + Public method to get the Loop nodes. + + @return dictionary containing the node name as key and line number + as value + @rtype dict + """ + return self.__stack[-1][ReturnVisitor.Loops] + + @property + def returns(self): + """ + Public method to get the Return nodes. + + @return dictionary containing the node name as key and line number + as value + @rtype dict + """ + return self.__stack[-1][ReturnVisitor.Returns] + + def visit_For(self, node): + """ + Public method to handle a for loop. + + @param node reference to the for node to handle + @type ast.For + """ + self.__visitLoop(node) + + def visit_AsyncFor(self, node): + """ + Public method to handle an async for loop. + + @param node reference to the async for node to handle + @type ast.AsyncFor + """ + self.__visitLoop(node) + + def visit_While(self, node): + """ + Public method to handle a while loop. + + @param node reference to the while node to handle + @type ast.While + """ + self.__visitLoop(node) + + def __visitLoop(self, node): + """ + Private method to handle loop nodes. + + @param node reference to the loop node to handle + @type ast.For, ast.AsyncFor or ast.While + """ + if self.__stack and hasattr(node, "end_lineno") and node.end_lineno is not None: + self.loops[node.lineno] = node.end_lineno + + self.generic_visit(node) + + def __visitWithStack(self, node): + """ + Private method to traverse a given function node using a stack. + + @param node AST node to be traversed + @type ast.FunctionDef or ast.AsyncFunctionDef + """ + self.__stack.append( + { + ReturnVisitor.Assigns: defaultdict(list), + ReturnVisitor.Refs: defaultdict(list), + ReturnVisitor.Loops: defaultdict(int), + ReturnVisitor.Tries: defaultdict(int), + ReturnVisitor.Returns: [], + } + ) + + self.generic_visit(node) + self.__checkFunction(node) + self.__stack.pop() + + def visit_FunctionDef(self, node): + """ + Public method to handle a function definition. + + @param node reference to the node to handle + @type ast.FunctionDef + """ + self.__visitWithStack(node) + + def visit_AsyncFunctionDef(self, node): + """ + Public method to handle a function definition. + + @param node reference to the node to handle + @type ast.AsyncFunctionDef + """ + self.__visitWithStack(node) + + def visit_Return(self, node): + """ + Public method to handle a return node. + + @param node reference to the node to handle + @type ast.Return + """ + self.returns.append(node) + self.generic_visit(node) + + def visit_Assign(self, node): + """ + Public method to handle an assign node. + + @param node reference to the node to handle + @type ast.Assign + """ + if not self.__stack: + return + + if isinstance(node.value, ast.Name): + self.refs[node.value.id].append(node.value.lineno) + + self.generic_visit(node.value) + + target = node.targets[0] + if isinstance(target, ast.Tuple) and not isinstance(node.value, ast.Tuple): + # skip unpacking assign + return + + self.__visitAssignTarget(target) + + def visit_Name(self, node): + """ + Public method to handle a name node. + + @param node reference to the node to handle + @type ast.Name + """ + if self.__stack: + self.refs[node.id].append(node.lineno) + + def visit_Try(self, node): + """ + Public method to handle a try/except node. + + @param node reference to the node to handle + @type ast.Try + """ + if self.__stack and hasattr(node, "end_lineno") and node.end_lineno is not None: + self.tries[node.lineno] = node.end_lineno + + self.generic_visit(node) + + def __visitAssignTarget(self, node): + """ + Private method to handle an assign target node. + + @param node reference to the node to handle + @type ast.AST + """ + if isinstance(node, ast.Tuple): + for elt in node.elts: + self.__visitAssignTarget(elt) + return + + if isinstance(node, ast.Name): + self.assigns[node.id].append(node.lineno) + return + + self.generic_visit(node) + + def __checkFunction(self, node): + """ + Private method to check a function definition node. + + @param node reference to the node to check + @type ast.AsyncFunctionDef or ast.FunctionDef + """ + if not self.returns or not node.body: + return + + if len(node.body) == 1 and isinstance(node.body[-1], ast.Return): + # skip functions that consist of `return None` only + return + + if not self.__resultExists(): + self.__checkUnnecessaryReturnNone() + return + + self.__checkImplicitReturnValue() + self.__checkImplicitReturn(node.body[-1]) + + for n in self.returns: + if n.value: + self.__checkUnnecessaryAssign(n.value) + + def __isNone(self, node): + """ + Private method to check, if a node value is None. + + @param node reference to the node to check + @type ast.AST + @return flag indicating the node contains a None value + @rtype bool + """ + return AstUtilities.isNameConstant(node) and AstUtilities.getValue(node) is None + + def __isFalse(self, node): + """ + Private method to check, if a node value is False. + + @param node reference to the node to check + @type ast.AST + @return flag indicating the node contains a False value + @rtype bool + """ + return ( + AstUtilities.isNameConstant(node) and AstUtilities.getValue(node) is False + ) + + def __resultExists(self): + """ + Private method to check the existance of a return result. + + @return flag indicating the existence of a return result + @rtype bool + """ + for node in self.returns: + value = node.value + if value and not self.__isNone(value): + return True + + return False + + def __checkImplicitReturnValue(self): + """ + Private method to check for implicit return values. + """ + for node in self.returns: + if not node.value: + self.violations.append((node, "M-832")) + + def __checkUnnecessaryReturnNone(self): + """ + Private method to check for an unnecessary 'return None' statement. + """ + for node in self.returns: + if self.__isNone(node.value): + self.violations.append((node, "M-831")) + + def __checkImplicitReturn(self, node): + """ + Private method to check for an implicit return statement. + + @param node reference to the node to check + @type ast.AST + """ + if isinstance(node, ast.If): + if not node.body or not node.orelse: + self.violations.append((node, "M-833")) + return + + self.__checkImplicitReturn(node.body[-1]) + self.__checkImplicitReturn(node.orelse[-1]) + return + + if isinstance(node, (ast.For, ast.AsyncFor)) and node.orelse: + self.__checkImplicitReturn(node.orelse[-1]) + return + + if isinstance(node, (ast.With, ast.AsyncWith, ast.For)): + self.__checkImplicitReturn(node.body[-1]) + return + + if isinstance(node, ast.Assert) and self.__isFalse(node.test): + return + + try: + okNodes = (ast.Return, ast.Raise, ast.While, ast.Try) + except AttributeError: + okNodes = (ast.Return, ast.Raise, ast.While) + if not isinstance(node, okNodes): + self.violations.append((node, "M-833")) + + def __checkUnnecessaryAssign(self, node): + """ + Private method to check for an unnecessary assign statement. + + @param node reference to the node to check + @type ast.AST + """ + if not isinstance(node, ast.Name): + return + + varname = node.id + returnLineno = node.lineno + + if varname not in self.assigns: + return + + if varname not in self.refs: + self.violations.append((node, "M-834")) + return + + if self.__hasRefsBeforeNextAssign(varname, returnLineno): + return + + if self.__hasRefsOrAssignsWithinTryOrLoop(varname): + return + + self.violations.append((node, "M-834")) + + def __hasRefsOrAssignsWithinTryOrLoop(self, varname: str) -> bool: + """ + Private method to check for references or assignments in exception handlers + or loops. + + @param varname name of the variable to check for + @type str + @return flag indicating a reference or assignment + @rtype bool + """ + for item in [*self.refs[varname], *self.assigns[varname]]: + for tryStart, tryEnd in self.tries.items(): + if tryStart < item <= tryEnd: + return True + + for loopStart, loopEnd in self.loops.items(): + if loopStart < item <= loopEnd: + return True + + return False + + def __hasRefsBeforeNextAssign(self, varname, returnLineno): + """ + Private method to check for references before a following assign + statement. + + @param varname variable name to check for + @type str + @param returnLineno line number of the return statement + @type int + @return flag indicating the existence of references + @rtype bool + """ + beforeAssign = 0 + afterAssign = None + + for lineno in sorted(self.assigns[varname]): + if lineno > returnLineno: + afterAssign = lineno + break + + if lineno <= returnLineno: + beforeAssign = lineno + + for lineno in self.refs[varname]: + if lineno == returnLineno: + continue + + if afterAssign: + if beforeAssign < lineno <= afterAssign: + return True + + elif beforeAssign < lineno: + return True + + return False
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/SysVersionVisitor.py Thu Feb 27 14:42:39 2025 +0100 @@ -0,0 +1,198 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2025 Detlev Offenbach <detlev@die-offenbachs.de> +# + +""" +Module implementing a node visitor to check the use of sys.version and sys.version_info. +""" + +import ast + +import AstUtilities + + +class SysVersionVisitor(ast.NodeVisitor): + """ + Class implementing a node visitor to check the use of sys.version and + sys.version_info. + + Note: This class is modeled after flake8-2020 v1.8.1. + """ + + def __init__(self): + """ + Constructor + """ + super().__init__() + + self.violations = [] + self.__fromImports = {} + + def visit_ImportFrom(self, node): + """ + Public method to handle a from ... import ... statement. + + @param node reference to the node to be processed + @type ast.ImportFrom + """ + for alias in node.names: + if node.module is not None and not alias.asname: + self.__fromImports[alias.name] = node.module + + self.generic_visit(node) + + def __isSys(self, attr, node): + """ + Private method to check for a reference to sys attribute. + + @param attr attribute name + @type str + @param node reference to the node to be checked + @type ast.Node + @return flag indicating a match + @rtype bool + """ + match = False + if ( + isinstance(node, ast.Attribute) + and isinstance(node.value, ast.Name) + and node.value.id == "sys" + and node.attr == attr + ) or ( + isinstance(node, ast.Name) + and node.id == attr + and self.__fromImports.get(node.id) == "sys" + ): + match = True + + return match + + def __isSysVersionUpperSlice(self, node, n): + """ + Private method to check the upper slice of sys.version. + + @param node reference to the node to be checked + @type ast.Node + @param n slice value to check against + @type int + @return flag indicating a match + @rtype bool + """ + return ( + self.__isSys("version", node.value) + and isinstance(node.slice, ast.Slice) + and node.slice.lower is None + and AstUtilities.isNumber(node.slice.upper) + and AstUtilities.getValue(node.slice.upper) == n + and node.slice.step is None + ) + + def visit_Subscript(self, node): + """ + Public method to handle a subscript. + + @param node reference to the node to be processed + @type ast.Subscript + """ + if self.__isSysVersionUpperSlice(node, 1): + self.violations.append((node.value, "M-423")) + elif self.__isSysVersionUpperSlice(node, 3): + self.violations.append((node.value, "M-401")) + elif ( + self.__isSys("version", node.value) + and isinstance(node.slice, ast.Index) + and AstUtilities.isNumber(node.slice.value) + and AstUtilities.getValue(node.slice.value) == 2 + ): + self.violations.append((node.value, "M-402")) + elif ( + self.__isSys("version", node.value) + and isinstance(node.slice, ast.Index) + and AstUtilities.isNumber(node.slice.value) + and AstUtilities.getValue(node.slice.value) == 0 + ): + self.violations.append((node.value, "M-421")) + + self.generic_visit(node) + + def visit_Compare(self, node): + """ + Public method to handle a comparison. + + @param node reference to the node to be processed + @type ast.Compare + """ + if ( + isinstance(node.left, ast.Subscript) + and self.__isSys("version_info", node.left.value) + and isinstance(node.left.slice, ast.Index) + and AstUtilities.isNumber(node.left.slice.value) + and AstUtilities.getValue(node.left.slice.value) == 0 + and len(node.ops) == 1 + and isinstance(node.ops[0], ast.Eq) + and AstUtilities.isNumber(node.comparators[0]) + and AstUtilities.getValue(node.comparators[0]) == 3 + ): + self.violations.append((node.left, "M-411")) + elif ( + self.__isSys("version", node.left) + and len(node.ops) == 1 + and isinstance(node.ops[0], (ast.Lt, ast.LtE, ast.Gt, ast.GtE)) + and AstUtilities.isString(node.comparators[0]) + ): + if len(AstUtilities.getValue(node.comparators[0])) == 1: + errorCode = "M-422" + else: + errorCode = "M-403" + self.violations.append((node.left, errorCode)) + elif ( + isinstance(node.left, ast.Subscript) + and self.__isSys("version_info", node.left.value) + and isinstance(node.left.slice, ast.Index) + and AstUtilities.isNumber(node.left.slice.value) + and AstUtilities.getValue(node.left.slice.value) == 1 + and len(node.ops) == 1 + and isinstance(node.ops[0], (ast.Lt, ast.LtE, ast.Gt, ast.GtE)) + and AstUtilities.isNumber(node.comparators[0]) + ): + self.violations.append((node, "M-413")) + elif ( + isinstance(node.left, ast.Attribute) + and self.__isSys("version_info", node.left.value) + and node.left.attr == "minor" + and len(node.ops) == 1 + and isinstance(node.ops[0], (ast.Lt, ast.LtE, ast.Gt, ast.GtE)) + and AstUtilities.isNumber(node.comparators[0]) + ): + self.violations.append((node, "M-414")) + + self.generic_visit(node) + + def visit_Attribute(self, node): + """ + Public method to handle an attribute. + + @param node reference to the node to be processed + @type ast.Attribute + """ + if ( + isinstance(node.value, ast.Name) + and node.value.id == "six" + and node.attr == "PY3" + ): + self.violations.append((node, "M-412")) + + self.generic_visit(node) + + def visit_Name(self, node): + """ + Public method to handle an name. + + @param node reference to the node to be processed + @type ast.Name + """ + if node.id == "PY3" and self.__fromImports.get(node.id) == "six": + self.violations.append((node, "M-412")) + + self.generic_visit(node)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/TextVisitor.py Thu Feb 27 14:42:39 2025 +0100 @@ -0,0 +1,147 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2025 Detlev Offenbach <detlev@die-offenbachs.de> +# + +""" +Module implementing a node visitor for bytes and str instances. +""" + +import ast + +import AstUtilities + + +class TextVisitor(ast.NodeVisitor): + """ + Class implementing a node visitor for bytes and str instances. + + It tries to detect docstrings as string of the first expression of each + module, class or function. + """ + + # modeled after the string format flake8 extension + + def __init__(self): + """ + Constructor + """ + super().__init__() + self.nodes = [] + self.calls = {} + + def __addNode(self, node): + """ + Private method to add a node to our list of nodes. + + @param node reference to the node to add + @type ast.AST + """ + if not hasattr(node, "is_docstring"): + node.is_docstring = False + self.nodes.append(node) + + def visit_Constant(self, node): + """ + Public method to handle constant nodes. + + @param node reference to the bytes node + @type ast.Constant + """ + if AstUtilities.isBaseString(node): + self.__addNode(node) + else: + super().generic_visit(node) + + def __visitDefinition(self, node): + """ + Private method handling class and function definitions. + + @param node reference to the node to handle + @type ast.FunctionDef, ast.AsyncFunctionDef or ast.ClassDef + """ + # Manually traverse class or function definition + # * Handle decorators normally + # * Use special check for body content + # * Don't handle the rest (e.g. bases) + for decorator in node.decorator_list: + self.visit(decorator) + self.__visitBody(node) + + def __visitBody(self, node): + """ + Private method to traverse the body of the node manually. + + If the first node is an expression which contains a string or bytes it + marks that as a docstring. + + @param node reference to the node to traverse + @type ast.AST + """ + if ( + node.body + and isinstance(node.body[0], ast.Expr) + and AstUtilities.isBaseString(node.body[0].value) + ): + node.body[0].value.is_docstring = True + + for subnode in node.body: + self.visit(subnode) + + def visit_Module(self, node): + """ + Public method to handle a module. + + @param node reference to the node to handle + @type ast.Module + """ + self.__visitBody(node) + + def visit_ClassDef(self, node): + """ + Public method to handle a class definition. + + @param node reference to the node to handle + @type ast.ClassDef + """ + # Skipped nodes: ('name', 'bases', 'keywords', 'starargs', 'kwargs') + self.__visitDefinition(node) + + def visit_FunctionDef(self, node): + """ + Public method to handle a function definition. + + @param node reference to the node to handle + @type ast.FunctionDef + """ + # Skipped nodes: ('name', 'args', 'returns') + self.__visitDefinition(node) + + def visit_AsyncFunctionDef(self, node): + """ + Public method to handle an asynchronous function definition. + + @param node reference to the node to handle + @type ast.AsyncFunctionDef + """ + # Skipped nodes: ('name', 'args', 'returns') + self.__visitDefinition(node) + + def visit_Call(self, node): + """ + Public method to handle a function call. + + @param node reference to the node to handle + @type ast.Call + """ + if isinstance(node.func, ast.Attribute) and node.func.attr == "format": + if AstUtilities.isBaseString(node.func.value): + self.calls[node.func.value] = (node, False) + elif ( + isinstance(node.func.value, ast.Name) + and node.func.value.id == "str" + and node.args + and AstUtilities.isBaseString(node.args[0]) + ): + self.calls[node.args[0]] = (node, True) + super().generic_visit(node)
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/NameOrder/ImportNode.py Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/NameOrder/ImportNode.py Thu Feb 27 14:42:39 2025 +0100 @@ -78,7 +78,7 @@ key=lambda k: checker.moduleKey(k, subImports=True), ) if names != expectedNames: - self.error = (self.node, "NO102", ", ".join(expectedNames)) + self.error = (self.node, "NO-102", ", ".join(expectedNames)) level = astNode.level self.asImport = any(n.asname for n in astNode.names)
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/NameOrder/NameOrderChecker.py Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/NameOrder/NameOrderChecker.py Thu Feb 27 14:42:39 2025 +0100 @@ -8,11 +8,12 @@ """ import ast -import copy import re +from CodeStyleTopicChecker import CodeStyleTopicChecker -class NameOrderChecker: + +class NameOrderChecker(CodeStyleTopicChecker): """ Class implementing a checker for name ordering. @@ -22,13 +23,13 @@ Codes = [ ## Imports order - "NO101", - "NO102", - "NO103", - "NO104", - "NO105", + "NO-101", + "NO-102", + "NO-103", + "NO-104", + "NO-105", ] - Prefix = "NO" + Category = "NO" def __init__(self, source, filename, tree, select, ignore, expected, repeat, args): """ @@ -51,18 +52,17 @@ @param args dictionary of arguments for the various checks @type dict """ - self.__select = tuple( - x for x in select if x.startswith(NameOrderChecker.Prefix) - ) - self.__ignore = tuple( - x for x in ignore if x.startswith(NameOrderChecker.Prefix) + super().__init__( + NameOrderChecker.Category, + source, + filename, + tree, + select, + ignore, + expected, + repeat, + args, ) - self.__expected = expected[:] - self.__repeat = repeat - self.__filename = filename - self.__source = source[:] - self.__tree = copy.deepcopy(tree) - self.__args = args # parameters for import sorting if args["SortOrder"] == "native": @@ -72,86 +72,10 @@ self.__sortingFunction = self.__naturally self.__sortCaseSensitive = args["SortCaseSensitive"] - # statistics counters - self.counters = {} - - # collection of detected errors - self.errors = [] - checkersWithCodes = [ - (self.__checkNameOrder, ("NO101", "NO102", "NO103", "NO104", "NO105")), + (self.__checkNameOrder, ("NO-101", "NO-102", "NO-103", "NO-104", "NO-105")), ] - - self.__checkers = [] - for checker, codes in checkersWithCodes: - if any(not (code and self.__ignoreCode(code)) for code in codes): - self.__checkers.append(checker) - - def __ignoreCode(self, code): - """ - Private method to check if the message code should be ignored. - - @param code message code to check for - @type str - @return flag indicating to ignore the given code - @rtype bool - """ - return code in self.__ignore or ( - code.startswith(self.__ignore) and not code.startswith(self.__select) - ) - - def __error(self, lineNumber, offset, code, *args): - """ - Private method to record an issue. - - @param lineNumber line number of the issue - @type int - @param offset position within line of the issue - @type int - @param code message code - @type str - @param args arguments for the message - @type list - """ - if self.__ignoreCode(code): - return - - if code in self.counters: - self.counters[code] += 1 - else: - self.counters[code] = 1 - - # Don't care about expected codes - if code in self.__expected: - return - - if code and (self.counters[code] == 1 or self.__repeat): - # record the issue with one based line number - self.errors.append( - { - "file": self.__filename, - "line": lineNumber + 1, - "offset": offset, - "code": code, - "args": args, - } - ) - - def run(self): - """ - Public method to check the given source against miscellaneous - conditions. - """ - if not self.__filename: - # don't do anything, if essential data is missing - return - - if not self.__checkers: - # don't do anything, if no codes were selected - return - - for check in self.__checkers: - check() + self._initializeCheckers(checkersWithCodes) ####################################################################### ## Name Order @@ -167,7 +91,7 @@ errors = [] imports = [] - importNodes, aListNode, eListNodes = self.__findNodes(self.__tree) + importNodes, aListNode, eListNodes = self.__findNodes(self.tree) # check for an error in '__all__' allError = self.__findErrorInAll(aListNode) @@ -183,11 +107,11 @@ imports.append( ImportNode( - self.__args.get("ApplicationPackageNames", []), + self.args.get("ApplicationPackageNames", []), importNode, self, - self.__args.get("SortIgnoringStyle", False), - self.__args.get("SortFromFirst", False), + self.args.get("SortIgnoringStyle", False), + self.args.get("SortFromFirst", False), ) ) @@ -203,21 +127,17 @@ errors.append(n.error) if n == p: - if self.__args.get("CombinedAsImports", False) or ( + if self.args.get("CombinedAsImports", False) or ( not n.asImport and not p.asImport ): - errors.append((n.node, "NO103", str(p), str(n))) + errors.append((n.node, "NO-103", str(p), str(n))) elif n < p: - errors.append((n.node, "NO101", str(n), str(p))) + errors.append((n.node, "NO-101", str(n), str(p))) p = n for error in errors: - if not self.__ignoreCode(error[1]): - node = error[0] - reason = error[1] - args = error[2:] - self.__error(node.lineno - 1, node.col_offset, reason, *args) + self.addErrorFromNode(error[0], error[1], *error[2:]) def __findExceptionListNodes(self, tree): """ @@ -277,7 +197,7 @@ @param node reference to the '__all__' node @type ast.List or ast.Tuple - @return tuple containing a reference to the node an error code and the error + @return tuple containing a reference to the node, an error code and the error arguments @rtype tuple of (ast.List | ast.Tuple, str, str) """ @@ -295,7 +215,7 @@ key=lambda k: self.moduleKey(k, subImports=True), ) if expectedList != actualList: - return (node, "NO104", ", ".join(expectedList)) + return (node, "NO-104", ", ".join(expectedList)) return None @@ -331,7 +251,7 @@ expectedList = self.sorted(actualList) if expectedList != actualList: - errors.append((node, "NO105", ", ".join(expectedList))) + errors.append((node, "NO-105", ", ".join(expectedList))) return errors
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/NameOrder/translations.py Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/NameOrder/translations.py Thu Feb 27 14:42:39 2025 +0100 @@ -11,22 +11,22 @@ from PyQt6.QtCore import QCoreApplication _nameOrderMessages = { - "NO101": QCoreApplication.translate( + "NO-101": QCoreApplication.translate( "NameOrderChecker", "Import statements are in the wrong order. '{0}' should be before '{1}'", ), - "NO102": QCoreApplication.translate( + "NO-102": QCoreApplication.translate( "NameOrderChecker", "Imported names are in the wrong order. Should be '{0}'" ), - "NO103": QCoreApplication.translate( + "NO-103": QCoreApplication.translate( "NameOrderChecker", "Import statements should be combined. '{0}' should be combined with '{1}'", ), - "NO104": QCoreApplication.translate( + "NO-104": QCoreApplication.translate( "NameOrderChecker", "The names in __all__ are in the wrong order. The order should be '{0}'", ), - "NO105": QCoreApplication.translate( + "NO-105": QCoreApplication.translate( "NameOrderChecker", "The names in the exception handler list are in the wrong order. The order" " should be '{0}'", @@ -34,9 +34,9 @@ } _nameOrderMessagesSampleArgs = { - "NO101": ["import bar", "import foo"], - "NO102": ["bar, baz, foo"], - "NO103": ["from foo import bar", "from foo import baz"], - "NO104": ["bar, baz, foo"], - "NO105": ["BarError, BazError, FooError"], + "NO-101": ["import bar", "import foo"], + "NO-102": ["bar, baz, foo"], + "NO-103": ["from foo import bar", "from foo import baz"], + "NO-104": ["bar, baz, foo"], + "NO-105": ["BarError, BazError, FooError"], }
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Naming/NamingStyleChecker.py Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Naming/NamingStyleChecker.py Thu Feb 27 14:42:39 2025 +0100 @@ -9,7 +9,6 @@ import ast import collections -import copy import functools import os @@ -18,9 +17,10 @@ except AttributeError: ast.AsyncFunctionDef = ast.FunctionDef +from CodeStyleTopicChecker import CodeStyleTopicChecker -# TODO: change this to a checker like the others -class NamingStyleChecker: + +class NamingStyleChecker(CodeStyleTopicChecker): """ Class implementing a checker for naming conventions. """ @@ -46,6 +46,7 @@ "N-823", "N-831", ] + Category = "N" def __init__(self, source, filename, tree, select, ignore, expected, repeat, args): """ @@ -68,23 +69,20 @@ @param args dictionary of arguments for the various checks @type dict """ - self.__select = tuple(select) - self.__ignore = tuple(ignore) - self.__expected = expected[:] - self.__repeat = repeat - self.__filename = filename - self.__source = source[:] - self.__tree = copy.deepcopy(tree) - self.__args = args + super().__init__( + NamingStyleChecker.Category, + source, + filename, + tree, + select, + ignore, + expected, + repeat, + args, + ) self.__parents = collections.deque() - # statistics counters - self.counters = {} - - # collection of detected errors - self.errors = [] - self.__checkersWithCodes = { "classdef": [ (self.__checkClassName, ("N-801", "N-818")), @@ -130,32 +128,19 @@ self.__checkers = collections.defaultdict(list) for key, checkers in self.__checkersWithCodes.items(): for checker, codes in checkers: - if any(not (code and self.__ignoreCode(code)) for code in codes): + if any(not (code and self._ignoreCode(code)) for code in codes): self.__checkers[key].append(checker) - def __ignoreCode(self, code): + def addErrorFromNode(self, node, msgCode): """ - Private method to check if the message code should be ignored. - - @param code message code to check for - @type str - @return flag indicating to ignore the given code - @rtype bool - """ - return code in self.__ignore or ( - code.startswith(self.__ignore) and not code.startswith(self.__select) - ) - - def __error(self, node, code): - """ - Private method to build the error information. + Public method to build the error information. @param node AST node to report an error for @type ast.AST - @param code error code to report + @param msgCode message code @type str """ - if self.__ignoreCode(code): + if self._ignoreCode(msgCode): return if isinstance(node, ast.Module): @@ -171,41 +156,21 @@ lineno += len(node.decorator_list) offset += 4 - # record the issue with one based line number - errorInfo = { - "file": self.__filename, - "line": lineno, - "offset": offset, - "code": code, - "args": [], - } - - if errorInfo not in self.errors: - # this issue was not seen before - if code in self.counters: - self.counters[code] += 1 - else: - self.counters[code] = 1 - - # Don't care about expected codes - if code in self.__expected: - return - - if code and (self.counters[code] == 1 or self.__repeat): - self.errors.append(errorInfo) + self.addError(lineno, offset, msgCode, []) def run(self): """ - Public method run by the pycodestyle.py checker. + Public method to execute the relevant checks. + """ + if not self.filename: + # don't do anything, if essential data is missing + return - @return tuple giving line number, offset within line, code and - checker function - @rtype tuple of (int, int, str, function) - """ - if self.__tree and self.__checkers: - return self.__visitTree(self.__tree) - else: - return () + if not self.__checkers: + # don't do anything, if no codes were selected + return + + self.__visitTree(self.tree) def __visitTree(self, node): """ @@ -338,13 +303,13 @@ if isinstance(node, (ast.ClassDef, ast.FunctionDef, ast.AsyncFunctionDef)): name = node.name if self.__isNameToBeAvoided(name): - self.__error(node, "N-831") + self.addErrorFromNode(node, "N-831") elif isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)): argNames = self.__getArgNames(node) for arg in argNames: if self.__isNameToBeAvoided(arg): - self.__error(node, "N-831") + self.addErrorFromNode(node, "N-831") elif isinstance(node, (ast.Assign, ast.NamedExpr, ast.AnnAssign)): if isinstance(node, ast.Assign): @@ -355,14 +320,14 @@ if isinstance(target, ast.Name): name = target.id if bool(name) and self.__isNameToBeAvoided(name): - self.__error(node, "N-831") + self.addErrorFromNode(node, "N-831") elif isinstance(target, (ast.Tuple, ast.List)): for element in target.elts: if isinstance(element, ast.Name): name = element.id if bool(name) and self.__isNameToBeAvoided(name): - self.__error(node, "N-831") + self.addErrorFromNode(node, "N-831") def __getClassdef(self, name, parents): """ @@ -425,11 +390,11 @@ name = node.name strippedName = name.strip("_") if not strippedName[:1].isupper() or "_" in strippedName: - self.__error(node, "N-801") + self.addErrorFromNode(node, "N-801") superClasses = self.__superClassNames(name, parents) if "Exception" in superClasses and not name.endswith("Error"): - self.__error(node, "N-818") + self.addErrorFromNode(node, "N-818") def __checkFunctionName(self, node, _parents): """ @@ -454,9 +419,9 @@ return if name.lower() != name: - self.__error(node, "N-802") + self.addErrorFromNode(node, "N-802") if functionType == "function" and name[:2] == "__" and name[-2:] == "__": - self.__error(node, "N-809") + self.addErrorFromNode(node, "N-809") def __checkFunctionArgumentNames(self, node, _parents): """ @@ -475,12 +440,12 @@ if node.args.kwarg is not None: kwarg = node.args.kwarg.arg if kwarg.lower() != kwarg: - self.__error(node, "N-803") + self.addErrorFromNode(node, "N-803") elif node.args.vararg is not None: vararg = node.args.vararg.arg if vararg.lower() != vararg: - self.__error(node, "N-803") + self.addErrorFromNode(node, "N-803") else: argNames = self.__getArgNames(node) @@ -488,19 +453,19 @@ if not argNames: if functionType == "method": - self.__error(node, "N-805") + self.addErrorFromNode(node, "N-805") elif functionType == "classmethod": - self.__error(node, "N-804") + self.addErrorFromNode(node, "N-804") elif functionType == "method" and argNames[0] != "self": - self.__error(node, "N-805") + self.addErrorFromNode(node, "N-805") elif functionType == "classmethod" and argNames[0] != "cls": - self.__error(node, "N-804") + self.addErrorFromNode(node, "N-804") elif functionType == "staticmethod" and argNames[0] in ("cls", "self"): - self.__error(node, "N-806") + self.addErrorFromNode(node, "N-806") for arg in argNames: if arg.lower() != arg: - self.__error(node, "N-803") + self.addErrorFromNode(node, "N-803") break def __checkVariableNames(self, node, parents): @@ -563,7 +528,7 @@ for name in self.__extractNames(assignmentTarget): errorCode = checker(name) if errorCode: - self.__error(assignmentTarget, errorCode) + self.addErrorFromNode(assignmentTarget, errorCode) def __extractNames(self, assignmentTarget): """ @@ -678,13 +643,13 @@ if self.__filename: moduleName = os.path.splitext(os.path.basename(self.__filename))[0] if moduleName.lower() != moduleName: - self.__error(node, "N-807") + self.addErrorFromNode(node, "N-807") if moduleName == "__init__": # we got a package packageName = os.path.split(os.path.dirname(self.__filename))[1] if packageName.lower() != packageName: - self.__error(node, "N-808") + self.addErrorFromNode(node, "N-808") def __checkImportAs(self, node, _parents): """ @@ -704,14 +669,14 @@ originalName = name.name if originalName.isupper(): if not asname.isupper(): - self.__error(node, "N-811") + self.addErrorFromNode(node, "N-811") elif originalName.islower(): if asname.lower() != asname: - self.__error(node, "N-812") + self.addErrorFromNode(node, "N-812") elif asname.islower(): - self.__error(node, "N-813") + self.addErrorFromNode(node, "N-813") elif asname.isupper(): if "".join(filter(str.isupper, originalName)) == asname: - self.__error(node, "N-815") + self.addErrorFromNode(node, "N-815") else: - self.__error(node, "N-814") + self.addErrorFromNode(node, "N-814")
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/PathLib/PathlibChecker.py Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/PathLib/PathlibChecker.py Thu Feb 27 14:42:39 2025 +0100 @@ -12,32 +12,15 @@ ## adapted from: flake8-use-pathlib v0.3.0 ## ## ## ## Original: Copyright (c) 2021 Rodolphe Pelloux-Prayer ## -## ## -## License: ## -## Permission is hereby granted, free of charge, to any person obtaining a copy ## -## of this software and associated documentation files (the "Software"), to deal ## -## in the Software without restriction, including without limitation the rights ## -## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ## -## copies of the Software, and to permit persons to whom the Software is ## -## furnished to do so, subject to the following conditions: ## -## ## -## The above copyright notice and this permission notice shall be included in all ## -## copies or substantial portions of the Software. ## -## ## -## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ## -## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ## -## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ## -## AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ## -## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ## -## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ## ##################################################################################### import ast import contextlib -import copy + +from CodeStyleTopicChecker import CodeStyleTopicChecker -class PathlibChecker: +class PathlibChecker(CodeStyleTopicChecker): """ Class implementing a checker for functions that can be replaced by use of the pathlib module. @@ -78,6 +61,7 @@ ## Replacements for py.path.local "P-401", ] + Category = "P" # map functions to be replaced to error codes Function2Code = { @@ -131,87 +115,62 @@ @param repeat flag indicating to report each occurrence of a code @type bool """ - self.__select = tuple(selected) - self.__ignore = tuple(ignored) - self.__expected = expected[:] - self.__repeat = repeat - self.__filename = filename - self.__source = source[:] - self.__tree = copy.deepcopy(tree) - - # statistics counters - self.counters = {} - - # collection of detected errors - self.errors = [] - - self.__checkCodes = (code for code in self.Codes if not self.__ignoreCode(code)) - - def __ignoreCode(self, code): - """ - Private method to check if the message code should be ignored. - - @param code message code to check for - @type str - @return flag indicating to ignore the given code - @rtype bool - """ - return code in self.__ignore or ( - code.startswith(self.__ignore) and not code.startswith(self.__select) + super().__init__( + PathlibChecker.Category, + source, + filename, + tree, + selected, + ignored, + expected, + repeat, + [], ) - def __error(self, lineNumber, offset, code, *args): - """ - Private method to record an issue. - - @param lineNumber line number of the issue - @type int - @param offset position within line of the issue - @type int - @param code message code - @type str - @param args arguments for the message - @type list - """ - if self.__ignoreCode(code): - return - - if code in self.counters: - self.counters[code] += 1 - else: - self.counters[code] = 1 - - # Don't care about expected codes - if code in self.__expected: - return + checkersWithCodes = [ + ( + self.__checkPathlibReplacement, + ( + "P-101", + "P-102", + "P-103", + "P-104", + "P-105", + "P-106", + "P-107", + "P-108", + "P-109", + "P-110", + "P-111", + "P-112", + "P-113", + "P-114", + "P-201", + "P-202", + "P-203", + "P-204", + "P-205", + "P-206", + "P-207", + "P-208", + "P-209", + "P-210", + "P-211", + "P-212", + "P-213", + "P-301", + "P-401", + ), + ), + ] + self._initializeCheckers(checkersWithCodes) - if code and (self.counters[code] == 1 or self.__repeat): - # record the issue with one based line number - self.errors.append( - { - "file": self.__filename, - "line": lineNumber + 1, - "offset": offset, - "code": code, - "args": args, - } - ) - - def run(self): + def __checkPathlibReplacement(self): """ - Public method to check the given source against functions - to be replaced by 'pathlib' equivalents. + Private method to check for pathlib replacements. """ - if not self.__filename: - # don't do anything, if essential data is missing - return - - if not self.__checkCodes: - # don't do anything, if no codes were selected - return - visitor = PathlibVisitor(self.__checkForReplacement) - visitor.visit(self.__tree) + visitor.visit(self.tree) def __checkForReplacement(self, node, name): """ @@ -225,7 +184,7 @@ """ with contextlib.suppress(KeyError): errorCode = self.Function2Code[name] - self.__error(node.lineno - 1, node.col_offset, errorCode) + self.addErrorFromNode(node, errorCode) class PathlibVisitor(ast.NodeVisitor): @@ -282,6 +241,8 @@ self.__checkCallback(node, nameResolver.name()) + self.generic_visit(node) + class NameResolver(ast.NodeVisitor): """
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/PathLib/translations.py Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/PathLib/translations.py Thu Feb 27 14:42:39 2025 +0100 @@ -110,7 +110,8 @@ ), "P-212": QCoreApplication.translate( "PathlibChecker", - "os.path.splitext('foo.bar') should be replaced by foo_path.suffix", + "os.path.splitext('foo.bar') should be replaced by foo_path.stem and" + " foo_path.suffix", ), "P-213": QCoreApplication.translate( "PathlibChecker",
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Pydantic/PydanticChecker.py Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Pydantic/PydanticChecker.py Thu Feb 27 14:42:39 2025 +0100 @@ -7,24 +7,24 @@ Module implementing a checker for pydantic related issues. """ -import copy +from CodeStyleTopicChecker import CodeStyleTopicChecker -class PydanticChecker: +class PydanticChecker(CodeStyleTopicChecker): """ Class implementing a checker for pydantic related issues. """ Codes = [ - "PYD001", - "PYD002", - "PYD003", - "PYD004", - "PYD005", - "PYD006", - "PYD010", + "PYD-001", + "PYD-002", + "PYD-003", + "PYD-004", + "PYD-005", + "PYD-006", + "PYD-010", ] - Prefix = "PYD" + Category = "PYD" def __init__(self, source, filename, tree, select, ignore, expected, repeat, args): """ @@ -47,106 +47,33 @@ @param args dictionary of arguments for the various checks @type dict """ - self.__select = tuple(x for x in select if x.startswith(PydanticChecker.Prefix)) - self.__ignore = tuple(x for x in ignore if x.startswith(PydanticChecker.Prefix)) - self.__expected = expected[:] - self.__repeat = repeat - self.__filename = filename - self.__source = source[:] - self.__tree = copy.deepcopy(tree) - self.__args = args - - # statistics counters - self.counters = {} - - # collection of detected errors - self.errors = [] + super().__init__( + PydanticChecker.Category, + source, + filename, + tree, + select, + ignore, + expected, + repeat, + args, + ) checkersWithCodes = [ ( self.__checkPydantic, ( - "PYD001", - "PYD002", - "PYD003", - "PYD004", - "PYD005", - "PYD006", - "PYD010", + "PYD-001", + "PYD-002", + "PYD-003", + "PYD-004", + "PYD-005", + "PYD-006", + "PYD-010", ), ), ] - - self.__checkers = [] - for checker, codes in checkersWithCodes: - if any(not (code and self.__ignoreCode(code)) for code in codes): - self.__checkers.append(checker) - - def __ignoreCode(self, code): - """ - Private method to check if the message code should be ignored. - - @param code message code to check for - @type str - @return flag indicating to ignore the given code - @rtype bool - """ - return code in self.__ignore or ( - code.startswith(self.__ignore) and not code.startswith(self.__select) - ) - - def __error(self, lineNumber, offset, code, *args): - """ - Private method to record an issue. - - @param lineNumber line number of the issue - @type int - @param offset position within line of the issue - @type int - @param code message code - @type str - @param args arguments for the message - @type list - """ - if self.__ignoreCode(code): - return - - if code in self.counters: - self.counters[code] += 1 - else: - self.counters[code] = 1 - - # Don't care about expected codes - if code in self.__expected: - return - - if code and (self.counters[code] == 1 or self.__repeat): - # record the issue with one based line number - self.errors.append( - { - "file": self.__filename, - "line": lineNumber + 1, - "offset": offset, - "code": code, - "args": args, - } - ) - - def run(self): - """ - Public method to check the given source against miscellaneous - conditions. - """ - if not self.__filename: - # don't do anything, if essential data is missing - return - - if not self.__checkers: - # don't do anything, if no codes were selected - return - - for check in self.__checkers: - check() + self._initializeCheckers(checkersWithCodes) def __checkPydantic(self): """ @@ -154,5 +81,5 @@ """ from .PydanticVisitor import PydanticVisitor - visitor = PydanticVisitor(errorCallback=self.__error) - visitor.visit(self.__tree) + visitor = PydanticVisitor(errorCallback=self.addErrorFromNode) + visitor.visit(self.tree)
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Pydantic/PydanticVisitor.py Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Pydantic/PydanticVisitor.py Thu Feb 27 14:42:39 2025 +0100 @@ -37,7 +37,7 @@ """ Constructor - @param errorCallback callback function to register an error + @param errorCallback callback function to register an issue @type func """ super().__init__() @@ -94,7 +94,7 @@ and isFunction(node.value, "Field") and len(node.value.args) >= 1 ): - self.__error(node.lineno - 1, node.col_offset, "PYD001") + self.__error(node, "PYD-001") def __checkForPyd002(self, node): """ @@ -113,7 +113,7 @@ if assign.targets[0].id != "model_config" ] for assignment in invalidAssignments: - self.__error(assignment.lineno - 1, assignment.col_offset, "PYD002") + self.__error(assignment, "PYD-002") def __checkForPyd003(self, node): """ @@ -129,7 +129,7 @@ and len(node.value.keywords) == 1 and node.value.keywords[0].arg == "default" ): - self.__error(node.lineno - 1, node.col_offset, "PYD003") + self.__error(node, "PYD-003") def __checkForPyd004(self, node): """ @@ -155,7 +155,7 @@ None, ) if fieldCall is not None: - self.__error(node.lineno - 1, node.col_offset, "PYD004") + self.__error(node, "PYD-004") def __checkForPyd005(self, node): """ @@ -173,7 +173,7 @@ ): previousTargets.add(stmt.target.id) if previousTargets & extractAnnotations(stmt.annotation): - self.__error(stmt.lineno - 1, stmt.col_offset, "PYD005") + self.__error(stmt, "PYD-005") def __checkForPyd006(self, node): """ @@ -190,7 +190,7 @@ stmt.target, ast.Name ): if stmt.target.id in previousTargets: - self.__error(stmt.lineno - 1, stmt.col_offset, "PYD006") + self.__error(stmt, "PYD-006") previousTargets.add(stmt.target.id) @@ -209,7 +209,7 @@ and stmt.target.id == "__pydantic_config__" ): ##~ __pydantic_config__: ... = ... - self.__error(stmt.lineno - 1, stmt.col_offset, "PYD010") + self.__error(stmt, "PYD-010") if isinstance(stmt, ast.Assign) and any( t.id == "__pydantic_config__" @@ -217,7 +217,7 @@ if isinstance(t, ast.Name) ): ##~ __pydantic_config__ = ... - self.__error(stmt.lineno - 1, stmt.col_offset, "PYD010") + self.__error(stmt, "PYD-010") def visit_ClassDef(self, node: ast.ClassDef) -> None: """ @@ -228,7 +228,6 @@ """ self.__enterClass(node) - # TODO: implement these methods self.__checkForPyd002(node) self.__checkForPyd005(node) self.__checkForPyd006(node)
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Pydantic/translations.py Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Pydantic/translations.py Thu Feb 27 14:42:39 2025 +0100 @@ -12,31 +12,31 @@ _pydanticMessages = { ## pydantic - "PYD001": QCoreApplication.translate( + "PYD-001": QCoreApplication.translate( "PydanticChecker", "positional argument for Field default argument", ), - "PYD002": QCoreApplication.translate( + "PYD-002": QCoreApplication.translate( "PydanticChecker", "non-annotated attribute inside Pydantic model", ), - "PYD003": QCoreApplication.translate( + "PYD-003": QCoreApplication.translate( "PydanticChecker", "unecessary Field call to specify a default value", ), - "PYD004": QCoreApplication.translate( + "PYD-004": QCoreApplication.translate( "PydanticChecker", "default argument specified in annotated", ), - "PYD005": QCoreApplication.translate( + "PYD-005": QCoreApplication.translate( "PydanticChecker", "field name overrides annotation", ), - "PYD006": QCoreApplication.translate( + "PYD-006": QCoreApplication.translate( "PydanticChecker", "duplicate field name", ), - "PYD010": QCoreApplication.translate( + "PYD-010": QCoreApplication.translate( "PydanticChecker", "usage of __pydantic_config__; consider using the `with_config` decorator", ),
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Security/SecurityChecker.py Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Security/SecurityChecker.py Thu Feb 27 14:42:39 2025 +0100 @@ -8,13 +8,14 @@ """ import collections -import copy + +from CodeStyleTopicChecker import CodeStyleTopicChecker from . import Checks from .SecurityNodeVisitor import SecurityNodeVisitor -class SecurityChecker: +class SecurityChecker(CodeStyleTopicChecker): """ Class implementing a checker for security issues. """ @@ -117,6 +118,7 @@ "S-801", "S-802", ] + Category = "S" def __init__(self, source, filename, tree, select, ignore, expected, repeat, args): """ @@ -139,43 +141,29 @@ @param args dictionary of arguments for the security checks @type dict """ - self.__select = tuple(select) - self.__ignore = tuple(ignore) - self.__expected = expected[:] - self.__repeat = repeat - self.__filename = filename - self.__source = source[:] - self.__tree = copy.deepcopy(tree) - self.__args = args - - # statistics counters - self.counters = {} - - # collection of detected errors - self.errors = [] + super().__init__( + SecurityChecker.Category, + source, + filename, + tree, + select, + ignore, + expected, + repeat, + args, + ) checkersWithCodes = Checks.generateCheckersDict() self.__checkers = collections.defaultdict(list) for checkType, checkersList in checkersWithCodes.items(): for checker, codes in checkersList: - if any(not (code and self.__ignoreCode(code)) for code in codes): + if any( + not (msgCode and self._ignoreCode(msgCode)) for msgCode in codes + ): self.__checkers[checkType].append(checker) - def __ignoreCode(self, code): - """ - Private method to check if the message code should be ignored. - - @param code message code to check for - @type str - @return flag indicating to ignore the given code - @rtype bool - """ - return code in self.__ignore or ( - code.startswith(self.__ignore) and not code.startswith(self.__select) - ) - - def reportError(self, lineNumber, offset, code, severity, confidence, *args): + def addError(self, lineNumber, offset, msgCode, severity, confidence, *args): """ Public method to record an issue. @@ -183,7 +171,7 @@ @type int @param offset position within line of the issue @type int - @param code message code + @param msgCode message code @type str @param severity severity code (H = high, M = medium, L = low, U = undefined) @@ -194,26 +182,26 @@ @param args arguments for the message @type list """ - if self.__ignoreCode(code): + if self._ignoreCode(msgCode): return - if code in self.counters: - self.counters[code] += 1 + if msgCode in self.counters: + self.counters[msgCode] += 1 else: - self.counters[code] = 1 + self.counters[msgCode] = 1 # Don't care about expected codes - if code in self.__expected: + if msgCode in self.expected: return - if code and (self.counters[code] == 1 or self.__repeat): + if msgCode and (self.counters[msgCode] == 1 or self.repeat): # record the issue with one based line number self.errors.append( { - "file": self.__filename, + "file": self.filename, "line": lineNumber + 1, "offset": offset, - "code": code, + "code": msgCode, "args": args, "severity": severity, "confidence": confidence, @@ -227,14 +215,14 @@ @return dictionary containing the configuration @rtype dict """ - return self.__args + return self.args def run(self): """ Public method to check the given source against security related conditions. """ - if not self.__filename: + if not self.filename: # don't do anything, if essential data is missing return @@ -243,7 +231,7 @@ return securityNodeVisitor = SecurityNodeVisitor( - self, self.__checkers, self.__filename, self.__source + self, self.__checkers, self.filename, self.source ) - securityNodeVisitor.generic_visit(self.__tree) + securityNodeVisitor.generic_visit(self.tree) securityNodeVisitor.checkFile()
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Security/SecurityNodeVisitor.py Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Security/SecurityNodeVisitor.py Thu Feb 27 14:42:39 2025 +0100 @@ -56,7 +56,7 @@ if checkType in self.__securityCheckers: for check in self.__securityCheckers[checkType]: check( - self.__checker.reportError, + self.__checker.addError, SecurityContext(self.__context), self.__checker.getConfig(), )
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Simplify/SimplifyChecker.py Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Simplify/SimplifyChecker.py Thu Feb 27 14:42:39 2025 +0100 @@ -8,12 +8,13 @@ """ import ast -import copy + +from CodeStyleTopicChecker import CodeStyleTopicChecker from .SimplifyNodeVisitor import SimplifyNodeVisitor -class SimplifyChecker: +class SimplifyChecker(CodeStyleTopicChecker): """ Class implementing a checker for to help simplifying Python code. """ @@ -79,6 +80,7 @@ "Y-910", "Y-911", ] + Category = "Y" def __init__(self, source, filename, tree, selected, ignored, expected, repeat): """ @@ -99,92 +101,88 @@ @param repeat flag indicating to report each occurrence of a code @type bool """ - self.__select = tuple(selected) - self.__ignore = tuple(ignored) - self.__expected = expected[:] - self.__repeat = repeat - self.__filename = filename - self.__source = source[:] - self.__tree = copy.deepcopy(tree) - - # statistics counters - self.counters = {} - - # collection of detected errors - self.errors = [] - - self.__checkCodes = (code for code in self.Codes if not self.__ignoreCode(code)) - - def __ignoreCode(self, code): - """ - Private method to check if the message code should be ignored. - - @param code message code to check for - @type str - @return flag indicating to ignore the given code - @rtype bool - """ - return code in self.__ignore or ( - code.startswith(self.__ignore) and not code.startswith(self.__select) + super().__init__( + SimplifyChecker.Category, + source, + filename, + tree, + selected, + ignored, + expected, + repeat, + [], ) - def __error(self, lineNumber, offset, code, *args): - """ - Private method to record an issue. - - @param lineNumber line number of the issue - @type int - @param offset position within line of the issue - @type int - @param code message code - @type str - @param args arguments for the message - @type list - """ - if self.__ignoreCode(code): - return - - # record the issue with one based line number - errorInfo = { - "file": self.__filename, - "line": lineNumber + 1, - "offset": offset, - "code": code, - "args": args, - } + checkersWithCodes = [ + ( + self.__checkCodeSimplifications, + ( + "Y-101", + "Y-102", + "Y-103", + "Y-104", + "Y-105", + "Y-106", + "Y-107", + "Y-108", + "Y-109", + "Y-110", + "Y-111", + "Y-112", + "Y-113", + "Y-114", + "Y-115", + "Y-116", + "Y-117", + "Y-118", + "Y-119", + "Y-120", + "Y-121", + "Y-122", + "Y-123", + "Y-181", + "Y-182", + "Y-201", + "Y-202", + "Y-203", + "Y-204", + "Y-205", + "Y-206", + "Y-207", + "Y-208", + "Y-211", + "Y-212", + "Y-213", + "Y-221", + "Y-222", + "Y-223", + "Y-224", + "Y-301", + "Y-401", + "Y-402", + "Y-411", + "Y-901", + "Y-904", + "Y-905", + "Y-906", + "Y-907", + "Y-909", + "Y-910", + "Y-911", + ), + ), + ] + self._initializeCheckers(checkersWithCodes) - if errorInfo not in self.errors: - # this issue was not seen before - if code in self.counters: - self.counters[code] += 1 - else: - self.counters[code] = 1 - - # Don't care about expected codes - if code in self.__expected: - return - - if code and (self.counters[code] == 1 or self.__repeat): - self.errors.append(errorInfo) - - def run(self): + def __checkCodeSimplifications(self): + """ + Private method to check for code simplifications. """ - Public method to check the given source against functions - to be replaced by 'pathlib' equivalents. - """ - if not self.__filename: - # don't do anything, if essential data is missing - return + # Add parent information + self.__addMeta(self.tree) - if not self.__checkCodes: - # don't do anything, if no codes were selected - return - - # Add parent information - self.__addMeta(self.__tree) - - visitor = SimplifyNodeVisitor(self.__error) - visitor.visit(self.__tree) + visitor = SimplifyNodeVisitor(self.addErrorFromNode) + visitor.visit(self.tree) def __addMeta(self, root, level=0): """
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Simplify/SimplifyNodeVisitor.py Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Simplify/SimplifyNodeVisitor.py Thu Feb 27 14:42:39 2025 +0100 @@ -459,7 +459,7 @@ """ if isinstance(node.op, ast.Or): for variable in self.__getDuplicatedIsinstanceCall(node): - self.__error(node.lineno - 1, node.col_offset, "Y-101", variable) + self.__error(node, "Y-101", variable) def __check102(self, node): """ @@ -496,7 +496,7 @@ # if c: <--- # d if isPattern1: - self.__error(node.lineno - 1, node.col_offset, "Y-102") + self.__error(node, "Y-102") def __check103(self, node): """ @@ -526,7 +526,7 @@ ) ): condition = unparse(node.test) - self.__error(node.lineno - 1, node.col_offset, "Y-103", condition) + self.__error(node, "Y-103", condition) def __check104(self, node): """ @@ -557,7 +557,7 @@ if not isinstance(parent, ast.AsyncFunctionDef): iterable = unparse(node.iter) - self.__error(node.lineno - 1, node.col_offset, "Y-104", iterable) + self.__error(node, "Y-104", iterable) def __check105(self, node): """ @@ -583,7 +583,7 @@ exception = ", ".join([unparse(n) for n in node.handlers[0].type.elts]) else: exception = unparse(node.handlers[0].type) - self.__error(node.lineno - 1, node.col_offset, "Y-105", exception) + self.__error(node, "Y-105", exception) def __check106(self, node): """ @@ -609,7 +609,7 @@ and not isinstance(node.body[-1], ast.Raise) ) if just_one or many: - self.__error(node.lineno - 1, node.col_offset, "Y-106") + self.__error(node, "Y-106") def __check107(self, node): """ @@ -648,7 +648,7 @@ break if (tryHasReturn or exceptHasReturn) and finallyHasReturn: - self.__error(finallyReturn.lineno - 1, finallyReturn.col_offset, "Y-107") + self.__error(finallyReturn, "Y-107") def __check108(self, node): """ @@ -699,9 +699,7 @@ cond = unparse(node.test) orelse = unparse(node.orelse[0].value) - self.__error( - node.lineno - 1, node.col_offset, "Y-108", assign, body, cond, orelse - ) + self.__error(node, "Y-108", assign, body, cond, orelse) def __check109(self, node): """ @@ -738,12 +736,7 @@ continue self.__error( - node.lineno - 1, - node.col_offset, - "Y-109", - value, - unparse(ast.Tuple(elts=values)), - unparse(node), + node, "Y-109", value, unparse(ast.Tuple(elts=values)), unparse(node) ) def __check110_111(self, node): @@ -775,9 +768,7 @@ target = unparse(node.target) iterable = unparse(node.iter) if node.body[0].body[0].value.value is True: - self.__error( - node.lineno - 1, node.col_offset, "Y-110", check, target, iterable - ) + self.__error(node, "Y-110", check, target, iterable) elif node.body[0].body[0].value.value is False: isCompoundExpression = " and " in check or " or " in check @@ -788,9 +779,7 @@ check = check[len("not ") :] else: check = f"not {check}" - self.__error( - node.lineno - 1, node.col_offset, "Y-111", check, target, iterable - ) + self.__error(node, "Y-111", check, target, iterable) def __check112(self, node): """ @@ -862,7 +851,7 @@ else: return - self.__error(node.lineno - 1, node.col_offset, "Y-112", expected, original) + self.__error(node, "Y-112", expected, original) def __check113(self, node): """ @@ -911,7 +900,7 @@ for match in matches: variable = unparse(match) - self.__error(match.lineno - 1, match.col_offset, "Y-113", variable) + self.__error(match, "Y-113", variable) def __check114(self, node): """ @@ -934,13 +923,7 @@ if self.__isSameBody(ifbody1[1], ifbody2[1]): errorPairs.append((ifbody1, ifbody2)) for ifbody1, ifbody2 in errorPairs: - self.__error( - ifbody1[0].lineno - 1, - ifbody1[0].col_offset, - "Y-114", - unparse(ifbody1[0]), - unparse(ifbody2[0]), - ) + self.__error(ifbody1[0], "Y-114", unparse(ifbody1[0]), unparse(ifbody2[0])) def __check115(self, node): """ @@ -958,7 +941,7 @@ and node.func.id == "open" and not isinstance(node.parent, ast.withitem) ): - self.__error(node.lineno - 1, node.col_offset, "Y-115") + self.__error(node, "Y-115") def __check116(self, node): """ @@ -1054,7 +1037,7 @@ else: ret = f"{keyValuePairs}.get({variable.id})" - self.__error(node.lineno - 1, node.col_offset, "Y-116", ret) + self.__error(node, "Y-116", ret) def __check117(self, node): """ @@ -1071,7 +1054,7 @@ for withitem in node.items + node.body[0].items: withItems.append(f"{unparse(withitem)}") mergedWith = f"with {', '.join(withItems)}:" - self.__error(node.lineno - 1, node.col_offset, "Y-117", mergedWith) + self.__error(node, "Y-117", mergedWith) def __check118(self, node): """ @@ -1115,7 +1098,7 @@ else: keyStr = unparse(node.target) dictStr = unparse(attrNode.value) - self.__error(node.lineno - 1, node.col_offset, "Y-118", keyStr, dictStr) + self.__error(node, "Y-118", keyStr, dictStr) def __check119(self, node): """ @@ -1145,7 +1128,7 @@ hasOnlyConstructorMethod and sum(1 for el in node.body if isinstance(el, ast.FunctionDef)) > 0 ): - self.__error(node.lineno - 1, node.col_offset, "Y-119", node.name) + self.__error(node, "Y-119", node.name) def __check120_121(self, node): """ @@ -1161,7 +1144,7 @@ and isinstance(node.bases[0], ast.Name) and node.bases[0].id == "object" ): - self.__error(node.lineno - 1, node.col_offset, "Y-120", node.name) + self.__error(node, "Y-120", node.name) elif ( len(node.bases) > 1 @@ -1169,11 +1152,7 @@ and node.bases[-1].id == "object" ): self.__error( - node.lineno - 1, - node.col_offset, - "Y-121", - node.name, - ", ".join(b.id for b in node.bases[:-1]), + node, "Y-121", node.name, ", ".join(b.id for b in node.bases[:-1]) ) def __check122(self, node): @@ -1204,7 +1183,7 @@ ): key = unparse(node.test.left) dictname = unparse(node.test.comparators[0]) - self.__error(node.lineno - 1, node.col_offset, "Y-122", dictname, key) + self.__error(node, "Y-122", dictname, key) def __check123(self, node): """ @@ -1266,15 +1245,7 @@ valueStr = unparse(valueNode) else: return - self.__error( - node.lineno - 1, - node.col_offset, - "Y-123", - valueStr, - dictStr, - keyStr, - defaultStr, - ) + self.__error(node, "Y-123", valueStr, dictStr, keyStr, defaultStr) def __check181(self, node): """ @@ -1294,13 +1265,7 @@ and not isinstance(node.value.right, ast.Tuple) ): newNode = ast.AugAssign(node.targets[0], node.value.op, node.value.right) - self.__error( - node.lineno - 1, - node.col_offset, - "Y-181", - unparse(newNode), - unparse(node), - ) + self.__error(node, "Y-181", unparse(newNode), unparse(node)) def __check182(self, node): """ @@ -1320,7 +1285,7 @@ and node.args[0].id == self.__classDefinitionStack[-1] and node.args[1].id == "self" ): - self.__error(node.lineno - 1, node.col_offset, "Y-182", unparse(node)) + self.__error(node, "Y-182", unparse(node)) def __check201(self, node): """ @@ -1344,7 +1309,7 @@ comparison = node.operand left = unparse(comparison.left) right = unparse(comparison.comparators[0]) - self.__error(node.lineno - 1, node.col_offset, "Y-201", left, right) + self.__error(node, "Y-201", left, right) def __check202(self, node): """ @@ -1368,7 +1333,7 @@ comparison = node.operand left = unparse(comparison.left) right = unparse(comparison.comparators[0]) - self.__error(node.lineno - 1, node.col_offset, "Y-202", left, right) + self.__error(node, "Y-202", left, right) def __check203(self, node): """ @@ -1392,7 +1357,7 @@ comparison = node.operand left = unparse(comparison.left) right = unparse(comparison.comparators[0]) - self.__error(node.lineno - 1, node.col_offset, "Y-203", left, right) + self.__error(node, "Y-203", left, right) def __check204(self, node): """ @@ -1415,7 +1380,7 @@ comparison = node.operand left = unparse(comparison.left) right = unparse(comparison.comparators[0]) - self.__error(node.lineno - 1, node.col_offset, "Y-204", left, right) + self.__error(node, "Y-204", left, right) def __check205(self, node): """ @@ -1438,7 +1403,7 @@ comparison = node.operand left = unparse(comparison.left) right = unparse(comparison.comparators[0]) - self.__error(node.lineno - 1, node.col_offset, "Y-205", left, right) + self.__error(node, "Y-205", left, right) def __check206(self, node): """ @@ -1461,7 +1426,7 @@ comparison = node.operand left = unparse(comparison.left) right = unparse(comparison.comparators[0]) - self.__error(node.lineno - 1, node.col_offset, "Y-206", left, right) + self.__error(node, "Y-206", left, right) def __check207(self, node): """ @@ -1484,7 +1449,7 @@ comparison = node.operand left = unparse(comparison.left) right = unparse(comparison.comparators[0]) - self.__error(node.lineno - 1, node.col_offset, "Y-207", left, right) + self.__error(node, "Y-207", left, right) def __check208(self, node): """ @@ -1500,7 +1465,7 @@ and isinstance(node.operand.op, ast.Not) ): var = unparse(node.operand.operand) - self.__error(node.lineno - 1, node.col_offset, "Y-208", var) + self.__error(node, "Y-208", var) def __check211(self, node): """ @@ -1521,7 +1486,7 @@ newCond = "bool({0})".format(cond) else: newCond = cond - self.__error(node.lineno - 1, node.col_offset, "Y-211", cond, newCond) + self.__error(node, "Y-211", cond, newCond) def __check212(self, node): """ @@ -1545,7 +1510,7 @@ newCond = unparse(self.__negateTest(node.test)) else: newCond = "not ({0})".format(cond) - self.__error(node.lineno - 1, node.col_offset, "Y-212", cond, newCond) + self.__error(node, "Y-212", cond, newCond) def __check213(self, node): """ @@ -1562,7 +1527,7 @@ ): a = unparse(node.test.operand) b = unparse(node.body) - self.__error(node.lineno - 1, node.col_offset, "Y-213", a, b) + self.__error(node, "Y-213", a, b) def __check221(self, node): """ @@ -1586,7 +1551,7 @@ for nonNegatedExpression in nonNegatedExpressions: if self.__isSameExpression(negatedExpression, nonNegatedExpression): negExp = unparse(negatedExpression) - self.__error(node.lineno - 1, node.col_offset, "Y-221", negExp) + self.__error(node, "Y-221", negExp) def __check222(self, node): """ @@ -1610,7 +1575,7 @@ for nonNegatedExpression in nonNegatedExpressions: if self.__isSameExpression(negatedExpression, nonNegatedExpression): negExp = unparse(negatedExpression) - self.__error(node.lineno - 1, node.col_offset, "Y-222", negExp) + self.__error(node, "Y-222", negExp) def __check223(self, node): """ @@ -1623,7 +1588,7 @@ if isinstance(node.op, ast.Or): for exp in node.values: if isinstance(exp, ast.Constant) and exp.value is True: - self.__error(node.lineno - 1, node.col_offset, "Y-223") + self.__error(node, "Y-223") def __check224(self, node): """ @@ -1636,7 +1601,7 @@ if isinstance(node.op, ast.And): for exp in node.values: if isinstance(exp, ast.Constant) and exp.value is False: - self.__error(node.lineno - 1, node.col_offset, "Y-224") + self.__error(node, "Y-224") def __check301(self, node): """ @@ -1658,7 +1623,7 @@ if isStr: left = f"'{left}'" right = unparse(node.comparators[0]) - self.__error(node.lineno - 1, node.col_offset, "Y-301", left, right) + self.__error(node, "Y-301", left, right) def __check401(self, node): """ @@ -1677,7 +1642,7 @@ isException = isinstance(node.func, ast.Attribute) and node.func.attr in ["get"] if hasBareBool and not isException: - self.__error(node.lineno - 1, node.col_offset, "Y-401") + self.__error(node, "Y-401") def __check402(self, node): """ @@ -1698,7 +1663,7 @@ ) if hasBareNumeric and not isException: - self.__error(node.lineno - 1, node.col_offset, "Y-402") + self.__error(node, "Y-402") def __check411(self, node): """ @@ -1715,7 +1680,7 @@ self.__check411(innerNode) if fieldName == "value" and isinstance(value, ast.JoinedStr): - self.__error(node.lineno - 1, node.col_offset, "Y-411") + self.__error(node, "Y-411") def __check901(self, node): """ @@ -1732,7 +1697,7 @@ ): actual = unparse(node) expected = unparse(node.args[0]) - self.__error(node.lineno - 1, node.col_offset, "Y-901", expected, actual) + self.__error(node, "Y-901", expected, actual) def __check904(self, node): """ @@ -1755,7 +1720,7 @@ ): dictName = unparse(node.targets[0]) if not self.__expressionUsesVariable(n2.value, dictName): - self.__error(node.lineno - 1, node.col_offset, "Y-904", dictName) + self.__error(node, "Y-904", dictName) def __check905(self, node): """ @@ -1773,7 +1738,7 @@ expected = json.dumps(value.split()) actual = unparse(node.func.value) + ".split()" - self.__error(node.lineno - 1, node.col_offset, "Y-905", expected, actual) + self.__error(node, "Y-905", expected, actual) def __check906(self, node): """ @@ -1827,7 +1792,7 @@ actual = unparse(node) expected = "os.path.join({0})".format(", ".join(names)) - self.__error(node.lineno - 1, node.col_offset, "Y-906", expected, actual) + self.__error(node, "Y-906", expected, actual) def __check907(self, node): """ @@ -1858,9 +1823,7 @@ if len(others) == 1 and hasNone: type_ = unparse(others[0]) - self.__error( - node.lineno - 1, node.col_offset, "Y-907", type_, unparse(node) - ) + self.__error(node, "Y-907", type_, unparse(node)) def __check909(self, node): """ @@ -1877,7 +1840,7 @@ if len(names) != len(set(names)) and not isinstance(node.parent, ast.ClassDef): srccode = unparse(node) - self.__error(node.lineno - 1, node.col_offset, "Y-909", srccode) + self.__error(node, "Y-909", srccode) def __check910(self, node): """ @@ -1905,7 +1868,7 @@ func = unparse(node.func) key = unparse(node.args[0]) expected = f"{func}({key})" - self.__error(node.lineno - 1, node.col_offset, "Y-910", expected, actual) + self.__error(node, "Y-910", expected, actual) def __check911(self, node): """ @@ -1931,9 +1894,7 @@ and secondArg.func.attr == "values" and firstArg.func.value.id == secondArg.func.value.id ): - self.__error( - node.lineno - 1, node.col_offset, "Y-911", firstArg.func.value.id - ) + self.__error(node, "Y-911", firstArg.func.value.id) #
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Unused/UnusedChecker.py Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Unused/UnusedChecker.py Thu Feb 27 14:42:39 2025 +0100 @@ -9,12 +9,13 @@ import ast import collections -import copy import AstUtilities +from CodeStyleTopicChecker import CodeStyleTopicChecker -class UnusedChecker: + +class UnusedChecker(CodeStyleTopicChecker): """ Class implementing a checker for unused arguments, variables, ... . """ @@ -26,6 +27,7 @@ ## Unused Globals "U-200", ] + Category = "U" def __init__(self, source, filename, tree, select, ignore, expected, repeat, args): """ @@ -48,96 +50,23 @@ @param args dictionary of arguments for the various checks @type dict """ - self.__select = tuple(select) - self.__ignore = tuple(ignore) - self.__expected = expected[:] - self.__repeat = repeat - self.__filename = filename - self.__source = source[:] - self.__tree = copy.deepcopy(tree) - self.__args = args - - # statistics counters - self.counters = {} - - # collection of detected errors - self.errors = [] + super().__init__( + UnusedChecker.Category, + source, + filename, + tree, + select, + ignore, + expected, + repeat, + args, + ) checkersWithCodes = [ (self.__checkUnusedArguments, ("U-100", "U-101")), (self.__checkUnusedGlobals, ("U-200",)), ] - - self.__checkers = [] - for checker, codes in checkersWithCodes: - if any(not (code and self.__ignoreCode(code)) for code in codes): - self.__checkers.append(checker) - - def __ignoreCode(self, code): - """ - Private method to check if the message code should be ignored. - - @param code message code to check for - @type str - @return flag indicating to ignore the given code - @rtype bool - """ - return code in self.__ignore or ( - code.startswith(self.__ignore) and not code.startswith(self.__select) - ) - - def __error(self, lineNumber, offset, code, *args): - """ - Private method to record an issue. - - @param lineNumber line number of the issue - @type int - @param offset position within line of the issue - @type int - @param code message code - @type str - @param args arguments for the message - @type list - """ - if self.__ignoreCode(code): - return - - if code in self.counters: - self.counters[code] += 1 - else: - self.counters[code] = 1 - - # Don't care about expected codes - if code in self.__expected: - return - - if code and (self.counters[code] == 1 or self.__repeat): - # record the issue with one based line number - self.errors.append( - { - "file": self.__filename, - "line": lineNumber + 1, - "offset": offset, - "code": code, - "args": args, - } - ) - - def run(self): - """ - Public method to check the given source against miscellaneous - conditions. - """ - if not self.__filename: - # don't do anything, if essential data is missing - return - - if not self.__checkers: - # don't do anything, if no codes were selected - return - - for check in self.__checkers: - check() + self._initializeCheckers(checkersWithCodes) ####################################################################### ## Unused Arguments @@ -149,52 +78,50 @@ """ Private method to check function and method definitions for unused arguments. """ - finder = FunctionFinder(self.__args["IgnoreNestedFunctions"]) - finder.visit(self.__tree) + finder = FunctionFinder(self.args["IgnoreNestedFunctions"]) + finder.visit(self.tree) for functionNode in finder.functionNodes(): decoratorNames = set(self.__getDecoratorNames(functionNode)) # ignore overload functions, it's not a surprise when they're empty - if self.__args["IgnoreOverload"] and "overload" in decoratorNames: + if self.args["IgnoreOverload"] and "overload" in decoratorNames: continue # ignore overridden functions - if self.__args["IgnoreOverride"] and "override" in decoratorNames: + if self.args["IgnoreOverride"] and "override" in decoratorNames: continue # ignore abstractmethods, it's not a surprise when they're empty - if self.__args["IgnoreAbstract"] and "abstractmethod" in decoratorNames: + if self.args["IgnoreAbstract"] and "abstractmethod" in decoratorNames: continue # ignore Qt slot methods - if self.__args["IgnoreSlotMethods"] and ( + if self.args["IgnoreSlotMethods"] and ( "pyqtSlot" in decoratorNames or "Slot" in decoratorNames ): continue - if self.__args["IgnoreEventHandlerMethods"] and self.__isEventHandlerMethod( + if self.args["IgnoreEventHandlerMethods"] and self.__isEventHandlerMethod( functionNode ): continue # ignore stub functions - if self.__args["IgnoreStubs"] and self.__isStubFunction(functionNode): + if self.args["IgnoreStubs"] and self.__isStubFunction(functionNode): continue # ignore lambdas - if self.__args["IgnoreLambdas"] and isinstance(functionNode, ast.Lambda): + if self.args["IgnoreLambdas"] and isinstance(functionNode, ast.Lambda): continue # ignore __double_underscore_methods__() - if self.__args["IgnoreDunderMethods"] and self.__isDunderMethod( - functionNode - ): + if self.args["IgnoreDunderMethods"] and self.__isDunderMethod(functionNode): continue for i, argument in self.__getUnusedArguments(functionNode): name = argument.arg - if self.__args["IgnoreVariadicNames"]: + if self.args["IgnoreVariadicNames"]: if ( functionNode.args.vararg and functionNode.args.vararg.arg == name @@ -213,7 +140,7 @@ offset = argument.col_offset errorCode = "U-101" if name.startswith("_") else "U-100" - self.__error(lineNumber - 1, offset, errorCode, name) + self.addError(lineNumber, offset, errorCode, name) def __getDecoratorNames(self, functionNode): """ @@ -399,17 +326,17 @@ """ errors = {} loadCounter = GlobalVariableLoadCounter() - loadCounter.visit(self.__tree) + loadCounter.visit(self.tree) globalVariables = self.__extractGlobalVariables() for varId, loads in loadCounter.getLoads(): if varId in globalVariables and loads == 0: storeInfo = loadCounter.getStoreInfo(varId) - errorInfo = (storeInfo.lineno - 1, storeInfo.offset, "U-200", varId) + errorInfo = (storeInfo.lineno, storeInfo.offset, "U-200", varId) errors[varId] = errorInfo - for node in self.__tree.body[::-1]: + for node in self.tree.body[::-1]: if isinstance(node, ast.Assign): for target in node.targets: if isinstance(target, ast.Name) and target.id in errors: @@ -423,14 +350,14 @@ else: break - if self.__args["IgnoreDunderGlobals"]: + if self.args["IgnoreDunderGlobals"]: # eliminate some special cases for name in list(errors): if name.startswith("__") and name.endswith("__"): errors.pop(name) for varId in errors: - self.__error(*errors[varId]) + self.addError(*errors[varId]) def __extractGlobalVariables(self): """ @@ -441,7 +368,7 @@ """ variables = set() - for assignment in self.__tree.body: + for assignment in self.tree.body: if isinstance(assignment, ast.Assign): for target in assignment.targets: if isinstance(target, ast.Name):
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/pycodestyle.py Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/pycodestyle.py Thu Feb 27 14:42:39 2025 +0100 @@ -289,7 +289,7 @@ of 79 characters. For flowing long blocks of text (docstrings or comments), limiting the length to 72 characters is recommended. - Reports error E-501. + Reports error E501. """ line = physical_line.rstrip() length = len(line) @@ -306,7 +306,7 @@ len(line) - len(chunks[-1]) < max_line_length - 7: return if length > max_line_length: - return (max_line_length, "E-501 line too long " + return (max_line_length, "E501 line too long " "(%d > %d characters)" % (length, max_line_length), length, max_line_length)
--- a/src/eric7/eric7_browser.py Thu Feb 27 09:22:15 2025 +0100 +++ b/src/eric7/eric7_browser.py Thu Feb 27 14:42:39 2025 +0100 @@ -60,7 +60,7 @@ app.exec() sys.exit(100) -from eric7.EricWidgets.EricApplication import EricApplication # noqa: NO101 +from eric7.EricWidgets.EricApplication import EricApplication # noqa: NO-101 from eric7.Toolbox import Startup from eric7.WebBrowser.WebBrowserSingleApplication import ( WebBrowserSingleApplicationClient,