diff options
author | Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com> | 2022-05-05 14:12:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-05 14:12:59 +0200 |
commit | a422b7f0f4315332a09b0787d4b4fd53959e6dd1 (patch) | |
tree | 9ea7ff179c931987a970916e1dbf749a500e745c | |
parent | 647b05e964779f5bd0d449998580a37344784c0a (diff) | |
download | pylint-git-a422b7f0f4315332a09b0787d4b4fd53959e6dd1.tar.gz |
Change default values of ``ignore-imports`` and ``ignore-signatures`` (#6500)
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | doc/whatsnew/2.14.rst | 3 | ||||
-rw-r--r-- | pylint/checkers/similar.py | 4 | ||||
-rw-r--r-- | tests/checkers/unittest_similar.py | 2 |
4 files changed, 10 insertions, 2 deletions
@@ -25,6 +25,9 @@ Release date: TBA Closes #4301 +* By default the similarity checker will now ignore imports and ignore function signatures when computing + duplication. If you want to keep the previous behaviour set ``ignore-imports`` and ``ignore-signatures`` to ``False``. + * Improved recognition of namespace packages. They should no longer be added to ``sys.path`` which should prevent various issues with false positives. Because of the difficulties with mirroring the python import mechanics we would gladly diff --git a/doc/whatsnew/2.14.rst b/doc/whatsnew/2.14.rst index 2931fae03..064832ea2 100644 --- a/doc/whatsnew/2.14.rst +++ b/doc/whatsnew/2.14.rst @@ -278,6 +278,9 @@ Other Changes Closes #5608 +* By default the similarity checker will now ignore imports and ignore function signatures when computing + duplication. If you want to keep the previous behaviour set ``ignore-imports`` and ``ignore-signatures`` to ``False``. + * Pylint now expands the user path (i.e. ``~`` to ``home/yusef/``) and expands environment variables (i.e. ``home/$USER/$project`` to ``home/yusef/pylint`` for ``USER=yusef`` and ``project=pylint``) for pyreverse's ``output-directory``, ``import-graph``, ``ext-import-graph``, ``int-import-graph`` options, and the spell checker's ``spelling-private-dict-file`` diff --git a/pylint/checkers/similar.py b/pylint/checkers/similar.py index 74296f0fe..f034650fd 100644 --- a/pylint/checkers/similar.py +++ b/pylint/checkers/similar.py @@ -780,7 +780,7 @@ class SimilarChecker(BaseRawFileChecker, Similar): ( "ignore-imports", { - "default": False, + "default": True, "type": "yn", "metavar": "<y or n>", "help": "Imports are removed from the similarity computation", @@ -789,7 +789,7 @@ class SimilarChecker(BaseRawFileChecker, Similar): ( "ignore-signatures", { - "default": False, + "default": True, "type": "yn", "metavar": "<y or n>", "help": "Signatures are removed from the similarity computation", diff --git a/tests/checkers/unittest_similar.py b/tests/checkers/unittest_similar.py index a14eabe40..c0f0cdcbf 100644 --- a/tests/checkers/unittest_similar.py +++ b/tests/checkers/unittest_similar.py @@ -469,6 +469,8 @@ def test_get_map_data() -> None: # Manually perform a 'map' type function for source_fname in source_streams: sim = similar.SimilarChecker(PyLinter()) + sim.linter.set_option("ignore-imports", False) + sim.linter.set_option("ignore-signatures", False) with open(source_fname, encoding="utf-8") as stream: sim.append_stream(source_fname, stream) # The map bit, can you tell? ;) |