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

Suppress RedundantVisibilityModifierRule if explicit API mode enabled #3175

Merged
merged 2 commits into from
Oct 27, 2020

Conversation

schalkms
Copy link
Member

@schalkms schalkms commented Oct 26, 2020

Explicit API mode was added in Kotlin 1.4
It prevents library authors from making APIs public unintentionally.
In this mode, the visibility modifier should be defined explicitly even if it is public.
See: https://kotlinlang.org/docs/reference/whatsnew14.html#explicit-api-mode-for-library-authors

Closes #3125

Explicit API mode was added in Kotlin 1.4
It prevents libraries' authors from making APIs public unintentionally.
In this mode, the visibility modifier should be defined explicitly even if it is public.
See: https://kotlinlang.org/docs/reference/whatsnew14.html#explicit-api-mode-for-library-authors

Closes #3125
@codecov
Copy link

codecov bot commented Oct 26, 2020

Codecov Report

Merging #3175 into master will increase coverage by 0.11%.
The diff coverage is 80.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #3175      +/-   ##
============================================
+ Coverage     79.44%   79.56%   +0.11%     
- Complexity     2596     2611      +15     
============================================
  Files           437      439       +2     
  Lines          7818     7937     +119     
  Branches       1484     1512      +28     
============================================
+ Hits           6211     6315     +104     
- Misses          819      820       +1     
- Partials        788      802      +14     
Impacted Files Coverage Δ Complexity Δ
...ekt/rules/style/RedundantVisibilityModifierRule.kt 91.48% <80.00%> (-3.97%) 11.00 <2.00> (+2.00) ⬇️
...kt/rules/style/LibraryCodeMustSpecifyReturnType.kt 87.50% <0.00%> (-12.50%) 12.00% <0.00%> (-4.00%)
...lab/arturbosch/detekt/rules/style/MaxLineLength.kt 78.78% <0.00%> (-6.51%) 22.00% <0.00%> (-1.00%)
...urbosch/detekt/rules/performance/SpreadOperator.kt 81.25% <0.00%> (-5.71%) 12.00% <0.00%> (+4.00%) ⬇️
...rturbosch/detekt/rules/complexity/ComplexMethod.kt 94.11% <0.00%> (-2.76%) 13.00% <0.00%> (+1.00%) ⬇️
...b/arturbosch/detekt/rules/style/UseCheckOrError.kt 90.00% <0.00%> (-0.91%) 8.00% <0.00%> (ø%)
...n/io/github/detekt/report/html/HtmlOutputReport.kt 94.28% <0.00%> (-0.46%) 18.00% <0.00%> (-2.00%)
...in/io/gitlab/arturbosch/detekt/rules/style/Junk.kt 100.00% <0.00%> (ø) 0.00% <0.00%> (ø%)
...tlab/arturbosch/detekt/rules/naming/ClassNaming.kt 100.00% <0.00%> (ø) 5.00% <0.00%> (+1.00%)
...ab/arturbosch/detekt/rules/naming/PackageNaming.kt 100.00% <0.00%> (ø) 7.00% <0.00%> (+1.00%)
... and 15 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 c334513...91b25a0. Read the comment docs.

@@ -53,11 +55,21 @@ class RedundantVisibilityModifierRule(config: Config = Config.empty) : Rule(conf

private fun KtModifierListOwner.isExplicitlyPublic() = this.hasModifier(KtTokens.PUBLIC_KEYWORD)

/**
* Explicit API mode was added in Kotlin 1.4
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add a note in the KDoc on top of the file so it gets propagated in the generated documentation?

@schalkms schalkms merged commit 7b4fc73 into master Oct 27, 2020
@schalkms schalkms deleted the feature-#3125-ExplicitAPIMode branch October 27, 2020 10:46
@arturbosch arturbosch added this to the 1.15.0 milestone Nov 2, 2020
@chao2zhang
Copy link
Member

Thank you for making this change. I meant to report a new issue but found that this is already addressed!

arturbosch pushed a commit that referenced this pull request Nov 15, 2020
…#3175)

* Suppress RedundantVisibilityModifierRule if explicit API mode enabled

Explicit API mode was added in Kotlin 1.4
It prevents libraries' authors from making APIs public unintentionally.
In this mode, the visibility modifier should be defined explicitly even if it is public.
See: https://kotlinlang.org/docs/reference/whatsnew14.html#explicit-api-mode-for-library-authors

Closes #3125

* Add explicit API mode to rule documentation
arturbosch pushed a commit that referenced this pull request Dec 21, 2020
…#3175)

* Suppress RedundantVisibilityModifierRule if explicit API mode enabled

Explicit API mode was added in Kotlin 1.4
It prevents libraries' authors from making APIs public unintentionally.
In this mode, the visibility modifier should be defined explicitly even if it is public.
See: https://kotlinlang.org/docs/reference/whatsnew14.html#explicit-api-mode-for-library-authors

Closes #3125

* Add explicit API mode to rule documentation
arturbosch pushed a commit that referenced this pull request Jan 16, 2021
…#3175)

* Suppress RedundantVisibilityModifierRule if explicit API mode enabled

Explicit API mode was added in Kotlin 1.4
It prevents libraries' authors from making APIs public unintentionally.
In this mode, the visibility modifier should be defined explicitly even if it is public.
See: https://kotlinlang.org/docs/reference/whatsnew14.html#explicit-api-mode-for-library-authors

Closes #3125

* Add explicit API mode to rule documentation
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.

Suppress RedundantVisibilityModifierRule if explicit API mode enabled
4 participants