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

Provide affected lines for code delta #404

Merged
merged 5 commits into from
Mar 9, 2022

Conversation

fo-code
Copy link
Contributor

@fo-code fo-code commented Mar 8, 2022

I expanded the code delta API that it also provides the affected lines, which will be changed by a new commit, as they were before the change has been made.

@codecov
Copy link

codecov bot commented Mar 8, 2022

Codecov Report

Merging #404 (1112569) into master (60fd4a7) will increase coverage by 0.29%.
The diff coverage is 100.00%.

❗ Current head 1112569 differs from pull request most recent head 755b4ed. Consider uploading reports for the commit 755b4ed to get more accurate results

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #404      +/-   ##
============================================
+ Coverage     68.44%   68.74%   +0.29%     
- Complexity      365      369       +4     
============================================
  Files            48       48              
  Lines          1160     1171      +11     
  Branches        100      100              
============================================
+ Hits            794      805      +11     
  Misses          325      325              
  Partials         41       41              
Impacted Files Coverage Δ
.../jenkins/plugins/forensics/delta/model/Change.java 100.00% <100.00%> (ø)

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 60fd4a7...755b4ed. Read the comment docs.

@uhafner uhafner added the enhancement Enhancement of existing functionality label Mar 9, 2022
public Change(final ChangeEditType changeEditType, final int fromLine, final int toLine) {
this.changeEditType = changeEditType;
this.fromLine = fromLine;
this.toLine = toLine;
}

/**
Copy link
Member

Choose a reason for hiding this comment

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

Use this(...) to initialize the deprecated constructor

Change change = createChange();
assertThat(change.getEditType()).isEqualTo(EDIT_TYPE);
assertThat(change.getChangedFromLine()).isEqualTo(CHANGED_FROM_LINE);
Copy link
Member

Choose a reason for hiding this comment

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

It would be more fluent if you could use the custom assertions. So:

Suggested change
assertThat(change.getChangedFromLine()).isEqualTo(CHANGED_FROM_LINE);
assertThat(change).hasChangedFromLine(CHANGED_FROM_LINE)
.hasChangedToLine(...)
...;

@uhafner uhafner merged commit adecbf0 into jenkinsci:master Mar 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants