[#841] Ktlint 0.48.0

* [#841] Ktlint 0.48.0

* Update + Suppress

- Missing-trailing-comma globally
- Broken no-semi rule locally
- Fixed few other minor formatting troubles
This commit is contained in:
Honza Rychnovsky 2022-12-20 09:25:04 +01:00 committed by GitHub
parent c3e41a68c2
commit e784ddf353
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 34 additions and 24 deletions

View File

@ -8,8 +8,6 @@
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
</value>
</option>
<option name="NAME_COUNT_TO_USE_STAR_IMPORT" value="2147483647" />
<option name="NAME_COUNT_TO_USE_STAR_IMPORT_FOR_MEMBERS" value="2147483647" />
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<codeStyleSettings language="XML">

View File

@ -13,7 +13,7 @@ dependencies {
}
tasks {
val editorConfigFile = rootProject.file(".editorconfig")
val editorConfigFile = rootProject.file("tools/.editorconfig")
val ktlintArgs = listOf("**/src/**/*.kt", "!**/build/**.kt", "--editorconfig=$editorConfigFile")
register("ktlint", org.gradle.api.tasks.JavaExec::class) {

View File

@ -74,7 +74,7 @@ class TestWallet(
startHeight
)
as
SdkSynchronizer
SdkSynchronizer
val service = (synchronizer.processor.downloader.lightWalletService as LightWalletGrpcService)
val available get() = synchronizer.saplingBalances.value?.available
@ -164,6 +164,9 @@ class TestWallet(
}
}
// TODO [843]: Ktlint 0.48.1 (remove this suppress)
// TODO [843]: https://github.com/zcash/zcash-android-wallet-sdk/issues/843
@Suppress("ktlint:no-semi")
enum class Backups(val seedPhrase: String, val testnetBirthday: BlockHeight, val mainnetBirthday: BlockHeight) {
// TODO: get the proper birthday values for these wallets
DEFAULT(
@ -205,7 +208,6 @@ class TestWallet(
1_330_190
),
BlockHeight.new(ZcashNetwork.Mainnet, 1_000_000)
)
;
);
}
}

View File

@ -81,7 +81,7 @@ EMULATOR_WTF_GRADLE_PLUGIN_VERSION=0.0.12
FLANK_VERSION=22.10.0
FULLADLE_VERSION=0.17.4
GRADLE_VERSIONS_PLUGIN_VERSION=0.44.0
KTLINT_VERSION=0.47.1
KTLINT_VERSION=0.48.0
KSP_VERSION=1.7.21-1.0.8
PROTOBUF_GRADLE_PLUGIN_VERSION=0.8.19
RUST_GRADLE_PLUGIN_VERSION=0.9.3

View File

@ -166,6 +166,9 @@ class TestWallet(
}
}
// TODO [843]: Ktlint 0.48.1 (remove this suppress)
// TODO [843]: https://github.com/zcash/zcash-android-wallet-sdk/issues/843
@Suppress("ktlint:no-semi")
enum class Backups(val seedPhrase: String, val testnetBirthday: BlockHeight, val mainnetBirthday: BlockHeight) {
// TODO: get the proper birthday values for these wallets
DEFAULT(
@ -207,7 +210,6 @@ class TestWallet(
1_330_190
),
BlockHeight.new(ZcashNetwork.Mainnet, 1_000_000)
)
;
);
}
}

View File

@ -227,13 +227,13 @@ class CompactBlockProcessor internal constructor(
val napTime = calculatePollInterval()
twig(
"$summary${
if (result == BlockProcessingResult.FailedEnhance) {
" (but there were" +
" enhancement errors! We ignore those, for now. Memos in this block range are" +
" probably missing! This will be improved in a future release.)"
} else {
""
}
if (result == BlockProcessingResult.FailedEnhance) {
" (but there were" +
" enhancement errors! We ignore those, for now. Memos in this block range are" +
" probably missing! This will be improved in a future release.)"
} else {
""
}
}! Sleeping" +
" for ${napTime}ms (latest height: ${currentInfo.networkBlockHeight})."
)
@ -932,7 +932,7 @@ class CompactBlockProcessor internal constructor(
?: repository.findBlockHash(height)
twig(
"block: $height\thash=${hash?.toHexReversed()} \tprevHash=${
block?.prevHash?.toByteArray()?.toHexReversed()
block?.prevHash?.toByteArray()?.toHexReversed()
}"
)
}

View File

@ -157,11 +157,11 @@ sealed class BirthdayException(message: String, cause: Throwable? = null) : SdkE
nearestMatch: Checkpoint? = null
) : BirthdayException(
"Unable to find birthday that exactly matches $birthday.${
if (nearestMatch != null) {
" An exact match was request but the nearest match found was ${nearestMatch.height}."
} else {
""
}
if (nearestMatch != null) {
" An exact match was request but the nearest match found was ${nearestMatch.height}."
} else {
""
}
}"
)
class BirthdayFileNotFoundException(directory: String, height: BlockHeight?) : BirthdayException(

View File

@ -7,7 +7,9 @@ import java.util.Locale
* omitted since this is not the source of truth for branch information but rather a tool for
* printing that information to users.
*/
@Suppress("MagicNumber")
// TODO [843]: Ktlint 0.48.1 (remove this suppress)
// TODO [843]: https://github.com/zcash/zcash-android-wallet-sdk/issues/843
@Suppress("MagicNumber", "ktlint:no-semi")
enum class ConsensusBranchId(val displayName: String, val id: Long, val hexId: String) {
// TODO [#679]: see if we can find a way to not rely on this separate source of truth (either stop converting from
// hex to display name in the apps or use Rust to get this info)

View File

@ -11,4 +11,10 @@ disabled_rules=import-ordering,no-wildcard-imports
# Examples (we use ij_kotlin_imports_layout to set an imports layout for both ktlint and IDEA via a single property):
ij_kotlin_imports_layout=* # alphabetical with capital letters before lower case letters (e.g. Z before a), no blank lines
ij_kotlin_imports_layout=*,java.**,javax.**,kotlin.**,^ # default IntelliJ IDEA style, same as alphabetical, but with "java", "javax", "kotlin" and alias imports in the end of the imports list
ij_kotlin_imports_layout=android.**,|,^org.junit.**,kotlin.io.Closeable.*,|,*,^ # custom imports layout
ij_kotlin_imports_layout=android.**,|,^org.junit.**,kotlin.io.Closeable.*,|,*,^ # custom imports layout
# Opt-out from missing-trailing-comma rule enabled by default
root = true
[*.{kt,kts}]
ktlint_standard_trailing-comma-on-call-site = disabled
ktlint_standard_trailing-comma-on-declaration-site = disabled