-
-
Notifications
You must be signed in to change notification settings - Fork 757
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
Add wrapper for KtLint rules #6037
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
15 changes: 15 additions & 0 deletions
15
...formatting/src/main/kotlin/io/gitlab/arturbosch/detekt/formatting/wrappers/ClassNaming.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,15 @@ | ||
package io.gitlab.arturbosch.detekt.formatting.wrappers | ||
|
||
import com.pinterest.ktlint.ruleset.standard.rules.ClassNamingRule | ||
import io.gitlab.arturbosch.detekt.api.Config | ||
import io.gitlab.arturbosch.detekt.formatting.FormattingRule | ||
|
||
/** | ||
* See [ktlint docs](https://pinterest.github.io/ktlint/rules/standard/#classobject-naming) for | ||
* documentation. | ||
*/ | ||
class ClassNaming(config: Config) : FormattingRule(config) { | ||
override val wrapping = ClassNamingRule() | ||
override val issue = | ||
issueFor("Class or object name should start with an uppercase letter and use camel case.") | ||
} |
15 changes: 15 additions & 0 deletions
15
...ormatting/src/main/kotlin/io/gitlab/arturbosch/detekt/formatting/wrappers/FunctionName.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,15 @@ | ||
package io.gitlab.arturbosch.detekt.formatting.wrappers | ||
|
||
import com.pinterest.ktlint.ruleset.standard.rules.FunctionNamingRule | ||
import io.gitlab.arturbosch.detekt.api.Config | ||
import io.gitlab.arturbosch.detekt.formatting.FormattingRule | ||
|
||
/** | ||
* See [ktlint docs](https://pinterest.github.io/ktlint/rules/experimental/#function-naming) for | ||
* documentation. | ||
*/ | ||
class FunctionName(config: Config) : FormattingRule(config) { | ||
override val wrapping = FunctionNamingRule() | ||
override val issue = | ||
issueFor("Function name should start with a lowercase letter (except factory methods) and use camel case.") | ||
} |
15 changes: 15 additions & 0 deletions
15
...ormatting/src/main/kotlin/io/gitlab/arturbosch/detekt/formatting/wrappers/PropertyName.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,15 @@ | ||
package io.gitlab.arturbosch.detekt.formatting.wrappers | ||
|
||
import com.pinterest.ktlint.ruleset.standard.rules.PropertyNamingRule | ||
import io.gitlab.arturbosch.detekt.api.Config | ||
import io.gitlab.arturbosch.detekt.formatting.FormattingRule | ||
|
||
/** | ||
* See [ktlint docs](https://pinterest.github.io/ktlint/rules/experimental/#property-naming) for | ||
* documentation. | ||
*/ | ||
class PropertyName(config: Config) : FormattingRule(config) { | ||
override val wrapping = PropertyNamingRule() | ||
override val issue = | ||
issueFor("Reports incorrect property name.") | ||
} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why this changed?
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.
Yes, that was my question. Ideally, it should not be changed but it got changed automatically after running
generateDocumentation
. This could be a bug ingenerateDocumentation
as I have also added theClassNaming
rule from KtLint and there was one preexistingClassNaming
rule as wellThere 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.
@cortinico here my only concern which is not related to this PR is how we handle the same name rules, should
generateDocumentation
fail in cases like that? Or should we support the same name rules(if yes then when? Like should we allow the same name rules only when those are in different rule sections?) If we allow same name rules then the above change should also be addressed asgenerateDocumentation
wrongly updates the wrong rules configThere 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.
In other words, in
detekt
what is a unique identifier for a rule? Is this just rule name or combination of rule provider id and name?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.
I think that's a bug and we should investigate here. Rules with same ID coudl occur, especially if coming from external packages.
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.
Right now, I have reverted the unintentional change. I will create a separate issue for the bug