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

Make findings a List<Finding2> instead of a Map<RuleSet.Id, List<Finding2>> #6884

Merged
merged 4 commits into from
Apr 7, 2024

Conversation

BraisGabin
Copy link
Member

This change simplifies a lot Detektion and all their related code. We were using Map<RuleSet.Id, List<Finding2>> as the only way to carry the RuleSet.Id of a finding. Now we have that information inside Finding2 so we don't need this Map anymore.

You can see that a lot of reports were just flattening that map because they don't need it. And the ones that really need it now it is as simple as add a findings.groupBy { it.rule.ruleSetId }.

We should even check if we need to sort the findings at the core level. But I didn't want to touch that part right now.

Copy link

codecov bot commented Jan 18, 2024

Codecov Report

Attention: Patch coverage is 80.55556% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 83.80%. Comparing base (f0e7d91) to head (5812e77).

Files Patch % Lines
...otlin/io/gitlab/arturbosch/detekt/core/Analyzer.kt 54.54% 3 Missing and 2 partials ⚠️
...gitlab/arturbosch/detekt/api/ReportingExtension.kt 0.00% 1 Missing ⚠️
...tlab/arturbosch/detekt/core/reporting/Reporting.kt 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6884      +/-   ##
============================================
- Coverage     83.89%   83.80%   -0.10%     
+ Complexity     3939     3930       -9     
============================================
  Files           577      577              
  Lines         12109    12070      -39     
  Branches       2485     2476       -9     
============================================
- Hits          10159    10115      -44     
- Misses          722      729       +7     
+ Partials       1228     1226       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@BraisGabin BraisGabin added this to the 2.0.0 milestone Jan 18, 2024
@BraisGabin BraisGabin added the breaking change Marker for breaking changes which should be highlighted in the changelog label Jan 18, 2024
@BraisGabin BraisGabin changed the title Make findings a List<Finding2> isntead of a Map<RuleSet.Id, List<Finding2>> Make findings a List<Finding2> instead of a Map<RuleSet.Id, List<Finding2>> Jan 21, 2024
@BraisGabin BraisGabin force-pushed the add-rulesetid-to-finding branch 2 times, most recently from 1081af3 to b9b2f10 Compare February 2, 2024 13:06
@BraisGabin BraisGabin force-pushed the add-rulesetid-to-finding branch 2 times, most recently from 8707345 to 7efed9b Compare March 24, 2024 13:00
Base automatically changed from add-rulesetid-to-finding to main March 24, 2024 13:16
@BraisGabin BraisGabin marked this pull request as ready for review March 26, 2024 08:24
Copy link
Member

@cortinico cortinico left a comment

Choose a reason for hiding this comment

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

Amazing cleanup! Just one minor nit

@BraisGabin BraisGabin force-pushed the remove-Map-from-detektion branch 2 times, most recently from f83a97c to d7d0bda Compare April 7, 2024 20:22
…er/plugin/internal/MessageCollectorExtensions.kt

Co-authored-by: Nicola Corti <corti.nico@gmail.com>
@BraisGabin BraisGabin enabled auto-merge (squash) April 7, 2024 20:22
@BraisGabin BraisGabin merged commit dda3a11 into main Apr 7, 2024
20 of 21 checks passed
@BraisGabin BraisGabin deleted the remove-Map-from-detektion branch April 7, 2024 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api breaking change Marker for breaking changes which should be highlighted in the changelog compiler-plugin core reports
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants