violations-gradle-plugin icon indicating copy to clipboard operation
violations-gradle-plugin copied to clipboard

Allow Github PR Diff

Open winterDroid opened this issue 7 years ago • 2 comments

Thanks for the plugin, but it would be nice to be able to use a Github PR as a diff. If the a PR was branched off the target branch couple of days ago and the target branched changed quite a lot, the diff is still much bigger than the actual patch.

winterDroid avatar Jan 22 '18 11:01 winterDroid

If you refer to the PR being built in Travis, then Travis will always build the merge right? Not the source branch by its own. And if that merge is being built, all reported violations will refer to lines in that diff (source branch and target branch).

If you are building the feature-branch by its own, perhaps from can be the most recent ancestor of source and target branches, to can be source or just HEAD:

./gradlew check -PdiffFrom=`git merge-base target-branch source-branch` -PdiffTo=source-branch

tomasbjerre avatar Jan 22 '18 11:01 tomasbjerre

Mmh I used pull/<PR number>/merge to checkout the merged PR in diffFrom and the target branch in diffTo. But I'll try your proposal.

winterDroid avatar Jan 22 '18 12:01 winterDroid