checkstyle / checkstyle/patch-filters
Renamed-and-modified files suppress violations on their changed lines
- Dominant language
- Java
- Stars
- 4
- Forks
- 11
- Avg merge
- 5h 55m
- Merged PRs (30d)
- 2
Description
Checkstyle jar: `checkstyle-13.6.0-all.jar`
Checkstyle patchjar: `checkstyle-patchfilter-all.jar`
╰─$ **cat Bar.java**
```java
package Checker;
public class Foo {
public static void main(String[] args) {
System.out.println("hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
System.out.println();
System.out.println();
}
}
```
╰─$ **cat rename.patch**
```
diff --git a/Foo.java b/Bar.java
similarity index 55%
rename from Foo.java
rename to Bar.java
index d188913..400ac79 100644
--- a/Foo.java
+++ b/Bar.java
@@ -2,7 +2,7 @@ package Checker;
public class Foo {
public static void main(String[] args) {
- System.out.println("short");
+ System.out.println("hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
System.out.println();
System.out.println();
}
```
╰─$ **cat config-nofilter.xml**
```xml
```
╰─$ **cat config.xml**
```xml
```
Command:
`java -classpath checkstyle-13.6.0-all.jar:checkstyle-patchfilter-all.jar com.puppycrawl.tools.checkstyle.Main -c config-nofilter.xml Bar.java` shows
```
Starting audit...
[ERROR] /home/aclfe/Desktop/C1/testing/Bar.java:5: Line is longer than 80 characters (found 117). [LineLength]
Audit done.
Checkstyle ends with 1 errors.
```
`java -classpath checkstyle-13.6.0-all.jar:checkstyle-patchfilter-all.jar com.puppycrawl.tools.checkstyle.Main -c config.xml Bar.java`
shows
```
Starting audit...
Audit done.
```
---
You can see config-nofilter.xml shows the violation exists, but the filer config itself doesn't throw an error. The fix lies in `src/main/java/com/puppycrawl/tools/checkstyle/filters/LoadPatchFileUtils.java`
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the behavior with config-nofilter.xml, config.xml, rename.patch, and Bar.java using the two commands in the issue. Start in src/main/java/com/puppycrawl/tools/checkstyle/filters/LoadPatchFileUtils.java; done means renamed files still report violations on changed lines while the patch filter handles unaffected lines as intended.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100