[Question] How to use diffing?
Hi!
First of all, thank you for the library, it looks great! I am trying diffing feature, and I cannot make it work with the provided sample.
I created a new branch https://github.com/sgrekov/violations-gradle-plugin/commits/diff_check and made a changes to report, and try to run diff command.
./gradlew violations -i -PdiffFrom=35f88688c8049558da9b408519cc5e52c9d7099c -PdiffTo=aca1d7232ba2fdc8c8b1c393dbfa7a47fd9dc6b5
The expected outcome for me is that this task will finish with failure, but it is not, it only show violations from the report and finished with success. Am I missing something? Or maybe I am using it wrong?
This code may help understand it: https://github.com/tomasbjerre/violations-git-lib/blob/master/src/main/java/se/bjurr/violations/git/ViolationsGit.java
It will parse git commits to find the files that differ. And count reported errors on changed lines in those files.
You would need to change the files also, not only the report-files.
So that means that in order diff start complaining about violations relative to branch 'git diff ' command must contain references to those files?
I added files to the branches(and changed paths in reports accordingly) and try to run
./gradlew violations -i -PdiffTo=master -PdiffFrom=diff_check
and still no luck(
This works:
./gradlew violations -i -PdiffTo=diff_check -PdiffFrom=master
But I agree that the from/to seems more logical in your command!
Hmm, isn't it the way it supposed to work? According to your comments in the build file
./gradlew check -PdiffFrom=$TRAVIS_PULL_REQUEST_BRANCH -PdiffTo=$TRAVIS_BRANCH
it should be the opposite, no?
Yes should probably be opposite.