From 343a6fddb01cd3565e3c720238b8581f6c458ba6 Mon Sep 17 00:00:00 2001 From: Kevin Schildhorn Date: Wed, 30 Apr 2025 15:41:36 -0400 Subject: [PATCH 1/7] Adding KtLint --- .editorconfig | 23 ++++++++ .github/workflows/build.yml | 2 +- .idea/codeStyles/Project.xml | 2 - build.gradle.kts | 20 +++++++ .../touchlab/stately/collections/Functions.kt | 12 ++-- .../stately/collections/ObjectPool.kt | 6 +- .../stately/collections/SharedHashMap.kt | 59 ++++++------------- .../stately/collections/SharedLinkedList.kt | 37 ++++-------- .../stately/collections/SharedLruCache.kt | 14 ++--- .../touchlab/stately/collections/SharedSet.kt | 22 ++++--- .../stately/collections/SharedHashMapTest.kt | 29 +++++---- .../collections/SharedLinkedListTest.kt | 49 +++++++-------- .../stately/collections/SharedLruCacheTest.kt | 23 ++++---- .../stately/collections/StableReadListTest.kt | 54 +++++++++-------- .../touchlab/stately/collections/Functions.kt | 4 +- .../stately/collections/FunctionsJVM.kt | 10 ++-- .../stately/collections/CopyOnWriteList.kt | 24 +++----- .../touchlab/stately/collections/Functions.kt | 10 ++-- .../kotlin/co/touchlab/stately/HelpersTest.kt | 1 - .../stately/collections/IsoArrayDeque.kt | 11 ++-- .../collections/IsoMutableCollection.kt | 11 ++-- .../stately/collections/IsoMutableIterator.kt | 3 +- .../stately/collections/IsoMutableList.kt | 20 ++++--- .../stately/collections/IsoMutableMap.kt | 11 ++-- .../stately/collections/IsoMutableSet.kt | 8 ++- .../stately/collections/IsoMutableListTest.kt | 4 +- .../stately/collections/IsoMutableMapTest.kt | 4 +- .../stately/collections/IsoMutableSetTest.kt | 30 +++++----- .../co/touchlab/stately/isolate/IsoState.kt | 10 ++-- .../touchlab/stately/isolate/IsoStateTest.kt | 5 -- .../stately/isolate/BackgroundStateRunner.kt | 2 +- .../stately/isolate/BackgroundStateRunner.kt | 5 +- .../co/touchlab/stately/isolate/Platform.kt | 2 + stately-concurrency/build.gradle.kts | 5 +- .../stately/concurrency/AtomicBoolean.kt | 3 +- .../touchlab/stately/concurrency/Functions.kt | 4 +- .../stately/concurrency/ThreadLocal.kt | 4 +- .../touchlab/stately/concurrency/AtomicInt.kt | 18 +++--- .../stately/concurrency/AtomicLong.kt | 18 +++--- .../stately/concurrency/AtomicReference.kt | 12 ++-- .../stately/concurrency/Synchronizable.kt | 2 +- .../stately/concurrency/ThreadLocal.kt | 4 +- .../stately/concurrency/Synchronizable.kt | 2 +- .../stately/concurrency/ThreadLocalJVM.kt | 4 +- .../touchlab/stately/concurrency/Functions.kt | 4 +- .../stately/concurrency/ThreadLocal.kt | 14 ++--- .../concurrency/GuardedStableRefTest.kt | 1 + .../build.gradle.kts | 2 - .../ConcurrentMutableCollection.kt | 10 +--- .../collections/ConcurrentMutableList.kt | 14 ++--- .../collections/ConcurrentMutableMap.kt | 32 ++++------ .../collections/ConcurrentMutableSet.kt | 4 +- .../ConcurrentMutableCollectionTest.kt | 4 +- .../collections/ConcurrentMutableListTest.kt | 11 ++-- .../collections/ConcurrentMutableMapTest.kt | 7 +-- .../stately/collections/TestHelpers.kt | 2 +- .../collections/backgroundDispatcher.kt | 4 +- ...dDispatcher.kt => BackgroundDispatcher.kt} | 2 +- .../collections/backgroundDispatcher.kt | 2 +- stately-strict/build.gradle.kts | 5 +- .../co/touchlab/stately/strict/Helpers.kt | 2 +- .../co/touchlab/stately/strict/HelpersJS.kt | 2 +- .../co/touchlab/stately/strict/Helpers.kt | 2 +- .../co/touchlab/stately/strict/HelpersTest.kt | 4 +- 64 files changed, 348 insertions(+), 383 deletions(-) create mode 100644 .editorconfig rename stately-concurrent-collections/src/jvmTest/kotlin/co/touchlab/stately/collections/{backgroundDispatcher.kt => BackgroundDispatcher.kt} (89%) diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..b927a29 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,23 @@ +# .editorconfig +root = true + +[*.{kt,kts}] +end_of_line = lf +ij_kotlin_packages_to_use_import_on_demand = true +ij_kotlin_allow_trailing_comma = true +ij_kotlin_allow_trailing_comma_on_call_site = true +ij_kotlin_imports_layout = * +ij_kotlin_indent_before_arrow_on_new_line = false +ij_kotlin_line_break_after_multiline_when_entry = true +indent_size = 4 +indent_style = space +insert_final_newline = true +ktlint_argument_list_wrapping_ignore_when_parameter_count_greater_or_equal_than = 8 +ktlint_chain_method_rule_force_multiline_when_chain_operator_count_greater_or_equal_than = 4 +ktlint_code_style = android_studio +ktlint_enum_entry_name_casing = upper_or_camel_cases +ktlint_function_naming_ignore_when_annotated_with = Composable +ktlint_function_signature_body_expression_wrapping = default +ktlint_ignore_back_ticked_identifier = false +max_line_length = 140 +parameter-list-wrapping = true \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 482c298..aa304ae 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,7 +36,7 @@ jobs: ${{ runner.os }}-gradle- - name: Run Gradle Build - run: ./gradlew build --no-daemon --stacktrace --no-build-cache + run: ./gradlew ktlintCheck build --no-daemon --stacktrace --no-build-cache env: ORG_GRADLE_PROJECT_SONATYPE_NEXUS_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }} ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index c23569c..a1d5ac7 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -6,8 +6,6 @@ -