-
-
Notifications
You must be signed in to change notification settings - Fork 766
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
Add exhaustiveness check for config validation #5089
Conversation
Codecov Report
@@ Coverage Diff @@
## main #5089 +/- ##
===========================================
+ Coverage 0 84.92% +84.92%
- Complexity 0 3613 +3613
===========================================
Files 0 502 +502
Lines 0 11886 +11886
Branches 0 2237 +2237
===========================================
+ Hits 0 10094 +10094
- Misses 0 689 +689
- Partials 0 1103 +1103
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
...in/io/gitlab/arturbosch/detekt/core/config/validation/DeprecatedPropertiesConfigValidator.kt
Show resolved
Hide resolved
...otlin/io/gitlab/arturbosch/detekt/core/config/validation/InvalidPropertiesConfigValidator.kt
Outdated
Show resolved
Hide resolved
And thanks for the refactor! This code looks way better now :) |
...-core/src/main/kotlin/io/gitlab/arturbosch/detekt/core/config/validation/ConfigValidation.kt
Outdated
Show resolved
Hide resolved
...ain/kotlin/io/gitlab/arturbosch/detekt/core/config/validation/AbstractYamlConfigValidator.kt
Outdated
Show resolved
Hide resolved
...otlin/io/gitlab/arturbosch/detekt/core/config/validation/InvalidPropertiesConfigValidator.kt
Outdated
Show resolved
Hide resolved
...ain/kotlin/io/gitlab/arturbosch/detekt/core/config/validation/MissingRulesConfigValidator.kt
Outdated
Show resolved
Hide resolved
...kotlin/io/gitlab/arturbosch/detekt/core/config/validation/AbstractYamlConfigValidatorSpec.kt
Fixed
Show fixed
Hide fixed
Do we want this feature or should I open a PR with just the refactoring? |
LGTM |
closes #4873
I know this is a completely different approach than originally outlined and quite a change set but it turned out that checking for exhaustiveness could just be a part of to already existing config validation. If this is not the direction we want to go, just let me know. It is totally fine.
Refactoring prior to adding the feature:
config/validation
.ValidateConfig.kt
) into separate config validators (one for invalid properties and one for deprecated properties)The feature itself:
checkExhaustiveness: false
to the config block in the detekt default configurationtrue
this flag is alsotrue
a new validator checks if all rules from the default configuration are mentioned in the user config (unless the entire rule set is marked asactive: false
)