Skip to content

Commit 2398946

Browse files
Merge pull request #77 from touchlab/ks/AddingKtLint
Adding KtLint
2 parents 8141216 + 80e96ae commit 2398946

File tree

23 files changed

+121
-48
lines changed

23 files changed

+121
-48
lines changed

.editorconfig

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# .editorconfig
2+
root = true
3+
4+
[*.{kt,kts}]
5+
end_of_line = lf
6+
ij_kotlin_packages_to_use_import_on_demand = true
7+
ij_kotlin_allow_trailing_comma = true
8+
ij_kotlin_allow_trailing_comma_on_call_site = true
9+
ij_kotlin_imports_layout = *
10+
ij_kotlin_indent_before_arrow_on_new_line = false
11+
ij_kotlin_line_break_after_multiline_when_entry = true
12+
indent_size = 4
13+
indent_style = space
14+
insert_final_newline = true
15+
ktlint_argument_list_wrapping_ignore_when_parameter_count_greater_or_equal_than = 8
16+
ktlint_chain_method_rule_force_multiline_when_chain_operator_count_greater_or_equal_than = 4
17+
ktlint_code_style = android_studio
18+
ktlint_enum_entry_name_casing = upper_or_camel_cases
19+
ktlint_function_naming_ignore_when_annotated_with = Composable
20+
ktlint_function_signature_body_expression_wrapping = default
21+
ktlint_ignore_back_ticked_identifier = false
22+
max_line_length = 140
23+
parameter-list-wrapping = true

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,21 @@ jobs:
2424
- name: Validate Gradle Wrapper
2525
uses: gradle/wrapper-validation-action@v1
2626
- name: Cache gradle
27-
uses: actions/cache@v2
27+
uses: actions/cache@v4
2828
with:
2929
path: ~/.gradle/caches
3030
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
3131
restore-keys: |
3232
${{ runner.os }}-gradle-
3333
- name: Cache konan
34-
uses: actions/cache@v2
34+
uses: actions/cache@v4
3535
with:
3636
path: ~/.konan
3737
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
3838
restore-keys: |
3939
${{ runner.os }}-gradle-
4040
- name: Build
41-
run: ./gradlew build --no-daemon --stacktrace
41+
run: ./gradlew ktlintCheck build --no-daemon --stacktrace
4242

4343
env:
4444
GRADLE_OPTS: -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx4g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:MaxMetaspaceSize=512m"

.github/workflows/deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ jobs:
2929
uses: gradle/wrapper-validation-action@v1
3030

3131
- name: Cache gradle
32-
uses: actions/cache@v2
32+
uses: actions/cache@v4
3333
with:
3434
path: ~/.gradle/caches
3535
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
3636
restore-keys: |
3737
${{ runner.os }}-gradle-
3838
3939
- name: Cache konan
40-
uses: actions/cache@v2
40+
uses: actions/cache@v4
4141
with:
4242
path: ~/.konan
4343
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ jobs:
2424
- name: Validate Gradle Wrapper
2525
uses: gradle/wrapper-validation-action@v1
2626
- name: Cache gradle
27-
uses: actions/cache@v2
27+
uses: actions/cache@v4
2828
with:
2929
path: ~/.gradle/caches
3030
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
3131
restore-keys: |
3232
${{ runner.os }}-gradle-
3333
3434
- name: Cache konan
35-
uses: actions/cache@v2
35+
uses: actions/cache@v4
3636
with:
3737
path: ~/.konan
3838
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}

bugsnag-ios-link/build.gradle.kts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ java {
5151
}
5252
}
5353

54+
@Suppress("ktlint:standard:property-naming")
5455
val GROUP: String by project
56+
57+
@Suppress("ktlint:standard:property-naming")
5558
val VERSION_NAME: String by project
5659

5760
group = GROUP
@@ -63,4 +66,4 @@ mavenPublishing {
6366
project.properties["RELEASE_SIGNING_ENABLED"]?.toString()?.equals("false", ignoreCase = true) != true
6467
if (releaseSigningEnabled) signAllPublications()
6568
pomFromGradleProperties()
66-
}
69+
}

