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
Create Rule Set For Libraries #5360
Conversation
4c1dfe6
to
964cb8f
Compare
964cb8f
to
b3e707c
Compare
Was this discussed already in the past? I'm fine with this change but maybe we should focus on having a 'library mode' which is effectively a set of config options aimed at libraries? |
Agree that's a better approach. The rules/"library mode" can then be dynamically enabled based on whether Kotlin's explicit API mode is enabled or not. |
Hello! |
We talk about this at #4940. Explicit api is not directly related with library development. It's true that it was designed for that use case but I use it on my daily basis. I consider that the major issue of kotlin is to make So, instead of trying to be "clever" about when to enable this rules it's better to move it to a different rule-set. I see two option here. And why to move it outside the default rule set and moving it to a first-party plugin? Because we try to fix #4940. Right now those rules have a really strange workaround so |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add the old rules as deprecated
so our users get notified that those rules were moved. To be more precisse. deprecate their old configuration.
Hardcoded strings of migrated rules are added to deprecation.properties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Hardcoded strings of migrated rules are added to deprecation.properties.
Include :detekt-rules-libraries project in the root build.gradle.kts
Codecov Report
@@ Coverage Diff @@
## main #5360 +/- ##
============================================
- Coverage 86.09% 86.02% -0.08%
+ Complexity 3637 3609 -28
============================================
Files 516 513 -3
Lines 12098 12019 -79
Branches 2156 2147 -9
============================================
- Hits 10416 10339 -77
- Misses 613 616 +3
+ Partials 1069 1064 -5
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
What could be wrong with
detekt/detekt-parser/src/main/kotlin/io/github/detekt/parser/DetektPomModel.kt Lines 29 to 31 in b6ad99d
|
It seems more a flaky execution. I just launch it again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 Let's include this inside RC2
@@ -0,0 +1,11 @@ | |||
libraries: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BraisGabin is this an internal file to Detekt, or ruleset plugin authors can also provide this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one targets library authors. I don't know if this one could be useful for plugin authors. I don't recall the name now but on this version we are going to add other rule set only for rule authors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I meant exactly this file, the config yml. Because src/main/resources will get packaged into the jar by default, and can be opened using a Class
. If this is only used for generating something internally, it might be better to move it out of this folder so it doesn't get delivered. So my question is if it's being used by some mechanism outside of docs generation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking forward to rules for rules! That's a great plugin we really need.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is only used for generating something internally, it might be better to move it out of this folder so it doesn't get delivered. So my question is if it's being used by some mechanism outside of docs generation.
This file is used when generating the default config file for the users as well as during validation, so it's definitelly needed and should be shipped
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you :)
What to do if setting these properties in
This happens for me when using the maven plugin, not gradle — see Ozsie/detekt-maven-plugin#169. Also, not like for |
Closes #4940
Create ruleset plugin for libraries.
Move the following rules to it: