blob: 5c23d2147e60469c2604f2e00c5949e6a44d9979 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
"""Check if a class inherits from object.
In python3 every class implicitly inherits from object, therefore give refactoring message to
remove object from bases"""
# pylint: disable=invalid-name, missing-docstring, too-few-public-methods
# pylint: disable=inconsistent-mro
import abc
class A(object): # [useless-object-inheritance]
pass
class B:
pass
class C(B, object): # [useless-object-inheritance]
pass
class D(object, C, metaclass=abc.ABCMeta): # [useless-object-inheritance]
pass
class E(D, C, object, metaclass=abc.ABCMeta): # [useless-object-inheritance]
pass
class F(A): # positive test case
pass
class G(B): # positive test case
pass
|