From 2c57453efd69171995489fbc0a9d00cf85998b46 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 23 Jun 2023 23:00:00 +0200 Subject: [PATCH] Fix detekt issue --- .../dk/ilios/realmfieldnames/FieldNameFormatter.kt | 13 ++++++++++--- .../dk/ilios/realmfieldnames/FileGenerator.kt | 2 +- .../me/gujun/android/span/{span.kt => Span.kt} | 0 3 files changed, 11 insertions(+), 4 deletions(-) rename library/external/span/src/main/kotlin/me/gujun/android/span/{span.kt => Span.kt} (100%) diff --git a/library/external/realmfieldnameshelper/src/main/kotlin/dk/ilios/realmfieldnames/FieldNameFormatter.kt b/library/external/realmfieldnameshelper/src/main/kotlin/dk/ilios/realmfieldnames/FieldNameFormatter.kt index 80ec9f779b..95f0024721 100644 --- a/library/external/realmfieldnameshelper/src/main/kotlin/dk/ilios/realmfieldnames/FieldNameFormatter.kt +++ b/library/external/realmfieldnameshelper/src/main/kotlin/dk/ilios/realmfieldnames/FieldNameFormatter.kt @@ -8,7 +8,8 @@ import java.util.Locale */ class FieldNameFormatter { - @JvmOverloads fun format(fieldName: String?, locale: Locale = Locale.US): String { + @JvmOverloads + fun format(fieldName: String?, locale: Locale = Locale.US): String { if (fieldName == null || fieldName == "") { return "" } @@ -35,7 +36,11 @@ class FieldNameFormatter { currentCodepoint = normalizedFieldName.codePointAt(offset) if (previousCodepoint != null) { - if (Character.isUpperCase(currentCodepoint) && !Character.isUpperCase(previousCodepoint) && previousCodepoint === 'm'.code as Int? && result.length == 1) { + if (Character.isUpperCase(currentCodepoint) && + !Character.isUpperCase(previousCodepoint) && + previousCodepoint === 'm'.code as Int? && + result.length == 1 + ) { // Hungarian notation starting with: mX result.delete(0, 1) result.appendCodePoint(currentCodepoint) @@ -51,7 +56,9 @@ class FieldNameFormatter { } else if (currentCodepoint === '-'.code as Int? || currentCodepoint === '_'.code as Int?) { // Word-separator: x-x or x_x result.append("_") - } else if (Character.isUpperCase(currentCodepoint) && !Character.isUpperCase(previousCodepoint) && Character.isLetterOrDigit(previousCodepoint)) { + } else if (Character.isUpperCase(currentCodepoint) && !Character.isUpperCase(previousCodepoint) && Character.isLetterOrDigit( + previousCodepoint + )) { // camelCase: xX result.append("_") result.appendCodePoint(currentCodepoint) diff --git a/library/external/realmfieldnameshelper/src/main/kotlin/dk/ilios/realmfieldnames/FileGenerator.kt b/library/external/realmfieldnameshelper/src/main/kotlin/dk/ilios/realmfieldnames/FileGenerator.kt index eeeb5a45b8..2ddba1ccbd 100644 --- a/library/external/realmfieldnameshelper/src/main/kotlin/dk/ilios/realmfieldnames/FileGenerator.kt +++ b/library/external/realmfieldnameshelper/src/main/kotlin/dk/ilios/realmfieldnames/FileGenerator.kt @@ -62,7 +62,7 @@ class FileGenerator(private val filer: Filer) { javaFile.writeTo(filer) return true } catch (e: IOException) { - e.printStackTrace() + // e.printStackTrace() return false } } diff --git a/library/external/span/src/main/kotlin/me/gujun/android/span/span.kt b/library/external/span/src/main/kotlin/me/gujun/android/span/Span.kt similarity index 100% rename from library/external/span/src/main/kotlin/me/gujun/android/span/span.kt rename to library/external/span/src/main/kotlin/me/gujun/android/span/Span.kt