--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py Sat May 20 19:50:13 2023 +0200 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py Sun May 21 15:26:11 2023 +0200 @@ -20,6 +20,7 @@ from DocStyle.DocStyleChecker import DocStyleChecker from Imports.ImportsChecker import ImportsChecker from Miscellaneous.MiscellaneousChecker import MiscellaneousChecker +from NameOrder.NameOrderChecker import NameOrderChecker from Naming.NamingStyleChecker import NamingStyleChecker from PathLib.PathlibChecker import PathlibChecker from Security.SecurityChecker import SecurityChecker @@ -112,7 +113,7 @@ if comment.startswith(("noqa:", "NOQA:")): flags = [ "noqa:{0}".format(f.strip()) - for f in comment[len("noqa:"):].split(",") + for f in comment[len("noqa:") :].split(",") ] else: flags = [ @@ -155,7 +156,7 @@ if code.startswith(ignoredCode): return True elif flag.startswith("noqa:"): - ignoredCode = flag[len("noqa:"):].strip() + ignoredCode = flag[len("noqa:") :].strip() if code.startswith(ignoredCode): return True @@ -191,10 +192,10 @@ excludeMessages, includeMessages, repeatMessages, fixCodes, noFixCodes, fixIssues, maxLineLength, maxDocLineLength, blankLines, hangClosing, docType, codeComplexityArgs, miscellaneousArgs, - annotationArgs, securityArgs, importsArgs, errors, eol, encoding, + annotationArgs, securityArgs, importsArgs, nameOrderArgs, errors, eol, encoding, backup) @type list of (str, str, bool, str, str, bool, int, list of (int, int), - bool, str, dict, dict, dict, dict, list of str, str, str, bool) + bool, str, dict, dict, dict, dict, dict, list of str, str, str, bool) @return tuple of statistics (dict) and list of results (tuple for each found violation of style (lineno, position, text, ignored, fixed, autofixing, fixedMsg)) @@ -355,10 +356,10 @@ excludeMessages, includeMessages, repeatMessages, fixCodes, noFixCodes, fixIssues, maxLineLength, maxDocLineLength, blankLines, hangClosing, docType, codeComplexityArgs, miscellaneousArgs, - annotationArgs, securityArgs, importsArgs, errors, eol, encoding, + annotationArgs, securityArgs, importsArgs, nameOrderArgs, errors, eol, encoding, backup) @type list of (str, str, bool, str, str, bool, int, list of (int, int), - bool, str, dict, dict, dict, dict, list of str, str, str, bool) + bool, str, dict, dict, dict, dict, dict, list of str, str, str, bool) @return tuple of statistics data and list of result dictionaries with keys: <ul> @@ -392,6 +393,7 @@ annotationArgs, securityArgs, importsArgs, + nameOrderArgs, errors, eol, encoding, @@ -542,6 +544,21 @@ stats.update(importsChecker.counters) errors += importsChecker.errors + # check name ordering + nameOrderChecker = NameOrderChecker( + source, + filename, + tree, + select, + ignore, + [], + repeatMessages, + nameOrderArgs, + ) + nameOrderChecker.run() + stats.update(nameOrderChecker.counters) + errors += nameOrderChecker.errors + elif syntaxError: errors = [syntaxError] stats.update(syntaxStats)