diff -r 0572a215bd2f -r 5994b80b8760 eric6/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/MiscellaneousChecker.py --- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/MiscellaneousChecker.py Sun Apr 11 16:53:48 2021 +0200 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/MiscellaneousChecker.py Sun Apr 11 18:45:10 2021 +0200 @@ -543,14 +543,12 @@ # if starargs or kwargs is not None, it can't count the # parameters but at least check if the args are used - if hasKwArgs: - if not names: - # No names but kwargs - self.__error(call.lineno - 1, call.col_offset, "M623") - if hasStarArgs: - if not numbers: - # No numbers but args - self.__error(call.lineno - 1, call.col_offset, "M624") + if hasKwArgs and not names: + # No names but kwargs + self.__error(call.lineno - 1, call.col_offset, "M623") + if hasStarArgs and not numbers: + # No numbers but args + self.__error(call.lineno - 1, call.col_offset, "M624") if not hasKwArgs and not hasStarArgs: # can actually verify numbers and names @@ -1199,11 +1197,14 @@ @type ast.Call """ # we are in a logging statement - if self.__withinLoggingStatement(): - if self.__withinLoggingArgument() and self.__isFormatCall(node): - self.violations.append((node, "M651")) - super().generic_visit(node) - return + if ( + self.__withinLoggingStatement() and + self.__withinLoggingArgument() and + self.__isFormatCall(node) + ): + self.violations.append((node, "M651")) + super().generic_visit(node) + return loggingLevel = self.__detectLoggingLevel(node) @@ -1265,12 +1266,14 @@ @param node reference to the node to be processed @type ast.JoinedStr """ - if self.__withinLoggingStatement(): - if any(isinstance(i, ast.FormattedValue) for i in node.values): - if self.__withinLoggingArgument(): - self.violations.append((node, "M654")) - - super().generic_visit(node) + if ( + self.__withinLoggingStatement() and + any(isinstance(i, ast.FormattedValue) for i in node.values) and + self.__withinLoggingArgument() + ): + self.violations.append((node, "M654")) + + super().generic_visit(node) class BugBearVisitor(ast.NodeVisitor): @@ -1423,10 +1426,10 @@ target = node.targets[0] if ( isinstance(target, ast.Attribute) and - isinstance(target.value, ast.Name) + isinstance(target.value, ast.Name) and + (target.value.id, target.attr) == ('os', 'environ') ): - if (target.value.id, target.attr) == ('os', 'environ'): - self.violations.append((node, "M506")) + self.violations.append((node, "M506")) self.generic_visit(node)