Skip to content

Commit

Permalink
Format with Ktlint 1.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-dingemans committed Dec 17, 2024
1 parent 752161e commit 47ff88e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion plugin/src/main/kotlin/com/nbadal/ktlint/KtlintAnnotator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ internal class KtlintAnnotator : ExternalAnnotator<List<LintError>, List<LintErr
}
}

else -> null
else -> {
null
}
}

override fun doAnnotate(collectedInfo: List<LintError>?): List<LintError>? =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class KtlintErrorHandler : ErrorReportSubmitter() {
is IdeaReportingEvent -> {
rollbar.error(event.data.throwable, extras)
}

else -> {
rollbar.error(event.throwable, extras, event.message)
}
Expand Down
9 changes: 6 additions & 3 deletions plugin/src/main/kotlin/com/nbadal/ktlint/KtlintFormat.kt
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private fun executeKtlint(
} else {
val formattedCode =
when (ktlintFormatAutoCorrectHandler) {
is KtlintFileAutocorrectHandler ->
is KtlintFileAutocorrectHandler -> {
ktlintRuleEngine.format(code) { lintError ->
if (lintError.isIgnoredInBaseline(baselineErrors)) {
AutocorrectDecision.NO_AUTOCORRECT
Expand All @@ -123,8 +123,9 @@ private fun executeKtlint(
AutocorrectDecision.ALLOW_AUTOCORRECT
}
}
}

is KtlintBlockAutocorrectHandler ->
is KtlintBlockAutocorrectHandler -> {
ktlintRuleEngine.format(code) { lintError ->
if (lintError.isIgnoredInBaseline(baselineErrors)) {
AutocorrectDecision.NO_AUTOCORRECT
Expand All @@ -139,15 +140,17 @@ private fun executeKtlint(
}
}
}
}

is KtlintViolationAutocorrectHandler ->
is KtlintViolationAutocorrectHandler -> {
ktlintRuleEngine.format(code) { lintError ->
if (lintError == ktlintFormatAutoCorrectHandler.lintError) {
AutocorrectDecision.ALLOW_AUTOCORRECT
} else {
AutocorrectDecision.NO_AUTOCORRECT
}
}
}
}
if (formattedCode != code.content) {
psiFile.viewProvider.document.setText(formattedCode)
Expand Down

0 comments on commit 47ff88e

Please sign in to comment.