fix R0801 similarities bug. Closes #63424

authorAnthony VEREZ <anthony.verez.external@cassidian.com>
changeset21a4414695c2
branchdefault
phasepublic
hiddenno
parent revision#241f04d77e0b create a console_scripts entry point to be used by easy_install, buildout and pip. Closes #103949
child revision#b40e3b4bc006 [format checker] check for anomalous backslash escape (new W1401, W1402). Closes #104571
files modified by this revision
ChangeLog
checkers/similar.py
doc/features.txt
test/unittest_lint.py
# HG changeset patch
# User Anthony VEREZ <anthony.verez.external@cassidian.com>
# Date 1348063108 -7200
# Wed Sep 19 15:58:28 2012 +0200
# Node ID 21a4414695c2ab14a6186e79abc82d4e35064de4
# Parent 241f04d77e0b16424b6a5d2b7121d321f9d68461
fix R0801 similarities bug. Closes #63424

diff --git a/ChangeLog b/ChangeLog
@@ -15,18 +15,21 @@
1        long int identifier)
2 
3      * #103656: fix W0231 false positive for missing call to object.__init__
4        (patch by lothiraldan@gmail.com)
5 
6 +    * #63424: fix similarity report disabling by properly renaming it to RP0801
7 +
8      * #103949: create a console_scripts entry point to be used by
9        easy_install, buildout and pip
10 
11      * fix cross-interpreter issue (non compatible access to __builtins__)
12 
13      * stop including tests files in distribution, they causes crash when
14        installed with python3 (#72022, #82417, #76910)
15 
16 +
17  2012-07-17  --  0.25.2
18      * #93591: Correctly emit warnings about clobbered variable names when an
19        except handler contains a tuple of names instead of a single name.
20        (patch by tmarek@google.com)
21 
@@ -53,11 +56,10 @@
22        when using a regexp value set
23 
24      * fix potential crashes with utils.safe_infer raising InferenceError
25 
26 
27 -
28  2011-12-08  --  0.25.1
29      * #81078: Warn if names in  exception handlers clobber overwrite
30        existing names (patch by tmarek@google.com)
31 
32      * #81113: Fix W0702 messages appearing with the wrong line number.
diff --git a/checkers/similar.py b/checkers/similar.py
@@ -235,11 +235,11 @@
33                  {'default' : True, 'type' : 'yn', 'metavar' : '<y or n>',
34                   'help': 'Ignore docstrings when computing similarities.'}
35                  ),
36                 )
37      # reports
38 -    reports = ( ('R0801', 'Duplication', report_similarities), ) # XXX actually a Refactoring message
39 +    reports = ( ('RP0801', 'Duplication', report_similarities), )
40 
41      def __init__(self, linter=None):
42          BaseChecker.__init__(self, linter)
43          Similar.__init__(self, min_lines=4,
44                           ignore_comments=True, ignore_docstrings=True)
diff --git a/doc/features.txt b/doc/features.txt
@@ -152,11 +152,11 @@
45    This usually means that the code should be refactored to avoid this
46    duplication.
47 
48  Reports
49  ~~~~~~~
50 -:R0801: Duplication
51 +:RP0801: Duplication
52 
53 
54  string_format checker
55  ---------------------
56 
diff --git a/test/unittest_lint.py b/test/unittest_lint.py
@@ -1,6 +1,6 @@
57 -# Copyright (c) 2003-2007 LOGILAB S.A. (Paris, FRANCE).
58 +# Copyright (c) 2003-2012 LOGILAB S.A. (Paris, FRANCE).
59  # This program is free software; you can redistribute it and/or modify it under
60  # the terms of the GNU General Public License as published by the Free Software
61  # Foundation; either version 2 of the License, or (at your option) any later
62  # version.
63  #
@@ -238,12 +238,11 @@
64          should_not = ('design', 'format', 'imports', 'metrics',
65                        'miscellaneous', 'similarities')
66          self.assertFalse(any(name in checker_names for name in should_not))
67 
68      def test_disable_similar(self):
69 -        # XXX we have to disable them both, that's no good
70 -        self.linter.set_option('reports', False)
71 +        self.linter.set_option('disable', 'RP0801')
72          self.linter.set_option('disable', 'R0801')
73          self.assertFalse('similarities' in [c.name for c in self.linter.prepare_checkers()])
74 
75      def test_disable_alot(self):
76          """check that we disabled a lot of checkers"""