-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
load all RuleSetProviderV3 from the classpath in ktlint 49+ (#698)
fixes #697 and #695 test custom rule loading in ktlin 0.50.0 by updating sample project To Test: Edit Main.kt in the kotlin-rulesets-using projects according to inline comment, then run ./gradlew samples:kotlin-rulesets-using:build update root kotlin version to 1.8 since ktlint requires this update android plugin to 4.1.3
- Loading branch information
1 parent
840e72e
commit f5114e4
Showing
11 changed files
with
44 additions
and
15 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
13 changes: 11 additions & 2 deletions
13
plugin/src/adapter49/kotlin/org/jlleitschuh/gradle/ktlint/worker/KtLintInvocation49.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
13 changes: 11 additions & 2 deletions
13
plugin/src/adapter50/kotlin/org/jlleitschuh/gradle/ktlint/worker/KtLintInvocation50.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
kotlin.js.compiler=ir |
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 @@ | ||
kotlin.js.compiler=ir |
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
11 changes: 7 additions & 4 deletions
11
...ting/src/main/kotlin/org/jlleitschuh/gradle/ktlint/sample/kotlin/CustomRuleSetProvider.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 |
---|---|---|
@@ -1,9 +1,12 @@ | ||
package org.jlleitschuh.gradle.ktlint.sample.kotlin | ||
|
||
import com.pinterest.ktlint.core.RuleSet | ||
import com.pinterest.ktlint.core.RuleSetProvider | ||
import com.pinterest.ktlint.cli.ruleset.core.api.RuleSetProviderV3 | ||
import com.pinterest.ktlint.rule.engine.core.api.RuleProvider | ||
import com.pinterest.ktlint.rule.engine.core.api.RuleSetId | ||
|
||
class CustomRuleSetProvider : RuleSetProvider { | ||
class CustomRuleSetProvider : RuleSetProviderV3(RuleSetId("custom")) { | ||
|
||
override fun get(): RuleSet = RuleSet("custom", NoVarRule()) | ||
override fun getRuleProviders(): Set<RuleProvider> { | ||
return setOf(RuleProvider { NoVarRule() }) | ||
} | ||
} |
10 changes: 7 additions & 3 deletions
10
...ulesets-creating/src/main/kotlin/org/jlleitschuh/gradle/ktlint/sample/kotlin/NoVarRule.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
File renamed without changes.
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