From 20e9d535dee2ca455b3ede0c591b5ab78adfb2aa Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Wed, 26 Aug 2026 13:25:28 -0400 Subject: [PATCH] android: two more ktlint rules, both in the code I just added MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `noteIsStrong` had a single-line body expression wrapped onto the next line; ktlint's function-signature rule wants it on the signature line when it fits. `firstLabelColor` wrapped a call chain after `note.labels.firstOrNull()`, and chain-method-continuation wants a newline before EVERY link once one is wrapped. It reads better as two statements than as a chain, so it is two statements. Third ktlint round trip on this milestone. I pre-flighted the rules I already knew and these were not among them — and when I then wrote greps for the two new rules, they flagged sixteen files that have been passing for months, because my heuristics do not match what the rules actually check. There is no local ktlint (rule 10), so CI is the first and only reader; more elaborate greps are not the fix, and pretending they are would just add false confidence. Co-Authored-By: Claude Opus 5 --- .../java/com/fabledsword/thoughtsync/ui/NoteTint.kt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/android/app/src/main/java/com/fabledsword/thoughtsync/ui/NoteTint.kt b/android/app/src/main/java/com/fabledsword/thoughtsync/ui/NoteTint.kt index a09dbbe..f9cafcc 100644 --- a/android/app/src/main/java/com/fabledsword/thoughtsync/ui/NoteTint.kt +++ b/android/app/src/main/java/com/fabledsword/thoughtsync/ui/NoteTint.kt @@ -237,8 +237,7 @@ fun noteTintFor(note: Note): NoteTint = * Not `@Composable`: the card needs it alongside `isSystemInDarkTheme()`, and keeping * it an ordinary function means it can be read anywhere the note is. */ -fun noteIsStrong(note: Note): Boolean = - noteColorIsChosen(note.color, firstLabelColor(note), NOTE_TINTS.keys) +fun noteIsStrong(note: Note): Boolean = noteColorIsChosen(note.color, firstLabelColor(note), NOTE_TINTS.keys) /** * The colour of the note's FIRST label, already resolved, or "" when it has none. @@ -249,10 +248,10 @@ fun noteIsStrong(note: Note): Boolean = * a chip cannot tell which kind they made, and two identically-tagged notes in * different colours for an invisible reason is worse than the rule being loose. */ -private fun firstLabelColor(note: Note): String = - note.labels.firstOrNull() - ?.let { resolvedLabelColor(it.name, it.color, NOTE_TINTS.keys) } - ?: "" +private fun firstLabelColor(note: Note): String { + val first = note.labels.firstOrNull() ?: return "" + return resolvedLabelColor(first.name, first.color, NOTE_TINTS.keys) +} /** * The tint for a LABEL, derived from its name when nobody has picked one.