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

Use category if type is empty when publishing checks #1317

Merged
merged 2 commits into from
Jul 26, 2022

Conversation

JoC0de
Copy link
Contributor

@JoC0de JoC0de commented Jul 23, 2022

When using ChecksPublisher to publish warnings generated by MsBuild, the annotations title is mostly empty (-) because MsBuild parser creates issues with only a category when it can't determine both the issue category and the issue type.
So the real problem is that the MsBuild parser misuses the issue 'category' but I think changing it would be a brackig change (e.g. breaks issue filters) and only changing the 'visualization' is the 'safer' way. And eventually there are other parsers that have the same 'problem' and this way the user gets more information about the issue.

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@codecov
Copy link

codecov bot commented Jul 23, 2022

Codecov Report

Merging #1317 (9f6e75c) into master (bb966a9) will decrease coverage by 0.00%.
The diff coverage is 80.00%.

@@             Coverage Diff              @@
##             master    #1317      +/-   ##
============================================
- Coverage     79.68%   79.68%   -0.01%     
- Complexity     1444     1446       +2     
============================================
  Files           249      249              
  Lines          5528     5532       +4     
  Branches        425      426       +1     
============================================
+ Hits           4405     4408       +3     
  Misses          974      974              
- Partials        149      150       +1     
Impacted Files Coverage Δ
...ns/analysis/core/steps/WarningChecksPublisher.java 97.39% <80.00%> (-0.81%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us.

@JoC0de JoC0de force-pushed the feature/check-api-use-category-name branch from 57422ba to a911927 Compare July 24, 2022 08:33
ChecksDetails details = publisher.extractChecksDetails(AnnotationScope.PUBLISH_NEW_ISSUES);

assertThat(details.getOutput().get().getChecksAnnotations().get(0))
.hasFieldOrPropertyWithValue("title", Optional.of("C4101"));
Copy link
Member

Choose a reason for hiding this comment

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

C4101 seems to be a strange category, shouldn't this be the type actually? Maybe that is the root cause...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes as I written in the description most of the MsBuild warnings have no type and only a category. The MsBuild parser sets the category instead of the type, when no category is provided. But changing the MsBuild parser would be a breaking change, or would you prefer to fix the issue inside the MsBuld parser?

Copy link
Member

Choose a reason for hiding this comment

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

I think you change here makes sense anyway as some other parsers might have an empty type as well.

But in general it would also make sense to reconsider the existing implementation of the MsBuild parser and see if the mapping can be improved. I'm using it not on my own so I am not sure if such a change would be helpful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Issue category and type are both shown inside the "issue view". The other use case I am aware of is ignoring / filtering issues, where its only a mater of configuration. But at least its a little confusing.

@JoC0de JoC0de force-pushed the feature/check-api-use-category-name branch from a911927 to f4e6cd7 Compare July 24, 2022 16:56
@JoC0de JoC0de force-pushed the feature/check-api-use-category-name branch from f4e6cd7 to 56b2ee3 Compare July 24, 2022 23:09
…rningChecksPublisherITest.java


Fix CheckStyle suppression.
@uhafner uhafner added the enhancement Enhancement of existing functionality label Jul 26, 2022
@uhafner uhafner changed the title Checks publisher fallback to issue category if type is empty Use category if type is empty when publishing checks Jul 26, 2022
@uhafner uhafner merged commit ae60678 into jenkinsci:master Jul 26, 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