android: two more ktlint rules, both in the code I just added
`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 <noreply@anthropic.com>
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user