Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies, migrate code, remember AnnotatedString, remove redundant flowtext/proguard & Manifest files, migrate to version catalog & kotlin dsl #9

Merged
merged 13 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions build.gradle

This file was deleted.

34 changes: 34 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
plugins {
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.android.application) apply false
alias(libs.plugins.io.gitlab.arturbosch.detekt)
alias(libs.plugins.com.diffplug.spotless)
alias(libs.plugins.com.vanniktech.maven.publish)
}

subprojects {
apply(plugin = rootProject.libs.plugins.com.diffplug.spotless.get().pluginId)
apply(plugin = rootProject.libs.plugins.io.gitlab.arturbosch.detekt.get().pluginId)

spotless {
kotlin {
target("**/*.kt")
ktlint("1.3.0")
.editorConfigOverride(
mapOf(
"ij_kotlin_allow_trailing_comma" to "true",
"ij_kotlin_allow_trailing_comma_on_call_site" to "true",
"ktlint_code_style" to "android_studio",
"ktlint_standard_property-naming" to "disabled",
"ktlint_standard_class-signature" to "disabled",
"ktlint_function_naming_ignore_when_annotated_with" to "Composable",
),
)
}
}

dependencies {
detektPlugins(rootProject.libs.detekt.libraries)
}
}
71 changes: 33 additions & 38 deletions config/detekt/detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ complexity:
threshold: 10
includeStaticDeclarations: false
includePrivateDeclarations: false
ComplexMethod:
CyclomaticComplexMethod:
active: true
threshold: 15
ignoreSingleWhenExpression: false
Expand Down Expand Up @@ -285,7 +285,6 @@ naming:
BooleanPropertyNaming:
active: false
allowedPattern: '^(is|has|are)'
ignoreOverridden: true
ClassNaming:
active: true
classPattern: '[A-Z][a-zA-Z0-9]*'
Expand All @@ -294,7 +293,6 @@ naming:
parameterPattern: '[a-z][A-Za-z0-9]*'
privateParameterPattern: '[a-z][A-Za-z0-9]*'
excludeClassPattern: '$^'
ignoreOverridden: true
EnumNaming:
active: true
enumEntryPattern: '[A-Z][_a-zA-Z0-9]*'
Expand All @@ -312,13 +310,11 @@ naming:
excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
functionPattern: '[a-z][a-zA-Z0-9]*'
excludeClassPattern: '$^'
ignoreOverridden: true
ignoreAnnotated: [ 'Composable' ]
FunctionParameterNaming:
active: true
parameterPattern: '[a-z][A-Za-z0-9]*'
excludeClassPattern: '$^'
ignoreOverridden: true
InvalidPackageDeclaration:
active: false
rootPackage: ''
Expand Down Expand Up @@ -360,7 +356,6 @@ naming:
variablePattern: '[a-z][A-Za-z0-9]*'
privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*'
excludeClassPattern: '$^'
ignoreOverridden: true

