-
Notifications
You must be signed in to change notification settings - Fork 280
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 withChecks #721
Support withChecks #721
Conversation
Codecov Report
@@ Coverage Diff @@
## master #721 +/- ##
============================================
+ Coverage 79.86% 79.88% +0.01%
- Complexity 1505 1506 +1
============================================
Files 241 241
Lines 5489 5493 +4
Branches 397 397
============================================
+ Hits 4384 4388 +4
Misses 945 945
Partials 160 160
Continue to review full report at Codecov.
|
@uhafner the Auto Assign PR check failed to auto assign PRs, so dropping you a quick ping in case you missed this otherwise. I'm not sure on the GitHub CI failure - looks environmental? |
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.
We also need to add that code in https://github.com/jenkinsci/warnings-ng-plugin/blob/master/plugin/src/main/java/io/jenkins/plugins/analysis/core/steps/RecordIssuesStep.java#L1071.
It will be a little bit more complicated since the FreeStyle recorder uses the same code in https://github.com/jenkinsci/warnings-ng-plugin/blob/master/plugin/src/main/java/io/jenkins/plugins/analysis/core/steps/IssuesRecorder.java#L753
String checksName = Optional.ofNullable(getContext().get(ChecksInfo.class)).map(ChecksInfo::getName).orElse(null); | ||
WarningChecksPublisher checksPublisher = new WarningChecksPublisher(action, getTaskListener(), checksName); |
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.
I would rather prefer it look like:
WarningChecksPublisher checksPublisher = new WarningChecksPublisher(action, getTaskListener(), getContext().get(ChecksInfo.class));
Then we can place the logic inside of WarningChecksPublisher
and reuse it for the recordIssues
step. (PublishIssuesStep
is a different step with the name publishIssues
).
|
||
WarningChecksPublisher(final ResultAction action, final TaskListener listener) { | ||
WarningChecksPublisher(final ResultAction action, final TaskListener listener, final String checksName) { |
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.
See above: parameter should be of type ChecksInfo
.
And do not add a second constructor since we need the same call for the IssueRecorder
(which is used by the recordIssues
step).
Ahh, I knew there was another place. With |
Tests for recordIssues to follow. |
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.
Thanks, this PR looks already great! I only found some minor things left to do.
plugin/src/main/java/io/jenkins/plugins/analysis/core/steps/IssuesRecorder.java
Show resolved
Hide resolved
@@ -591,6 +594,10 @@ public void setFilters(final List<RegexpFilter> filters) { | |||
this.filters = new ArrayList<>(filters); | |||
} | |||
|
|||
public void setChecksInfo(final ChecksInfo checksInfo) { |
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.
public void setChecksInfo(final ChecksInfo checksInfo) { | |
public void setChecksInfo(@CheckForNull final ChecksInfo checksInfo) { |
|
||
WarningChecksPublisher(final ResultAction action, final TaskListener listener) { | ||
WarningChecksPublisher(final ResultAction action, final TaskListener listener, final ChecksInfo checksInfo) { |
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.
WarningChecksPublisher(final ResultAction action, final TaskListener listener, final ChecksInfo checksInfo) { | |
WarningChecksPublisher(final ResultAction action, final TaskListener listener, @CheckForNull final ChecksInfo checksInfo) { |
plugin/src/main/java/io/jenkins/plugins/analysis/core/steps/WarningChecksPublisher.java
Show resolved
Hide resolved
WorkflowJob project = createPipeline(); | ||
copySingleFileToWorkspace(project, NEW_CHECKSTYLE_REPORT); |
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.
WorkflowJob project = createPipeline(); | |
copySingleFileToWorkspace(project, NEW_CHECKSTYLE_REPORT); | |
WorkflowJob project = createPipelineWithWorkspaceFiles(NEW_CHECKSTYLE_REPORT); |
The file name needs to be renamed automatically, otherwise it is not found.
|
||
List<ChecksDetails> publishedChecks = PUBLISHER_FACTORY.getPublishedChecks(); | ||
|
||
assertThat(publishedChecks.size()).isEqualTo(2); |
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.
assertThat(publishedChecks.size()).isEqualTo(2); | |
assertThat(publishedChecks).hasSize(2); // add a small comment why there are two results? |
This PR adds support for the
withChecks
step recently added to thechecks-api
plugin, that allows for customization of published checks names by context.