Merge pull request #330 from vector-im/feature/bma/ktlint
Upgrade of ktlint (not the plugin but the tool itself)
This commit is contained in:
commit
f45e66b6c0
6 changed files with 19 additions and 34 deletions
|
|
@ -14,6 +14,11 @@ ij_smart_tabs = false
|
||||||
ij_visual_guides = none
|
ij_visual_guides = none
|
||||||
ij_wrap_on_typing = false
|
ij_wrap_on_typing = false
|
||||||
|
|
||||||
|
# Ktlint rule, for more information see https://pinterest.github.io/ktlint/faq/#why-is-editorconfig-property-disabled_rules-deprecated-and-how-do-i-resolve-this
|
||||||
|
ktlint_standard_wrapping = disabled
|
||||||
|
ktlint_standard_trailing-comma-on-call-site = disabled
|
||||||
|
|
||||||
|
|
||||||
[*.java]
|
[*.java]
|
||||||
ij_java_align_consecutive_assignments = false
|
ij_java_align_consecutive_assignments = false
|
||||||
ij_java_align_consecutive_variable_declarations = false
|
ij_java_align_consecutive_variable_declarations = false
|
||||||
|
|
|
||||||
6
.idea/kotlinc.xml
generated
Normal file
6
.idea/kotlinc.xml
generated
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="KotlinJpsPluginSettings">
|
||||||
|
<option name="version" value="1.8.10" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
|
@ -70,8 +70,8 @@ allprojects {
|
||||||
// See https://github.com/JLLeitschuh/ktlint-gradle#configuration
|
// See https://github.com/JLLeitschuh/ktlint-gradle#configuration
|
||||||
configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
|
configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
|
||||||
// See https://github.com/pinterest/ktlint/releases/
|
// See https://github.com/pinterest/ktlint/releases/
|
||||||
// TODO 0.47.1 is available
|
// TODO Regularly check for new version here ^
|
||||||
version.set("0.45.1")
|
version.set("0.48.2")
|
||||||
android.set(true)
|
android.set(true)
|
||||||
ignoreFailures.set(false)
|
ignoreFailures.set(false)
|
||||||
enableExperimentalRules.set(true)
|
enableExperimentalRules.set(true)
|
||||||
|
|
@ -85,33 +85,6 @@ allprojects {
|
||||||
filter {
|
filter {
|
||||||
exclude { element -> element.file.path.contains("$buildDir/generated/") }
|
exclude { element -> element.file.path.contains("$buildDir/generated/") }
|
||||||
}
|
}
|
||||||
disabledRules.set(
|
|
||||||
setOf(
|
|
||||||
// TODO Re-enable these 4 rules after reformatting project
|
|
||||||
"indent",
|
|
||||||
"experimental:argument-list-wrapping",
|
|
||||||
"max-line-length",
|
|
||||||
"parameter-list-wrapping",
|
|
||||||
|
|
||||||
"spacing-between-declarations-with-comments",
|
|
||||||
"no-multi-spaces",
|
|
||||||
"experimental:spacing-between-declarations-with-annotations",
|
|
||||||
"experimental:annotation",
|
|
||||||
// - Missing newline after "("
|
|
||||||
// - Missing newline before ")"
|
|
||||||
"wrapping",
|
|
||||||
// - Unnecessary trailing comma before ")"
|
|
||||||
"experimental:trailing-comma",
|
|
||||||
// - A block comment in between other elements on the same line is disallowed
|
|
||||||
"experimental:comment-wrapping",
|
|
||||||
// - A KDoc comment after any other element on the same line must be separated by a new line
|
|
||||||
"experimental:kdoc-wrapping",
|
|
||||||
// Ignore error "Redundant curly braces", since we use it to fix false positives, for instance in "elementLogs.${i}.txt"
|
|
||||||
"string-template",
|
|
||||||
// Not the same order than Android Studio formatter...
|
|
||||||
"import-ordering",
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
// Dependency check
|
// Dependency check
|
||||||
apply {
|
apply {
|
||||||
|
|
@ -283,7 +256,9 @@ val ciBuildProperty = "ci-build"
|
||||||
val isCiBuild = if (project.hasProperty(ciBuildProperty)) {
|
val isCiBuild = if (project.hasProperty(ciBuildProperty)) {
|
||||||
val raw = project.property(ciBuildProperty) as? String
|
val raw = project.property(ciBuildProperty) as? String
|
||||||
raw?.toBooleanLenient() == true || raw?.toIntOrNull() == 1
|
raw?.toBooleanLenient() == true || raw?.toIntOrNull() == 1
|
||||||
} else false
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
if (isCiBuild) {
|
if (isCiBuild) {
|
||||||
allprojects {
|
allprojects {
|
||||||
afterEvaluate {
|
afterEvaluate {
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,6 @@ anvil = "2.4.4"
|
||||||
|
|
||||||
# quality
|
# quality
|
||||||
detekt = "1.22.0"
|
detekt = "1.22.0"
|
||||||
ktlint = "11.3.1"
|
|
||||||
dependencygraph = "0.10"
|
dependencygraph = "0.10"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
|
|
@ -165,7 +164,7 @@ kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" }
|
||||||
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
|
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
|
||||||
anvil = { id = "com.squareup.anvil", version.ref = "anvil" }
|
anvil = { id = "com.squareup.anvil", version.ref = "anvil" }
|
||||||
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
|
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
|
||||||
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" }
|
ktlint = "org.jlleitschuh.gradle.ktlint:11.3.1"
|
||||||
dependencygraph = { id = "com.savvasdalkitsis.module-dependency-graph", version.ref = "dependencygraph" }
|
dependencygraph = { id = "com.savvasdalkitsis.module-dependency-graph", version.ref = "dependencygraph" }
|
||||||
dependencycheck = { id = "org.owasp.dependencycheck", version.ref = "dependencycheck" }
|
dependencycheck = { id = "org.owasp.dependencycheck", version.ref = "dependencycheck" }
|
||||||
paparazzi = "app.cash.paparazzi:1.2.0"
|
paparazzi = "app.cash.paparazzi:1.2.0"
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ class StateMachine<Event : Any, State : Any>(
|
||||||
val routesForEvent = routes.filter { it.eventType.isInstance(event) }
|
val routesForEvent = routes.filter { it.eventType.isInstance(event) }
|
||||||
|
|
||||||
return (routesForEvent.firstOrNull { it.fromState?.isInstance(currentState) == true }
|
return (routesForEvent.firstOrNull { it.fromState?.isInstance(currentState) == true }
|
||||||
?: routesForEvent.firstOrNull { it.fromState == null }) as? StateMachineRoute<E, State, State>
|
?: routesForEvent.firstOrNull { it.fromState == null }) as? StateMachineRoute<E, State, State>
|
||||||
}
|
}
|
||||||
|
|
||||||
fun restart() {
|
fun restart() {
|
||||||
|
|
@ -129,7 +129,7 @@ class StateMachineBuilder<Event : Any, State : Any>(
|
||||||
newRoutes: List<StateMachineRoute<*, *, *>>,
|
newRoutes: List<StateMachineRoute<*, *, *>>,
|
||||||
) {
|
) {
|
||||||
val oldEvents = oldRoutes.filter { it.fromState == state }.map { it.eventType }
|
val oldEvents = oldRoutes.filter { it.fromState == state }.map { it.eventType }
|
||||||
val newEvents = newRoutes.filter { it.fromState == state }.map { it.eventType }
|
val newEvents = newRoutes.filter { it.fromState == state }.map { it.eventType }
|
||||||
val intersection = oldEvents.intersect(newEvents)
|
val intersection = oldEvents.intersect(newEvents)
|
||||||
if (intersection.isNotEmpty()) {
|
if (intersection.isNotEmpty()) {
|
||||||
val duplicates = intersection.joinToString(", ") { it.name }
|
val duplicates = intersection.joinToString(", ") { it.name }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue