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 dedc44fcbd..4120e3ec8d 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -8,6 +8,27 @@ concurrency: cancel-in-progress: true jobs: + + ktlint: + runs-on: ubuntu-latest + + steps: + - name: Checkout the code + uses: actions/checkout@v5.0.0 + with: + submodules: recursive + - name: Set up JDK 17 + uses: actions/setup-java@v5.0.0 + with: + distribution: temurin + java-version: 17 + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Run ktlint + run: ./gradlew :app:ktlintCheck --no-daemon + instrumentation-tests: if: github.event.pull_request.draft == false runs-on: [ self-hosted, Android ] diff --git a/Core b/Core index 943f49dec9..9d35e5625b 160000 --- a/Core +++ b/Core @@ -1 +1 @@ -Subproject commit 943f49dec915bce593ae492bc8de15fc351acb83 +Subproject commit 9d35e5625b1387ec3514a29df494e0c5e43f1339 diff --git a/app/config/ktlint/baseline.xml b/app/config/ktlint/baseline.xml new file mode 100644 index 0000000000..c3d4f2baeb --- /dev/null +++ b/app/config/ktlint/baseline.xml @@ -0,0 +1,1950 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build.gradle.kts b/build.gradle.kts index 9472e7aa08..537ad4de99 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,5 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. +import org.jlleitschuh.gradle.ktlint.reporter.ReporterType + buildscript { extra.apply { @@ -25,6 +26,21 @@ plugins { alias(core.plugins.dagger.hilt) apply false alias(core.plugins.ksp) apply false alias(core.plugins.navigation.safeargs) apply false + alias(core.plugins.ktlint) +} + +ktlint { + version.set("1.7.1") + android.set(true) + ignoreFailures.set(false) + reporters { + reporter(ReporterType.PLAIN) + } + baseline.set(file("${projectDir}/config/ktlint/baseline.xml")) +} + +subprojects { + apply(plugin = "org.jlleitschuh.gradle.ktlint") } tasks.register("clean") { diff --git a/config/ktlint/baseline.xml b/config/ktlint/baseline.xml new file mode 100644 index 0000000000..508392cd63 --- /dev/null +++ b/config/ktlint/baseline.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 676eb3c88c..1d634aec41 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -62,5 +62,6 @@ junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", vers junit5 = { id = "de.mannodermaus.android-junit5" } kotlin-android = { id = "kotlin-android" } kotlin-kapt = { id = "kotlin-kapt" } +ktlint = { id = "org.jlleitschuh.gradle.ktlint" } navigation-safeargs = { id = "androidx.navigation.safeargs.kotlin" } realm-android = { id = "realm-android" }