From 7622b2ab7800dbfe657e13fe30c9c0a3636035df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mois=C3=A9s=20L=C3=B3pez?= Date: Thu, 14 Jul 2016 21:42:04 +0000 Subject: [PATCH 1/2] [REF] duplicate-code: Check disabled from first line to top code line --- pylint/checkers/similar.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pylint/checkers/similar.py b/pylint/checkers/similar.py index 72358f5f3e..caad71ab58 100644 --- a/pylint/checkers/similar.py +++ b/pylint/checkers/similar.py @@ -287,6 +287,12 @@ def process_module(self, node): stream must implement the readlines method """ + if not self.linter.is_message_enabled('R0801') or not node.body: + return + + for top_line in range(1, node.body[0].lineno): + if not self.linter.is_message_enabled('R0801', top_line): + return with node.stream() as stream: self.append_stream(self.linter.current_name, stream, From 275a227b7dec72219e012e994b4944bbc1ee51af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mois=C3=A9s=20L=C3=B3pez?= Date: Fri, 15 Jul 2016 01:14:43 +0000 Subject: [PATCH 2/2] [REF] docs: Add doc to 'fix ignored disable=duplicate-code' --- ChangeLog | 2 ++ doc/whatsnew/2.0.rst | 2 ++ 2 files changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index 43c6710e4d..6ecea7b0c1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -107,6 +107,8 @@ Release date: tba Closes issue #968 + * Fix ignored *disable=duplicate-code* on top file + What's new in Pylint 1.6.2? =========================== diff --git a/doc/whatsnew/2.0.rst b/doc/whatsnew/2.0.rst index 54434ff6f5..04ed7c4da0 100644 --- a/doc/whatsnew/2.0.rst +++ b/doc/whatsnew/2.0.rst @@ -105,6 +105,8 @@ Bug fixes * Fix a false positive of 'redundant-returns-doc', occurred when the documented function was using *yield* instead of *return*. +* Fix ignored *disable=duplicate-code* on top file + Removed Changes ===============