Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Mateusz Kwieciński <mateusz.kwiatek@gmail.com>
- Loading branch information
1 parent
5abda8a
commit 27ab24e
Showing
12 changed files
with
202 additions
and
128 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
84 changes: 67 additions & 17 deletions
84
src/main/kotlin/org/jmailen/gradle/kotlinter/support/EditorConfigUtils.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
23 changes: 23 additions & 0 deletions
23
src/main/kotlin/org/jmailen/gradle/kotlinter/support/KtlintEngineUtils.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,23 @@ | ||
package org.jmailen.gradle.kotlinter.support | ||
|
||
import com.pinterest.ktlint.core.KtLintRuleEngine | ||
import org.gradle.api.file.ConfigurableFileCollection | ||
import org.gradle.api.logging.Logger | ||
import java.io.File | ||
|
||
internal fun createKtlintEngine(ktLintParams: KtLintParams) = KtLintRuleEngine( | ||
ruleProviders = resolveRuleProviders(defaultRuleSetProviders), | ||
editorConfigOverride = editorConfigOverride(ktLintParams), | ||
editorConfigDefaults = editorConfigDefaults(ktLintParams), | ||
) | ||
|
||
internal fun KtLintRuleEngine.resetEditorconfigCacheIfNeeded( | ||
changedEditorconfigFiles: ConfigurableFileCollection, | ||
logger: Logger, | ||
) { | ||
val changedFiles = changedEditorconfigFiles.files | ||
if (changedFiles.any()) { | ||
logger.info("Editorconfig changed, resetting KtLint caches") | ||
changedFiles.map(File::toPath).forEach(::reloadEditorConfigFile) | ||
} | ||
} |
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
Oops, something went wrong.