You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, it is important to acknowledge that duplicate code within an individual python file can be detrimental and need to be cleaned up / refactored, just as is the case with duplicate code spanning multiple files. If you disagree with this, you can close this issue now.
Applying the DRY principle (don't repeat yourself) to code is great, and pylint helps with this.
pylint is capable of finding duplicate code within the same file, but the problem is that pylint won't report this unless multiple files are checked.
Steps to reproduce
Create a file where several lines of code are duplicated, call this foo.py
Create a second python file with non-empty python content, ensuring that the duplicate code from foo.py does not happen to also exist in the file; call this bar.py
Run pylint twice. The first time, run it on both foo.py and bar.py. The second time, run it only on foo.py.
You will notice that in the first run, pylint is perfectly able to find and report on duplicate code occurrences within the same individual file, which is fantastic. However, you will notice that in the second run, the reporting of the duplicate code has disappeared.
So we know that pylint can find duplicate code within an individual file, but it doesn't always report it. From best I can tell, the way to trigger the bug is to tell it to check only one file.
Current behavior
pylint will only report duplicate code within the same file if multiple files are being checked.
Expected behavior
pylint will report duplicate code within the same file regardless of how many files pylint has been asked to check. (one vs. more than one)
First, it is important to acknowledge that duplicate code within an individual python file can be detrimental and need to be cleaned up / refactored, just as is the case with duplicate code spanning multiple files. If you disagree with this, you can close this issue now.
Applying the DRY principle (don't repeat yourself) to code is great, and pylint helps with this.
pylint is capable of finding duplicate code within the same file, but the problem is that pylint won't report this unless multiple files are checked.
Steps to reproduce
You will notice that in the first run, pylint is perfectly able to find and report on duplicate code occurrences within the same individual file, which is fantastic. However, you will notice that in the second run, the reporting of the duplicate code has disappeared.
So we know that pylint can find duplicate code within an individual file, but it doesn't always report it. From best I can tell, the way to trigger the bug is to tell it to check only one file.
Current behavior
pylint will only report duplicate code within the same file if multiple files are being checked.
Expected behavior
pylint will report duplicate code within the same file regardless of how many files pylint has been asked to check. (one vs. more than one)
pylint --version output
pylint 2.2.2
astroid 2.0.4
Python 3.6.5 (default, Apr 25 2018, 14:23:58)
[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.1)]
The text was updated successfully, but these errors were encountered: