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

fix: handle addition-only and deletion-only changes #144

Merged
merged 5 commits into from
Oct 9, 2020

Conversation

chingor13
Copy link
Contributor

When partitioning valid hunks from invalid hunks, if we detect addition-only or deletion-only changes, modify the hunk to include the previous or next line after the change (assuming it still fits in the valid commentable lines).

Fixes #126
Fixes #127

@chingor13 chingor13 requested a review from a team October 8, 2020 20:55
@chingor13 chingor13 requested a review from a team as a code owner October 8, 2020 20:55
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Oct 8, 2020
@codecov
Copy link

codecov bot commented Oct 8, 2020

Codecov Report

Merging #144 into master will increase coverage by 0.58%.
The diff coverage is 99.01%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #144      +/-   ##
==========================================
+ Coverage   86.30%   86.88%   +0.58%     
==========================================
  Files          41       43       +2     
  Lines        3986     4178     +192     
  Branches      311      339      +28     
==========================================
+ Hits         3440     3630     +190     
- Misses        538      540       +2     
  Partials        8        8              
Impacted Files Coverage Δ
...nt-handler/get-hunk-scope-handler/scope-handler.ts 96.52% <96.55%> (-0.15%) ⬇️
src/github-handler/diff-utils.ts 97.36% <100.00%> (+0.49%) ⬆️
src/github-handler/hunk-utils.ts 100.00% <100.00%> (ø)
src/types/index.ts 98.26% <100.00%> (+0.02%) ⬆️
...nt-handler/get-hunk-scope-handler/scope-handler.ts 96.52% <0.00%> (-0.15%) ⬇️
...er/code-suggester/src/github-handler/hunk-utils.ts 100.00% <0.00%> (ø)
...a/code-suggester/code-suggester/src/types/index.ts 98.26% <0.00%> (+0.02%) ⬆️
...er/code-suggester/src/github-handler/diff-utils.ts 97.36% <0.00%> (+0.49%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 662391f...ae1ed70. Read the comment docs.

@chingor13 chingor13 requested a review from bcoe October 9, 2020 00:31
expect(invalidHunks.size).to.equal(0);
});

it('allows an addition only suggestion at the beginning of the range', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests are looking really solid, excited to see this moving forward 👍

@bcoe bcoe added the cla: yes This human has signed the Contributor License Agreement. label Oct 9, 2020
@gcf-merge-on-green gcf-merge-on-green bot merged commit ab936a2 into googleapis:master Oct 9, 2020
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

review: cannot handle deletion only suggestions review: cannot handle addition only suggestions
2 participants