performance:
active: true
Expand Down Expand Up @@ -398,8 +393,6 @@ potential-bugs:
- 'java.util.HashSet'
- 'java.util.LinkedHashMap'
- 'java.util.HashMap'
DuplicateCaseInWhenExpression:
active: true
ElseCaseInsteadOfExhaustiveWhen:
active: false
EqualsAlwaysReturnsTrueOrFalse:
Expand All @@ -414,7 +407,7 @@ potential-bugs:
active: false
IgnoredReturnValue:
active: false
restrictToAnnotatedMethods: true
restrictToConfig: true
returnValueAnnotations:
- '*.CheckResult'
- '*.CheckReturnValue'
Expand All @@ -441,15 +434,10 @@ potential-bugs:
MissingPackageDeclaration:
active: false
excludes: ['**/*.kts']
MissingWhenCase:
active: true
allowElseExpression: true
NullCheckOnMutableProperty:
active: false
NullableToStringCall:
active: false
RedundantElseInWhen:
active: true
UnconditionalJumpStatementInLoop:
active: false
UnnecessaryNotNullOperator:
Expand Down Expand Up @@ -482,7 +470,7 @@ style:
active: false
DataClassContainsFunctions:
active: false
conversionFunctionPrefix: 'to'
conversionFunctionPrefix: [ 'to' ]
DataClassShouldBeImmutable:
active: false
DestructuringDeclarationWithTooManyEntries:
Expand All @@ -501,12 +489,18 @@ style:
includeLineWrapping: false
ForbiddenComment:
active: true
values:
- 'FIXME:'
- 'STOPSHIP:'
- 'TODO:'
allowedPatterns: ''
customMessage: ''
comments:
- value: 'FIXME:'
reason: 'Forbidden FIXME todo marker in comment, please fix the problem.'
- value: 'STOPSHIP:'
reason: 'Forbidden STOPSHIP todo marker in comment, please address the problem before shipping the code.'
- value: 'TODO:'
reason: 'Forbidden TODO todo marker in comment, please do the changes.'
- value: '@author'
reason: 'Authors are not recorded in KDoc.'
- value: '@requiresTypeResolution'
reason: 'Use @RequiresTypeResolution annotation on the class instead.'
excludes: []
ForbiddenImport:
active: false
imports: []
Expand All @@ -516,12 +510,6 @@ style:
methods:
- 'kotlin.io.print'
- 'kotlin.io.println'
ForbiddenPublicDataClass:
active: true
excludes: ['**']
ignorePackages:
- '*.internal'
- '*.internal.*'
ForbiddenVoid:
active: false
ignoreOverridden: false
Expand All @@ -530,13 +518,7 @@ style:
active: true
ignoreOverridableFunction: true
ignoreActualFunction: true
excludedFunctions: ''
LibraryCodeMustSpecifyReturnType:
active: true
excludes: ['**']
LibraryEntitiesShouldNotBePublic:
active: true
excludes: ['**']
excludedFunctions: ['']
LoopWithTooManyJumpStatements:
active: true
maxJumpCount: 1
Expand All @@ -558,8 +540,6 @@ style:
ignoreEnums: false
ignoreRanges: false
ignoreExtensionFunctions: true
MandatoryBracesIfStatements:
active: false
MandatoryBracesLoops:
active: false
MaxLineLength:
Expand All @@ -586,7 +566,7 @@ style:
active: true
OptionalUnit:
active: false
OptionalWhenBraces:
BracesOnWhenStatements:
active: false
PreferToOverPairSyntax:
active: false
Expand All @@ -601,7 +581,7 @@ style:
ReturnCount:
active: true
max: 2
excludedFunctions: 'equals'
excludedFunctions: ['equals']
excludeLabeled: false
excludeReturnFromLambda: true
excludeGuardClauses: false
Expand Down Expand Up @@ -682,3 +662,18 @@ style:
excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
excludeImports:
- 'java.util.*'

libraries:
active: true
ForbiddenPublicDataClass:
active: true
excludes: [ '**' ]
ignorePackages:
- '*.internal'
- '*.internal.*'
LibraryEntitiesShouldNotBePublic:
active: true
excludes: ['**']
LibraryCodeMustSpecifyReturnType:
active: true
excludes: ['**']
55 changes: 0 additions & 55 deletions demo/build.gradle

This file was deleted.

56 changes: 56 additions & 0 deletions demo/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
plugins {
alias(libs.plugins.kotlin.android)
alias(libs.plugins.android.application)
}

kotlin {
jvmToolchain(libs.versions.java.get().toInt())
}

android {
namespace = "eu.wewox.textflow"
compileSdk = libs.versions.compileSdk.get().toInt()

defaultConfig {
applicationId = "eu.wewox.textflow"
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.targetSdk.get().toInt()
versionCode = 1
versionName = "1.0"

vectorDrawables {
useSupportLibrary = true
}
}
buildTypes {
named("release") {
isMinifyEnabled = false
setProguardFiles(listOf(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"))
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}

dependencies {
implementation(project(":textflow"))

implementation(libs.compose.ui)
implementation(libs.compose.foundation)
implementation(libs.compose.material)
implementation(libs.accompanist.systemuicontroller)
implementation(libs.activity.compose)
}
2 changes: 0 additions & 2 deletions demo/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.TextFlow">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Expand Down
Loading