Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] How to use diffing? #15

Open
sgrekov opened this issue Apr 23, 2021 · 5 comments
Open

[Question] How to use diffing? #15

sgrekov opened this issue Apr 23, 2021 · 5 comments

Comments

@sgrekov
Copy link

sgrekov commented Apr 23, 2021

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?

@tomasbjerre
Copy link
Owner

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.

@sgrekov
Copy link
Author

sgrekov commented Apr 30, 2021

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(

@tomasbjerre
Copy link
Owner

This works:

./gradlew violations -i -PdiffTo=diff_check -PdiffFrom=master

But I agree that the from/to seems more logical in your command!

@sgrekov
Copy link
Author

sgrekov commented May 2, 2021

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?

@tomasbjerre
Copy link
Owner

Yes should probably be opposite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants