Hi ,
1) Checkstlye works only with whole java file, that file have to be compilable.
2)
You can take from diff a paths to affected files and line numbers
$ git diff
diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/CheckStyleTask.java
b/src/main/java/com/puppycrawl/tools/checkstyle/CheckStyleTask.java
index a08123a..33c291e 100644
--- a/src/main/java/com/puppycrawl/tools/checkstyle/CheckStyleTask.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/CheckStyleTask.java
@@ -582,6 +582,11 @@ public class CheckStyleTask extends Task
return new DefaultLogger(new FileOutputStream(toFile), true);
}
+ @Override
+ protected void finalize() throws Throwable {
+ super.finalize();
+ }
+
/**
* @return an XMLLogger instance
* @param task the task to possibly log to
3) you need to run checkstyle against that files, no need to run against whole project
4) you need to generate a suppresion file that will ignore all violations on lines that are other then referenced in git dif.
Example:
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
<suppressions>
<suppress checks=".*"
files="src/main/java/com/puppycrawl/tools/checkstyle/CheckStyleTask.java"
lines="1-582, 586-10000000"/>
</suppressions>
thanks,
Roman Ivanov