Skip to content

Suppress RedundantVisibilityModifierRule if explicit API mode enabled - #3358

Merged
schalkms merged 2 commits into
detekt:masterfrom
schalkms:fix-#3125-RedundantVisibilityModifier
Jan 10, 2021
Merged

Suppress RedundantVisibilityModifierRule if explicit API mode enabled#3358
schalkms merged 2 commits into
detekt:masterfrom
schalkms:fix-#3125-RedundantVisibilityModifier

Conversation

@schalkms

@schalkms schalkms commented Jan 7, 2021

Copy link
Copy Markdown
Member

This solution uses the languageVersionSettings of the compiler to fetch the API mode setting.

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

This solution uses the languageVersionSettings of the compiler to fetch the API mode setting.

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

codecov Bot commented Jan 7, 2021

Copy link
Copy Markdown

Codecov Report

Merging #3358 (3153deb) into master (da372a7) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #3358      +/-   ##
============================================
+ Coverage     80.27%   80.30%   +0.02%     
- Complexity     2713     2716       +3     
============================================
  Files           445      445              
  Lines          8194     8196       +2     
  Branches       1558     1559       +1     
============================================
+ Hits           6578     6582       +4     
  Misses          778      778              
+ Partials        838      836       -2     
Impacted Files Coverage Δ Complexity Δ
...ekt/rules/style/RedundantVisibilityModifierRule.kt 95.91% <100.00%> (+4.42%) 14.00 <3.00> (+3.00)

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 da372a7...3153deb. Read the comment docs.

@schalkms
schalkms merged commit cb8bdae into detekt:master Jan 10, 2021
@schalkms
schalkms deleted the fix-#3125-RedundantVisibilityModifier branch January 10, 2021 17:06
arturbosch pushed a commit that referenced this pull request Jan 16, 2021
…#3358)

* Suppress RedundantVisibilityModifierRule if explicit API mode enabled

This solution uses the languageVersionSettings of the compiler to fetch the API mode setting.

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

* Declare variables in Spec as memoized
@arturbosch arturbosch added this to the 1.16.0 milestone Jan 18, 2021
This was referenced Mar 11, 2021
This was referenced Mar 11, 2021
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

3 participants