Skip to content

Commit 6fae604

Browse files
committed
test: Add ktlint test to bazel build.
1 parent 0089dca commit 6fae604

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ jobs:
3232
runs-on: ubuntu-22.04
3333
steps:
3434
- uses: actions/checkout@v4
35-
- run: curl -sSLO https://github.com/pinterest/ktlint/releases/download/1.1.1/ktlint && chmod a+x ktlint
35+
- run: curl -sSLO https://github.com/pinterest/ktlint/releases/download/1.0.1/ktlint && chmod a+x ktlint
3636
- run: ./ktlint

BUILD.bazel

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_proto_library")
22
load("@rules_java//java:defs.bzl", "java_proto_library")
33
load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library", "kt_jvm_test")
4+
load("@rules_kotlin//kotlin:lint.bzl", "ktlint_fix", "ktlint_test")
45
load("@rules_proto//proto:defs.bzl", "proto_library")
56
load("//tools/project:build_defs.bzl", "project")
67

@@ -95,3 +96,13 @@ kt_jvm_test(
9596
"@maven//:org_jetbrains_kotlinx_kotlinx_coroutines_core",
9697
],
9798
)
99+
100+
ktlint_fix(
101+
name = "ktlint_fix",
102+
srcs = glob(["**/*.kt"]),
103+
)
104+
105+
ktlint_test(
106+
name = "ktlint_test",
107+
srcs = glob(["**/*.kt"]),
108+
)

lib/src/commonMain/kotlin/im/tox/tox4j/exceptions/ToxException.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ package im.tox.tox4j.exceptions
22

33
abstract class ToxException constructor(val code: Enum<*>, private val extraMessage: String) :
44
Exception(extraMessage) {
5-
final override val message: String
6-
get() =
7-
when (extraMessage) {
8-
"" -> "Error code: " + code.name
9-
else -> extraMessage + ", error code: " + code.name
10-
}
11-
}
5+
final override val message: String
6+
get() =
7+
when (extraMessage) {
8+
"" -> "Error code: " + code.name
9+
else -> extraMessage + ", error code: " + code.name
10+
}
11+
}

0 commit comments

Comments
 (0)