Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Rule Set For Libraries (#5360)
- Loading branch information
1 parent
7cb2459
commit b620bd5
Showing
23 changed files
with
108 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
plugins { | ||
id("module") | ||
} | ||
|
||
dependencies { | ||
compileOnly(projects.detektApi) | ||
testImplementation(projects.detektTest) | ||
testImplementation(libs.assertj) | ||
} |
2 changes: 1 addition & 1 deletion
2
...t/rules/style/ForbiddenPublicDataClass.kt → ...ekt/libraries/ForbiddenPublicDataClass.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...style/LibraryCodeMustSpecifyReturnType.kt → ...aries/LibraryCodeMustSpecifyReturnType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...style/LibraryEntitiesShouldNotBePublic.kt → ...aries/LibraryEntitiesShouldNotBePublic.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...-libraries/src/main/kotlin/io/gitlab/arturbosch/detekt/libraries/RuleLibrariesProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package io.gitlab.arturbosch.detekt.libraries | ||
|
||
import io.gitlab.arturbosch.detekt.api.Config | ||
import io.gitlab.arturbosch.detekt.api.RuleSet | ||
import io.gitlab.arturbosch.detekt.api.RuleSetProvider | ||
import io.gitlab.arturbosch.detekt.api.internal.ActiveByDefault | ||
|
||
/** | ||
* Rules in this rule set report issues related to libraries API exposure. | ||
*/ | ||
@ActiveByDefault("1.16.0") | ||
class RuleLibrariesProvider : RuleSetProvider { | ||
|
||
override val ruleSetId: String = "libraries" | ||
|
||
override fun instance(config: Config) = RuleSet( | ||
ruleSetId, | ||
listOf( | ||
ForbiddenPublicDataClass(config), | ||
LibraryEntitiesShouldNotBePublic(config), | ||
LibraryCodeMustSpecifyReturnType(config), | ||
) | ||
) | ||
} |
1 change: 1 addition & 0 deletions
1
...ries/src/main/resources/META-INF/services/io.gitlab.arturbosch.detekt.api.RuleSetProvider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
io.gitlab.arturbosch.detekt.libraries.RuleLibrariesProvider |
11 changes: 11 additions & 0 deletions
11
detekt-rules-libraries/src/main/resources/config/config.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
libraries: | ||
active: true | ||
ForbiddenPublicDataClass: | ||
active: true | ||
ignorePackages: | ||
- '*.internal' | ||
- '*.internal.*' | ||
LibraryCodeMustSpecifyReturnType: | ||
active: true | ||
LibraryEntitiesShouldNotBePublic: | ||
active: true |
2 changes: 1 addition & 1 deletion
2
...les/style/ForbiddenPublicDataClassSpec.kt → ...libraries/ForbiddenPublicDataClassSpec.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...e/LibraryCodeMustSpecifyReturnTypeSpec.kt → ...s/LibraryCodeMustSpecifyReturnTypeSpec.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...e/LibraryEntitiesShouldNotBePublicSpec.kt → ...s/LibraryEntitiesShouldNotBePublicSpec.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters