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

Moved Diktat's implementation of KtLint's RuleSetProvider #1654

Merged
merged 5 commits into from
Apr 3, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
### What's done:
- moved Diktat's implementation of RuleSetProvider to diktat-ruleset
- added initialization of logger to creating of diktat's `RuleSetProvider`
- upgraded and share 'kaml'
nulls committed Apr 3, 2023
commit dbb10abd098d7a6a063c6f997b14db5fbbb1f2f0
2 changes: 2 additions & 0 deletions diktat-ruleset/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -35,6 +35,8 @@ dependencies {
tasks.named<ShadowJar>("shadowJar") {
archiveBaseName.set("diktat")
archiveClassifier.set("")
// need to relocate kaml to avoid conflicts with KtLint
relocate("com.charleskorn.kaml", "com.saveourtool.com_charleskorn_kaml")
}

// disable default jar
Original file line number Diff line number Diff line change
@@ -3,6 +3,9 @@ package org.cqfn.diktat.ruleset.rules
import org.cqfn.diktat.ktlint.KtLintRuleSetProviderWrapper.Companion.toKtLint
import com.pinterest.ktlint.core.RuleSet
import com.pinterest.ktlint.core.RuleSetProvider
import com.pinterest.ktlint.core.initKtLintKLogger
import mu.KotlinLogging
import org.slf4j.Logger

/**
* [RuleSetProvider] that provides diKTat ruleset.
@@ -13,5 +16,10 @@ import com.pinterest.ktlint.core.RuleSetProvider
* This class is registered in [resources/META-INF/services/com.pinterest.ktlint.core.RuleSetProvider]
*/
class DiktatRuleSetProviderSpi : RuleSetProvider {
init {
// Need to init KtLint logger to set log level from CLI
KotlinLogging.logger(Logger.ROOT_LOGGER_NAME).initKtLintKLogger()
}

override fun get(): RuleSet = DiktatRuleSetProvider().toKtLint().get()
}
3 changes: 1 addition & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -20,8 +20,7 @@ plexus = "2.0"
jbool = "1.24"
# downgraded to be compliance with ktlint
mu-logging = "2.1.23"
# downgraded to be compliance with ktlint
kaml = "0.47.0"
kaml = "0.53.0"
kotlin-multiplatform-diff = "0.4.0"
sarif4k = "0.3.0"
jupiter-itf-extension = "0.12.0"