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

Remove aliases from Rule api #7312

Merged
merged 6 commits into from
May 22, 2024
Merged

Remove aliases from Rule api #7312

merged 6 commits into from
May 22, 2024

Conversation

BraisGabin
Copy link
Member

@BraisGabin BraisGabin commented May 19, 2024

The aliases are a really cool feature from detekt. But we can put that information in the configuration instead of the actual code of the rule.

This PR removes aliases and getDefaultRuleIdAliases from Rule in favor of the annotation @Alias. Also this fixes an issue in our documentation. Some rules were not displaying their aliases, for example: FunctionNameMaxLength:

Before: https://detekt.dev/docs/rules/naming#functionmaxlength
After: https://detekt-4art7d1zf-detekt.vercel.app/docs/next/rules/naming#functionnamemaxlength

This new implementation fix that and should prevent future errors.

Copy link

codecov bot commented May 19, 2024

Codecov Report

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

Project coverage is 84.73%. Comparing base (f92f8ab) to head (344d5be).
Report is 8 commits behind head on main.

Files Patch % Lines
...urbosch/detekt/generator/collection/RuleVisitor.kt 66.66% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7312      +/-   ##
============================================
- Coverage     84.76%   84.73%   -0.03%     
+ Complexity     3992     3967      -25     
============================================
  Files           578      575       -3     
  Lines         12026    11996      -30     
  Branches       2477     2478       +1     
============================================
- Hits          10194    10165      -29     
+ Misses          606      598       -8     
- Partials       1226     1233       +7     

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

@BraisGabin BraisGabin marked this pull request as draft May 19, 2024 13:19
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.

I like this one! 👍

Perhaps the only thing to add is some documentation to the website as not aliases is a configurable key that users can override via the config file.

@BraisGabin BraisGabin changed the title Remove aliases from Ruleapi Remove aliases from Rule api May 20, 2024
@BraisGabin BraisGabin added this to the 2.0.0 milestone May 20, 2024
@BraisGabin BraisGabin added the breaking change Marker for breaking changes which should be highlighted in the changelog label May 20, 2024
@detekt-ci
Copy link
Collaborator

Warnings
⚠️

It looks like you're editing the un-versioned copy of our website. This affects only users on the 'next' version of detekt, and it's correct only if you intend to document a future change or feature. If you intended to make a change also for the current version of detekt, please make sure you edit the equivalent file inside website/versioned_docs/ as well.

Generated by 🚫 dangerJS against 344d5be

@BraisGabin
Copy link
Member Author

Perhaps the only thing to add is some documentation to the website as not aliases is a configurable key that users can override via the config file.

Good call! I added the documentation, what do you think?

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.

LGTM 🚀

@BraisGabin BraisGabin merged commit f4f074d into main May 22, 2024
21 checks passed
@BraisGabin BraisGabin deleted the aliases branch May 22, 2024 11:48
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 core documentation formatting rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants