Skip to content

add better documentation for the LongParameterList ignoreAnnotated #2714

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

Merged
merged 3 commits into from
Jun 1, 2020

Conversation

kenyee
Copy link
Contributor

@kenyee kenyee commented May 21, 2020

From Kotlinlang slack discussion:
https://kotlinlang.slack.com/archives/C88E12QH4/p1589836335126300

Wasn't obvious that ignoreAnnotated should include a CSV list of class names. Updated documentation to mention that and added an example.

@codecov
Copy link

codecov bot commented May 21, 2020

Codecov Report

Merging #2714 into master will decrease coverage by 0.07%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2714      +/-   ##
============================================
- Coverage     80.52%   80.45%   -0.08%     
+ Complexity     2322     2303      -19     
============================================
  Files           378      378              
  Lines          6944     6954      +10     
  Branches       1258     1262       +4     
============================================
+ Hits           5592     5595       +3     
- Misses          725      729       +4     
- Partials        627      630       +3     
Impacted Files Coverage Δ Complexity Δ
...bosch/detekt/rules/complexity/LongParameterList.kt 87.80% <ø> (ø) 23.00 <0.00> (ø)
...ain/kotlin/io/gitlab/arturbosch/detekt/cli/Main.kt 31.81% <0.00%> (-18.19%) 5.00% <0.00%> (-6.00%)
...itlab/arturbosch/detekt/extensions/DetektReport.kt 7.14% <0.00%> (-7.15%) 1.00% <0.00%> (-1.00%)
.../io/gitlab/arturbosch/detekt/cli/runners/Runner.kt 89.36% <0.00%> (-4.64%) 9.00% <0.00%> (-1.00%)
.../main/kotlin/io/gitlab/arturbosch/detekt/Detekt.kt 30.26% <0.00%> (-3.95%) 16.00% <0.00%> (-3.00%)
...turbosch/detekt/rules/style/ForbiddenMethodCall.kt 83.33% <0.00%> (-3.34%) 5.00% <0.00%> (ø%)
.../io/gitlab/arturbosch/detekt/cli/IssueExtension.kt 88.88% <0.00%> (-1.12%) 0.00% <0.00%> (ø%)
...ain/kotlin/io/gitlab/arturbosch/detekt/api/Rule.kt 93.33% <0.00%> (ø) 13.00% <0.00%> (ø%)
.../kotlin/io/gitlab/arturbosch/detekt/api/RuleSet.kt 27.27% <0.00%> (ø) 1.00% <0.00%> (ø%)
.../kotlin/io/gitlab/arturbosch/detekt/cli/CliArgs.kt 100.00% <0.00%> (ø) 8.00% <0.00%> (ø%)
... and 110 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5926d84...ae2c0f2. Read the comment docs.

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.

Thanks for improving the docs and taking the time to submit a PR!
The docs are automatically generated from the rule description.
The corresponding rule needs to be updated first.

https://github.com/detekt/detekt/blob/master/detekt-rules/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/complexity/LongParameterList.kt

@kenyee
Copy link
Contributor Author

kenyee commented May 21, 2020

The docs are automatically generated from the rule description.
The corresponding rule needs to be updated first.

Thanks...that wasn't obvious :-)

* annotation class names (default: `[]`)
* annotation class names (default: `[]`); (value is a comma separated string with the annotation class names);
* the most common case is for Dagger constructors that are annotated with @Inject which would be specified
* with `Inject` (quotes are required)
Copy link
Member

Choose a reason for hiding this comment

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

I think that the ` are not needed. They should not at least. And instead of use csv you can use [Inject, Module, Suppress] or, if you prefer ['Inject', 'Module', 'Suppress']. Or yml even allow you to do this:

ignoreAnnotated:
  - Inject
  - Module
  - Suppress

Anyway, I agree that we should improve our documentation to say what's the expected value for each parameter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm..in other parts of our config file, we do stuff like this:
exceptions: 'IllegalArgumentException,IllegalStateException,IOException'
and
excludes: "/test/,/androidTest/,/*.Test.kt,/.Spec.kt,**/.Spek.kt"

The docs probably need a section on specifying lists of values that this config param description could link to. I didn't realize it was just a regular YAML parser or that you could specify strings w/o quotes in YAML :-)
Is there a preferred way of filling out these multivalue fields?

Copy link
Member

@arturbosch arturbosch Jun 1, 2020

Choose a reason for hiding this comment

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

@BraisGabin recently added the support for the normal yaml list syntax for rule properties (which is more readable imo).
We should totally encourage users to use this syntax.

Comma separated values will still be supported for a very long time.

@arturbosch arturbosch added this to the 1.10.0 milestone May 25, 2020
@arturbosch arturbosch merged commit d672a1a into detekt:master Jun 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants