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 ignoreOverridden config from BooleanPropertyNaming etc. #5718

Merged
merged 12 commits into from Feb 25, 2023

Conversation

drawers
Copy link
Contributor

@drawers drawers commented Jan 21, 2023

Fixes #5600 where it was agreed to remove ignoreOverridden from 5 rules:

  1. BooleanPropertyNaming
  2. ConstructorParameterNaming
  3. FunctionNaming
  4. VariableNaming
  5. FunctionParameterNaming

@github-actions github-actions bot added the rules label Jan 21, 2023
@drawers drawers changed the title Remove ignoreOverridden config from BooleanPropertyNaming Remove ignoreOverridden config from BooleanPropertyNaming etc. Jan 21, 2023
@codecov
Copy link

codecov bot commented Jan 21, 2023

Codecov Report

Merging #5718 (ba2cc61) into main (6d7e7e6) will decrease coverage by 0.01%.
The diff coverage is 80.00%.

@@             Coverage Diff              @@
##               main    #5718      +/-   ##
============================================
- Coverage     84.59%   84.59%   -0.01%     
+ Complexity     3790     3776      -14     
============================================
  Files           546      546              
  Lines         12918    12916       -2     
  Branches       2268     2268              
============================================
- Hits          10928    10926       -2     
  Misses          861      861              
  Partials       1129     1129              
Impacted Files Coverage Δ
...sch/detekt/rules/naming/FunctionParameterNaming.kt 89.28% <0.00%> (ø)
...bosch/detekt/rules/naming/BooleanPropertyNaming.kt 94.11% <100.00%> (-0.17%) ⬇️
.../detekt/rules/naming/ConstructorParameterNaming.kt 88.57% <100.00%> (-0.32%) ⬇️
...b/arturbosch/detekt/rules/naming/FunctionNaming.kt 100.00% <100.00%> (ø)
...b/arturbosch/detekt/rules/naming/VariableNaming.kt 88.57% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@schalkms schalkms left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks for tidying up!

@schalkms
Copy link
Member

schalkms commented Feb 5, 2023

@BraisGabin do you want to review this, since you brought up this improvement?

Copy link
Member

@BraisGabin BraisGabin left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! And sorry for the late review. If you could fix what I point out in my other comment we can merge this.

@@ -36,9 +36,6 @@ class BooleanPropertyNaming(config: Config = Config.empty) : Rule(config) {
@Configuration("naming pattern")
private val allowedPattern: Regex by config("^(is|has|are)", String::toRegex)

@Configuration("ignores properties that have the override modifier")
private val ignoreOverridden: Boolean by config(true)
Copy link
Member

Choose a reason for hiding this comment

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

This is a "breaking change". It is not in the "normal way" but we treat the yaml configuration as part of our public API.

Instead of removing the property, just keep it and add it this annotation @Deprecated("This configuration is ignored") (I'm not inspired with my descriptions feel free to improve it).

Other option is to add the deprecation atio.gitlab.arturbosch.detekt.generator.printer.writeMigratedRules. This way we keep the code clean.

What bothe options does is to keep detekt-core/src/main/resources/deprecation.properties up to date with old the deprecations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, that's a clever way to manage deprecation. I have assumed that between the two ways of doing things you have stated, the first way is cleaner because the code is kept in sync with the deprecation.properties.

I just need to rebase this on the latest main before we review again. I will ping later today when it is ready 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @BraisGabin I think this is ready for you to have another look at now

@BraisGabin BraisGabin added this to the 1.23.0 milestone Feb 21, 2023
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

detekt found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.

Copy link
Member

@BraisGabin BraisGabin left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM

@BraisGabin BraisGabin merged commit 2e703f0 into detekt:main Feb 25, 2023
@cortinico cortinico added the notable changes Marker for notable changes in the changelog label Feb 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notable changes Marker for notable changes in the changelog rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate ignoreOverridden in name rules
4 participants