bugsnag-ios-link/src/main/kotlin/co/touchlab/crashkios/BugsnagLinkPlugin.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ internal val Project.kotlinExtension: KotlinMultiplatformExtension get() = exten
2828
@Suppress("unused")
2929
class BugsnagLinkPlugin : Plugin<Project> {
3030
override fun apply(project: Project): Unit = project.withKotlinMultiplatformPlugin {
31-
val linkerArgs = "-U _OBJC_CLASS_\$_BugsnagHandledState " +
31+
val linkerArgs =
32+
"-U _OBJC_CLASS_\$_BugsnagHandledState " +
3233
"-U _OBJC_CLASS_\$_Bugsnag " +
3334
"-U _OBJC_CLASS_\$_BugsnagStackframe " +
3435
"-U _OBJC_CLASS_\$_FIRStackFrame " +

bugsnag/build.gradle.kts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ plugins {
1919
id("com.vanniktech.maven.publish")
2020
}
2121

22+
@Suppress("ktlint:standard:property-naming")
2223
val GROUP: String by project
24+
25+
@Suppress("ktlint:standard:property-naming")
2326
val VERSION_NAME: String by project
2427

2528
group = GROUP
@@ -88,15 +91,20 @@ kotlin {
8891

8992
android {
9093
namespace = "co.touchlab.crashkios.bugsnag"
91-
compileSdk = libs.versions.compileSdk.get().toInt()
94+
compileSdk =
95+
libs.versions.compileSdk
96+
.get()
97+
.toInt()
9298
defaultConfig {
93-
minSdk = libs.versions.minSdk.get().toInt()
99+
minSdk =
100+
libs.versions.minSdk
101+
.get()
102+
.toInt()
94103
}
95104
compileOptions {
96105
sourceCompatibility = JavaVersion.VERSION_1_8
97106
targetCompatibility = JavaVersion.VERSION_1_8
98107
}
99-
100108
}
101109

102110
tasks.withType<KotlinCompile> {

bugsnag/src/androidMain/kotlin/co/touchlab/crashkios/bugsnag/BugsnagCallsActual.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ actual class BugsnagCallsActual : BugsnagCalls {
1818
override fun setCustomValue(section: String, key: String, value: Any) {
1919
Bugsnag.addMetadata(section, key, value)
2020
}
21-
}
21+
}

bugsnag/src/appleMain/kotlin/co/touchlab/crashkios/bugsnag/BugsnagCallsActual.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import kotlinx.cinterop.ExperimentalForeignApi
66

77
@OptIn(ExperimentalForeignApi::class)
88
actual class BugsnagCallsActual : BugsnagCalls {
9-
109
override fun logMessage(message: String) {
1110
Bugsnag.leaveBreadcrumbWithMessage(message)
1211
}
@@ -45,4 +44,4 @@ actual class BugsnagCallsActual : BugsnagCalls {
4544
true
4645
}
4746
}
48-
}
47+
}

bugsnag/src/appleMain/kotlin/co/touchlab/crashkios/bugsnag/BugsnagConfig.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import com.rickclephas.kmp.nsexceptionkt.core.wrapUnhandledExceptionHook
88
import kotlinx.cinterop.ExperimentalForeignApi
99
import platform.Foundation.NSException
1010

11-
public fun startBugsnag(config: BugsnagConfiguration){
11+
public fun startBugsnag(config: BugsnagConfiguration) {
1212
configureBugsnag(config)
1313
Bugsnag.startWithConfiguration(config)
1414
setBugsnagUnhandledExceptionHook()
@@ -53,6 +53,7 @@ public fun setBugsnagUnhandledExceptionHook(): Unit = wrapUnhandledExceptionHook
5353
/**
5454
* Feature flag used to mark the Kotlin termination crash.
5555
*/
56+
@Suppress("ktlint:standard:property-naming")
5657
private const val kotlinCrashedFeatureFlag = "crashkios.kotlin_crashed"
5758

5859
/**

0 commit comments

Comments
 (0)