summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--pylint/checkers/design_analysis.py29
-rw-r--r--pylint/checkers/variables.py2
-rw-r--r--pylint/test/data/classes_No_Name.dot2
-rw-r--r--pylint/test/functional/interface_not_implemented.py31
-rw-r--r--pylint/test/functional/interface_not_implemented.txt1
-rw-r--r--pylint/test/input/func_interfaces.py2
-rw-r--r--pylint/test/input/func_noerror_w0232.py5
8 files changed, 7 insertions, 67 deletions
diff --git a/ChangeLog b/ChangeLog
index 6db2a50..a42b927 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -84,6 +84,8 @@ ChangeLog for Pylint
listed more than once in its bases definition, while inconsistent-mro
is emitted when no sane mro hierarchy can be determined. Closes issue #526.
+ * Remove interface-not-implemented warning. Closes issue #532.
+
2015-03-14 -- 1.4.3
diff --git a/pylint/checkers/design_analysis.py b/pylint/checkers/design_analysis.py
index 9ff10bf..a064842 100644
--- a/pylint/checkers/design_analysis.py
+++ b/pylint/checkers/design_analysis.py
@@ -64,9 +64,6 @@ MSGS = {
'too-many-statements',
'Used when a function or method has too many statements. You \
should then split it in smaller functions / methods.'),
- 'R0923': ('Interface not implemented',
- 'interface-not-implemented',
- 'Used when an interface class is not implemented anywhere.'),
}
@@ -146,8 +143,6 @@ class MisdesignChecker(BaseChecker):
self.stats = None
self._returns = None
self._branches = None
- self._used_ifaces = None
- self._ifaces = None
self._stmts = 0
def open(self):
@@ -155,18 +150,9 @@ class MisdesignChecker(BaseChecker):
self.stats = self.linter.add_stats()
self._returns = []
self._branches = defaultdict(int)
- self._used_ifaces = {}
- self._ifaces = []
-
- def close(self):
- """check that interface classes are used"""
- for iface in self._ifaces:
- if not iface in self._used_ifaces:
- self.add_message('interface-not-implemented', node=iface)
@check_messages('too-many-ancestors', 'too-many-instance-attributes',
- 'too-few-public-methods', 'too-many-public-methods',
- 'interface-not-implemented')
+ 'too-few-public-methods', 'too-many-public-methods')
def visit_class(self, node):
"""check size of inheritance hierarchy and number of instance attributes
"""
@@ -182,19 +168,6 @@ class MisdesignChecker(BaseChecker):
self.add_message('too-many-instance-attributes', node=node,
args=(len(node.instance_attrs),
self.config.max_attributes))
- # update interface classes structures
- if node.type == 'interface' and node.name != 'Interface':
- self._ifaces.append(node)
- for parent in node.ancestors(False):
- if parent.name == 'Interface':
- continue
- self._used_ifaces[parent] = 1
- try:
- for iface in node.interfaces():
- self._used_ifaces[iface] = 1
- except InferenceError:
- # XXX log ?
- pass
@check_messages('too-few-public-methods', 'too-many-public-methods')
def leave_class(self, node):
diff --git a/pylint/checkers/variables.py b/pylint/checkers/variables.py
index 8e3789a..45fd76d 100644
--- a/pylint/checkers/variables.py
+++ b/pylint/checkers/variables.py
@@ -543,7 +543,7 @@ builtins. Remember that you should avoid to define new builtins when possible.'
# don't check arguments of abstract methods or within an interface
is_method = node.is_method()
klass = node.parent.frame()
- if is_method and (klass.type == 'interface' or node.is_abstract()):
+ if is_method and node.is_abstract():
return
if is_method and isinstance(klass, astroid.Class):
confidence = INFERENCE if has_known_bases(klass) else INFERENCE_FAILURE
diff --git a/pylint/test/data/classes_No_Name.dot b/pylint/test/data/classes_No_Name.dot
index 51b42e7..3a9df79 100644
--- a/pylint/test/data/classes_No_Name.dot
+++ b/pylint/test/data/classes_No_Name.dot
@@ -3,7 +3,7 @@ charset="utf-8"
rankdir=BT
"0" [label="{Ancestor|attr : str\lcls_member\l|get_value()\lset_value()\l}", shape="record"];
"1" [label="{DoNothing|\l|}", shape="record"];
-"2" [label="{«interface»\nInterface|\l|get_value()\lset_value()\l}", shape="record"];
+"2" [label="{Interface|\l|get_value()\lset_value()\l}", shape="record"];
"3" [label="{Specialization|TYPE : str\lrelation\ltop : str\l|}", shape="record"];
"3" -> "0" [arrowhead="empty", arrowtail="none"];
"0" -> "2" [arrowhead="empty", arrowtail="node", style="dashed"];
diff --git a/pylint/test/functional/interface_not_implemented.py b/pylint/test/functional/interface_not_implemented.py
deleted file mode 100644
index 6244ac4..0000000
--- a/pylint/test/functional/interface_not_implemented.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# pylint: disable=missing-docstring
-from __future__ import absolute_import
-
-from logilab.common.interface import Interface
-
-class IAaaa(Interface): # [interface-not-implemented]
- """yo"""
-
- def meth1(self):
- """hehehe"""
-
-class IBbbb(Interface):
- """yo"""
-
- def meth1(self):
- """hehehe"""
-
-class Concret(object):
- """implements IBbbb"""
- __implements__ = IBbbb
-
- def __init__(self):
- pass
-
- def meth1(self):
- """hehehe"""
- return "et hop", self
-
- def meth2(self):
- """hehehe"""
- return "et hop", self
diff --git a/pylint/test/functional/interface_not_implemented.txt b/pylint/test/functional/interface_not_implemented.txt
deleted file mode 100644
index ded0625..0000000
--- a/pylint/test/functional/interface_not_implemented.txt
+++ /dev/null
@@ -1 +0,0 @@
-interface-not-implemented:6:IAaaa:Interface not implemented
diff --git a/pylint/test/input/func_interfaces.py b/pylint/test/input/func_interfaces.py
index 7a716c1..29b4603 100644
--- a/pylint/test/input/func_interfaces.py
+++ b/pylint/test/input/func_interfaces.py
@@ -1,4 +1,4 @@
-# pylint:disable=R0201
+# pylint:disable=R0201,too-few-public-methods
"""docstring"""
from __future__ import print_function
diff --git a/pylint/test/input/func_noerror_w0232.py b/pylint/test/input/func_noerror_w0232.py
index df93855..75b68df 100644
--- a/pylint/test/input/func_noerror_w0232.py
+++ b/pylint/test/input/func_noerror_w0232.py
@@ -1,10 +1,7 @@
-# pylint: disable=R0903,R0923
+# pylint: disable=R0903
"""check interface and exception without __init__ doesn't print warnings
"""
__revision__ = ''
-class Interface:
- """interface without docstring"""
-
class MyError(Exception):
"""exception without docstring"""