Sat, 10 Apr 2021 13:02:08 +0200
Code Style Checker
- added a check to help simplifying 'FooBar(Foo, object)' to just 'FooBar(Foo)'
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Simplify/SimplifyChecker.py Sat Apr 10 12:34:29 2021 +0200 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Simplify/SimplifyChecker.py Sat Apr 10 13:02:08 2021 +0200 @@ -21,7 +21,7 @@ # Python-specifics "Y101", "Y102", "Y103", "Y104", "Y105", "Y106", "Y107", "Y108", "Y109", "Y110", "Y111", "Y112", "Y113", "Y114", "Y115", "Y116", - "Y117", "Y118", "Y119", "Y120", + "Y117", "Y118", "Y119", "Y120", "Y121", # Python-specifics not part of flake8-simplify "Y181", "Y182",
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Simplify/SimplifyNodeVisitor.py Sat Apr 10 12:34:29 2021 +0200 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Simplify/SimplifyNodeVisitor.py Sat Apr 10 13:02:08 2021 +0200 @@ -1075,8 +1075,14 @@ ): self.__error(node.lineno - 1, node.col_offset, "Y120", node.name) - # TODO: extend to cover 'class FooBar(Foo, object):' - # => class FooBar(Foo): + + elif ( + len(node.bases) > 1 and + isinstance(node.bases[-1], ast.Name) and + node.bases[-1].id == "object" + ): + self.__error(node.lineno - 1, node.col_offset, "Y121", + node.name, ", ".join(b.id for b in node.bases[:-1])) def __check181(self, node): """
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Simplify/translations.py Sat Apr 10 12:34:29 2021 +0200 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Simplify/translations.py Sat Apr 10 13:02:08 2021 +0200 @@ -76,6 +76,9 @@ "Y120": QCoreApplication.translate( "SimplifyChecker", '''Use "class {0}:" instead of "class {0}(object):"'''), + "Y121": QCoreApplication.translate( + "SimplifyChecker", + '''Use "class {0}({1}):" instead of "class {0}({1}, object):"'''), # Python-specifics not part of flake8-simplify "Y181": QCoreApplication.translate( @@ -157,6 +160,7 @@ "Y118": ["foo", "bar_dict"], "Y119": ["Foo"], "Y120": ["Foo"], + "Y121": ["FooBar", "Foo"], # Python-specifics not part of flake8-simplify "Y181": ["foo += 42", "foo = foo + 42"],