Skip to content

Commit f6afc73

Browse files
Adding KtLint
1 parent 8141216 commit f6afc73

File tree

21 files changed

+115
-42
lines changed

21 files changed

+115
-42
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
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"

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
/**

bugsnag/src/commonMain/kotlin/co/touchlab/crashkios/bugsnag/BugsnagCalls.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ package co.touchlab.crashkios.bugsnag
22

33
interface BugsnagCalls {
44
fun logMessage(message: String)
5+
56
fun sendHandledException(throwable: Throwable)
7+
68
fun sendFatalException(throwable: Throwable)
9+
710
fun setCustomValue(section: String, key: String, value: Any)
811
}
912

10-
expect class BugsnagCallsActual() : BugsnagCalls
13+
expect class BugsnagCallsActual() : BugsnagCalls

bugsnag/src/commonMain/kotlin/co/touchlab/crashkios/bugsnag/BugsnagKotlin.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,20 @@ object BugsnagKotlin {
2626
* Call in startup code in an actual app. Tests should generally skip this. In Kotlin/Native, not calling this
2727
* for tests avoids linker issues.
2828
*/
29-
fun enableBugsnag(){
29+
fun enableBugsnag() {
3030
BugsnagKotlin.implementation = BugsnagCallsActual()
3131
}
3232

3333
internal object EmptyCalls : BugsnagCalls {
3434
override fun logMessage(message: String) {
35-
3635
}
3736

3837
override fun sendHandledException(throwable: Throwable) {
39-
4038
}
4139

4240
override fun sendFatalException(throwable: Throwable) {
43-
4441
}
4542

4643
override fun setCustomValue(section: String, key: String, value: Any) {
47-
4844
}
49-
}
45+
}

0 commit comments

Comments
 (0)