From cde30023559dc35215daa1ebb72fdc6eb2fd03bf Mon Sep 17 00:00:00 2001 From: AntsyLich <59261191+AntsyLich@users.noreply.github.com> Date: Sun, 13 Oct 2024 23:02:35 +0600 Subject: [PATCH] Refrain from running spotless on weblate files Those are akin to generated files and are likely to not follow our formatting (cherry picked from commit 32d2c2ac1bc224cbda2f09a4023d7d120ea0e954) # Conflicts: # buildSrc/src/main/kotlin/mihon.code.lint.gradle.kts --- .../src/main/kotlin/mihon.code.lint.gradle.kts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/buildSrc/src/main/kotlin/mihon.code.lint.gradle.kts b/buildSrc/src/main/kotlin/mihon.code.lint.gradle.kts index bc3ebb44a..7225c180b 100644 --- a/buildSrc/src/main/kotlin/mihon.code.lint.gradle.kts +++ b/buildSrc/src/main/kotlin/mihon.code.lint.gradle.kts @@ -6,6 +6,18 @@ plugins { val libs = the<LibrariesForLibs>() +val xmlFormatExclude = buildList(2) { + add("**/build/**/*.xml") + + projectDir + .resolve("src/commonMain/moko-resources") + .takeIf { it.isDirectory } + ?.let(::fileTree) + ?.matching { exclude("/base/**") } + ?.let(::add) +} + .toTypedArray() + spotless { kotlin { target("**/*.kt", "**/*.kts") @@ -27,9 +39,7 @@ spotless { } format("xml") { target("**/*.xml") - targetExclude("**/build/**/*.xml") - // weblate seems to have its own line endings - targetExclude("**/moko-resources/**/*.xml") + targetExclude(*xmlFormatExclude) trimTrailingWhitespace() endWithNewline() }