-
Notifications
You must be signed in to change notification settings - Fork 61
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
Support ignore deletions with "ignore_line_deletions" param #71
Conversation
Could we have two settings:
Depending on the project, line deletions from modified files does require review efforts, so we do need to count lines from modified files but not from deleted files. In such case |
Thanks for the feedback, I think this is a great distinction and something I can incorporate. I could see why ignoring file deletions alone could prove valuable. |
ee92b38
to
e7ddbea
Compare
Test files_to_ignore code path Tweak the variable type Correct bad logic in the file ignore block Debug More debugging More debugging Fingers crossed Another try Last try Lets see if this one does it Testing again More tests More testing Last test Wait, I might be onto something Put some changes back Fixes Whoops Walk back yml test
e7ddbea
to
c6dc97a
Compare
@OnkarRuikar to prevent this PR from getting any larger, I'm going to implement the This current change has test updates, refactoring, and a new feature, so I want to stop here for now. |
if [[ "$pull_request_number" != "null" ]]; then | ||
echo "$pull_request_number" | ||
else | ||
echo "Not a pull request event" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this code block would've saved me so much time while I was testing this. I was testing on push events and was getting very obscure errors. 🙃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some non-blocking comments 😊
src/github.sh
Outdated
_jq() { | ||
echo ${file} | base64 -d | jq -r ${1} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not reusing jq::base64
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh shoot, didn't realize this helper was already available. Will use!
Co-authored-by: Javier Ferrer González <[email protected]>
What type of PR is this? (check all applicable)
Description
Some users prefer to not include file line deletions in the total line change count. I'm allowing this by way of a new config variable
ignore_line_deletions
which defaults tofalse
.By request I may add another variable
ignore_file_deletions
which would not count files which are completely deleted. This will most likely come as a followup change.Notes to Reviewer
This required I break up the
changes
variable in the PR files loop intoadditions
anddeletions
. This makes the code more consistent between the if and else blocks in thecalculate_total_modifications
method.How to test
I ensured that all four possible code paths were tested.
files_to_ignore
(set or not) xignore_line_deletions
(true/false).In the process of adding these tests, I added an example response for the pull request API. This was missing.
Link to issues addressed