refactor(build): simplify lint, spotless, and detekt configurations (#3133)

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
James Rich 2025-09-17 16:43:23 -05:00 committed by GitHub
parent df90256959
commit e4bfce0989
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 11 additions and 15 deletions

View file

@ -21,20 +21,16 @@ import android.widget.EditText
import com.geeksville.mesh.ConfigProtos
/**
* When printing strings to logs sometimes we want to print useful debugging information about users
* or positions. But we don't want to leak things like usernames or locations. So this function
* if given a string, will return a string which is a maximum of three characters long, taken from the tail
* of the string. Which should effectively hide real usernames and locations,
* but still let us see if values were zero, empty or different.
* When printing strings to logs sometimes we want to print useful debugging information about users or positions. But
* we don't want to leak things like usernames or locations. So this function if given a string, will return a string
* which is a maximum of three characters long, taken from the tail of the string. Which should effectively hide real
* usernames and locations, but still let us see if values were zero, empty or different.
*/
val Any?.anonymize: String
get() = this.anonymize()
/**
* A version of anonymize that allows passing in a custom minimum length
*/
fun Any?.anonymize(maxLen: Int = 3) =
if (this != null) ("..." + this.toString().takeLast(maxLen)) else "null"
/** A version of anonymize that allows passing in a custom minimum length */
fun Any?.anonymize(maxLen: Int = 3) = if (this != null) ("..." + this.toString().takeLast(maxLen)) else "null"
// A toString that makes sure all newlines are removed (for nice logging).
fun Any.toOneLineString() = this.toString().replace('\n', ' ')
@ -66,7 +62,6 @@ fun formatAgo(lastSeenUnix: Int, currentTimeMillis: Long = System.currentTimeMil
// Allows usage like email.onEditorAction(EditorInfo.IME_ACTION_NEXT, { confirm() })
fun EditText.onEditorAction(actionId: Int, func: () -> Unit) {
setOnEditorActionListener { _, receivedActionId, _ ->
if (actionId == receivedActionId) {
func()
}