diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..531f4d2ea5 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,20 @@ +# Kotlin Ktlint +root = true + +[*.{kt,kts}] + +ktlint_code_style = android_studio + +ktlint_standard_no-wildcard-imports = disabled +ktlint_standard_no-empty-first-line-in-class-body = disabled +ktlint_standard_no-line-break-before-assignment = disabled +ktlint_standard_multiline-expression-wrapping = disabled +ktlint_standard_string-template-indent = disabled +ktlint_standard_trailing-comma-on-call-site = disabled +ktlint_standard_trailing-comma-on-declaration-site = disabled +ktlint_standard_no-empty-first-line-in-method-block = disabled +ktlint_standard_expression-body-wrapping = disabled +ktlint_standard_function-signature = disabled +ktlint_standard_spacing-between-declarations-with-annotations = disabled + +max_line_length = 130 diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index e15c8487df..97adb3433a 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -9,6 +9,23 @@ concurrency: jobs: + ktlint: + runs-on: ubuntu-latest + + steps: + - name: Checkout the code + uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + + - name: Install ktlint + run: curl -sSLO https://github.com/pinterest/ktlint/releases/download/1.7.1/ktlint && chmod a+x ktlint + + - name: Run ktlint + run: ./ktlint 'src/**/*.kt' --baseline=config/ktlint/baseline.xml + instrumentation-tests: if: github.event.pull_request.draft == false runs-on: [ self-hosted, Android ] diff --git a/Core b/Core index 35561ae10d..ee15f60506 160000 --- a/Core +++ b/Core @@ -1 +1 @@ -Subproject commit 35561ae10db9495f0f3f221f532d21670137a44e +Subproject commit ee15f605066a0fb963f2241f0871da900d994f1f diff --git a/EmojiComponents/build.gradle.kts b/EmojiComponents/build.gradle.kts index fc9c5a2673..813cf8a82e 100644 --- a/EmojiComponents/build.gradle.kts +++ b/EmojiComponents/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jlleitschuh.gradle.ktlint.reporter.ReporterType + plugins { id("com.android.library") alias(core.plugins.kotlin.android) @@ -37,6 +39,16 @@ android { } } +ktlint { + version.set("1.7.1") + android.set(true) + ignoreFailures.set(false) + reporters { + reporter(ReporterType.PLAIN) + } + baseline.set(file("${projectDir}/config/ktlint/baseline.xml")) +} + dependencies { implementation(project(":Core:Avatar")) implementation(project(":Core:Compose:Margin")) diff --git a/EmojiComponents/config/ktlint/baseline.xml b/EmojiComponents/config/ktlint/baseline.xml new file mode 100644 index 0000000000..7d4f0ed7b5 --- /dev/null +++ b/EmojiComponents/config/ktlint/baseline.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/HtmlCleaner/build.gradle b/HtmlCleaner/build.gradle index f26ddfd99e..35eb67a8f7 100644 --- a/HtmlCleaner/build.gradle +++ b/HtmlCleaner/build.gradle @@ -1,3 +1,5 @@ +import org.jlleitschuh.gradle.ktlint.reporter.ReporterType + apply plugin: 'com.android.library' apply plugin: 'kotlin-android' @@ -28,6 +30,16 @@ android { } } +ktlint { + version.set("1.7.1") + android.set(true) + ignoreFailures.set(false) + reporters { + reporter(ReporterType.PLAIN) + } + baseline.set(file("${projectDir}/config/ktlint/baseline.xml")) +} + dependencies { api libs.jsoup } diff --git a/HtmlCleaner/config/ktlint/baseline.xml b/HtmlCleaner/config/ktlint/baseline.xml new file mode 100644 index 0000000000..6d745a833f --- /dev/null +++ b/HtmlCleaner/config/ktlint/baseline.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/app/build.gradle.kts b/app/build.gradle.kts index a305f63959..8fd7ce97fe 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jlleitschuh.gradle.ktlint.reporter.ReporterType + plugins { alias(libs.plugins.android.application) alias(libs.plugins.dagger.hilt) @@ -101,6 +103,16 @@ kotlin { } } +ktlint { + version.set("1.7.1") + android.set(true) + ignoreFailures.set(false) + reporters { + reporter(ReporterType.PLAIN) + } + baseline.set(file("${projectDir}/config/ktlint/baseline.xml")) +} + dependencies { implementation(project(":Core")) implementation(project(":Core:Auth")) diff --git a/app/config/ktlint/baseline.xml b/app/config/ktlint/baseline.xml new file mode 100644 index 0000000000..ee093deb1c --- /dev/null +++ b/app/config/ktlint/baseline.xml @@ -0,0 +1,1814 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build.gradle.kts b/build.gradle.kts index 87b256e1f9..6585f8eb64 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -21,6 +21,11 @@ plugins { alias(libs.plugins.jetbrains.kotlin.serialization) apply false alias(libs.plugins.kapt) apply false alias(libs.plugins.realm.kotlin) apply false + alias(core.plugins.ktlint) version "13.0.0" +} + +subprojects { + apply(plugin = "org.jlleitschuh.gradle.ktlint") } tasks.register("clean", Delete::class) { delete(rootProject.layout.buildDirectory) }