-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* General dependency update (#181) * Fix expected code to match generated code * Bumping KotlinPoet to latest and undoing some questionable changes to the code generated by previous version --------- Co-authored-by: Chris Hatton <[email protected]> Co-authored-by: Jens Zettelmeyer <[email protected]>
- Loading branch information
1 parent
e589ae6
commit 4405871
Showing
79 changed files
with
1,650 additions
and
1,635 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
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 |
---|---|---|
@@ -1,28 +1,16 @@ | ||
package com.cjbooms.fabrikt.util | ||
|
||
import com.pinterest.ktlint.core.KtLint | ||
import com.pinterest.ktlint.core.RuleSetProvider | ||
import java.util.ServiceLoader | ||
import com.pinterest.ktlint.core.Code | ||
import com.pinterest.ktlint.core.KtLintRuleEngine | ||
import com.pinterest.ktlint.ruleset.standard.StandardRuleSetProvider | ||
|
||
object Linter { | ||
|
||
private val lintRuleSets = ServiceLoader.load(RuleSetProvider::class.java) | ||
.map { it.get() }.sortedBy { | ||
when (it.id) { | ||
"standard" -> 0 | ||
else -> 1 | ||
} | ||
} | ||
|
||
fun lintString(rawText: String) = | ||
// lint twice, first lint adds whitespace after each line in a multiline field annotation. | ||
internalLintString(internalLintString(rawText)) | ||
|
||
private fun internalLintString(rawText: String) = KtLint.format( | ||
KtLint.Params( | ||
text = rawText, | ||
ruleSets = lintRuleSets, | ||
cb = { _, _ -> } | ||
) | ||
) | ||
fun lintString(rawText: String): String { | ||
val code = Code.CodeSnippet(rawText) | ||
val result = KtLintRuleEngine( | ||
ruleProviders = StandardRuleSetProvider().getRuleProviders(), | ||
).format(code) | ||
return result | ||
} | ||
} |
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.