useless-object-inheritance
What it does
Section titled “What it does”Reports a class that has the builtin object as a base.
Why it matters
Section titled “Why it matters”Every class of Python 3 inherits from object, so naming it changes nothing. The base was needed for new-style classes in Python 2.
To fix, remove the base.
Example
Section titled “Example”...Base = M = f = 1
class A(object): pass
class B(Base, object, metaclass=M): pass
...Configuration
Section titled “Configuration”python: lint: rules: useless-object-inheritance: warn # off (default), warn, errorEnabled by the presets: python/ruff.
Suppress one line with sudsy-disable-next-line useless-object-inheritance in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| ruff | UP004 |
full |