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

JENKINS-56700 and JENKINS-56701 #153

Merged
merged 12 commits into from
Apr 18, 2019
Merged

Conversation

HmSebastianH
Copy link
Contributor

Updated two Parsers to use the LookaheadParser class instead of a deprecated base class.
Both Tickets are handled in one pull request to avoid updating the Versioning twice for similar changes.

@HmSebastianH HmSebastianH marked this pull request as ready for review April 10, 2019 11:35
@HmSebastianH
Copy link
Contributor Author

@TobiasSchaffner könntest du den PR reviewn?

@codecov
Copy link

codecov bot commented Apr 10, 2019

Codecov Report

Merging #153 into master will increase coverage by 0.03%.
The diff coverage is 90.9%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #153      +/-   ##
============================================
+ Coverage     88.51%   88.54%   +0.03%     
- Complexity     1235     1241       +6     
============================================
  Files           158      158              
  Lines          3937     3965      +28     
  Branches        424      431       +7     
============================================
+ Hits           3485     3511      +26     
  Misses          296      296              
- Partials        156      158       +2
Impacted Files Coverage Δ Complexity Δ
.../edu/hm/hafner/analysis/parser/GhsMultiParser.java 93.33% <88.88%> (+8.71%) 4 <3> (+1) ⬆️
...du/hm/hafner/analysis/parser/GnuFortranParser.java 92.1% <91.42%> (-7.9%) 9 <9> (+5)

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 e646003...f82f753. Read the comment docs.

pom.xml Outdated Show resolved Hide resolved
Copy link
Contributor

@TobiasSchaffner TobiasSchaffner left a comment

Choose a reason for hiding this comment

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

Some nitpicking but overall this is looking fine to me. I fear you will have to do something against the lower code coverage to get this approved. Maybe it is a good idea to cut the createIssue method in the GnuFortranParser into pieces for lower complexity and easier testing.

// This does not match the whole message, return without issue.
return Optional.empty();
}
String currentLine = lookahead.peekNext();
Copy link
Contributor

Choose a reason for hiding this comment

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

It is possible to simplify this by calling next() here as well as in line 80 and removing line 76 completely, isn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

peekNext is used to avoid consuming lines which are not matched by the parser. If next is used and the parser determines that the line did not match the message currently being parsed the start of another message might be lost.
Using next() everywhere would make the code easier to read / better to understand, but could lead to some unexpected behaviour in edge casses.

Copy link
Member

Choose a reason for hiding this comment

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

You can use hasNext(String) to simplify this

// This does not match the whole message, return without issue.
return Optional.empty();
}
String currentLine = lookahead.peekNext();
Copy link
Member

Choose a reason for hiding this comment

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

You can use hasNext(String) to simplify this

@HmSebastianH
Copy link
Contributor Author

@uhafner thanks for the feedback.
I implemented the changes you suggested.

@uhafner uhafner merged commit e9f972e into jenkinsci:master Apr 18, 2019
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

Successfully merging this pull request may close these issues.

3 participants