chore: ignore extra translations and update detekt rules

* chore: ignore extra translations in lint

Extra translations are removed automatically by Weblate

* chore: update detekt rules

More compose-friendly

* chore: update lint baselines
This commit is contained in:
Naveen Singh
2025-07-03 21:16:27 +05:30
committed by GitHub
parent 7d1f4c5eed
commit 769c0dbb6a
6 changed files with 74 additions and 27 deletions

View File

@@ -128,6 +128,9 @@ android {
detekt {
baseline = file("detekt-baseline.xml")
config.setFrom("$rootDir/detekt.yml")
buildUponDefaultConfig = true
allRules = false
}
dependencies {
@@ -139,4 +142,5 @@ dependencies {
implementation(libs.gestureviews)
implementation(libs.autofittextview)
implementation(libs.zip4j)
detektPlugins(libs.compose.detekt)
}

View File

@@ -22,10 +22,6 @@
<ID>EmptyFunctionBlock:MimeTypesActivity.kt$MimeTypesActivity${}</ID>
<ID>EmptyFunctionBlock:StorageFragment.kt$StorageFragment${}</ID>
<ID>LargeClass:ItemsAdapter.kt$ItemsAdapter : MyRecyclerViewAdapterOnPopupTextUpdate</ID>
<ID>LongMethod:DecompressActivity.kt$DecompressActivity$private fun fillAllListItems(uri: Uri, callback: () -&gt; Unit)</ID>
<ID>LongMethod:ItemsAdapter.kt$ItemsAdapter$@SuppressLint("NewApi") private fun compressPaths(sourcePaths: List&lt;String&gt;, targetPath: String, password: String? = null): Boolean</ID>
<ID>LongMethod:MimeTypesActivity.kt$MimeTypesActivity$private fun getProperFileDirItems(callback: (ArrayList&lt;FileDirItem&gt;) -&gt; Unit)</ID>
<ID>LongParameterList:ItemsAdapter.kt$ItemsAdapter$( activity: SimpleActivity, var listItems: MutableList&lt;ListItem&gt;, private val listener: ItemOperationsListener?, recyclerView: MyRecyclerView, private val isPickMultipleIntent: Boolean, private val swipeRefreshLayout: SwipeRefreshLayout?, canHaveIndividualViewType: Boolean = true, itemClick: (Any) -&gt; Unit, )</ID>
<ID>LoopWithTooManyJumpStatements:DecompressActivity.kt$DecompressActivity$while</ID>
<ID>LoopWithTooManyJumpStatements:StorageFragment.kt$StorageFragment$do</ID>
<ID>MagicNumber:Config.kt$Config$1.2f</ID>
@@ -39,15 +35,11 @@
<ID>MagicNumber:ItemsAdapter.kt$ItemsAdapter$180</ID>
<ID>MagicNumber:ItemsAdapter.kt$ItemsAdapter$4</ID>
<ID>MagicNumber:ItemsFragment.kt$ItemsFragment$3</ID>
<ID>MagicNumber:Long.kt$1000.0</ID>
<ID>MagicNumber:MimeTypesActivity.kt$MimeTypesActivity$1000</ID>
<ID>MagicNumber:ReadTextActivity.kt$ReadTextActivity$250</ID>
<ID>MagicNumber:ReadTextActivity.kt$ReadTextActivity$50</ID>
<ID>MagicNumber:RecentsFragment.kt$RecentsFragment$1000</ID>
<ID>MagicNumber:RecentsFragment.kt$RecentsFragment$3</ID>
<ID>MagicNumber:RecentsFragment.kt$RecentsFragment$50</ID>
<ID>MagicNumber:RootHelpers.kt$RootHelpers.&lt;no name provided&gt;$5</ID>
<ID>MagicNumber:StorageFragment.kt$StorageFragment$1000</ID>
<ID>MagicNumber:StorageFragment.kt$StorageFragment$100000</ID>
<ID>MagicNumber:StorageFragment.kt$StorageFragment$2000</ID>
<ID>MagicNumber:StorageFragment.kt$StorageFragment$3</ID>

View File

@@ -30,21 +30,10 @@
errorLine2=" ~~~~">
<location
file="$HOME/Projects/Fossify/FossifyOrg/File-Manager/gradle/libs.versions.toml"
line="21"
line="22"
column="23"/>
</issue>
<issue
id="UnusedAttribute"
message="Attribute `localeConfig` is only used in API level 33 and higher (current min is 26)"
errorLine1=" android:localeConfig=&quot;@xml/locale_config&quot;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/AndroidManifest.xml"
line="25"
column="9"/>
</issue>
<issue
id="CustomSplashScreen"
message="The application should not provide its own launch screen"
@@ -68,14 +57,14 @@
</issue>
<issue
id="GradleDependency"
message="A newer version of org.fossify:commons than 3.0.5 is available: 3.1.0"
errorLine1="commons = &quot;3.0.5&quot;"
errorLine2=" ~~~~~~~">
id="AndroidGradlePluginVersion"
message="A newer version of com.android.application than 8.10.1 is available: 8.11.0"
errorLine1="gradlePlugins-agp = &quot;8.10.1&quot;"
errorLine2=" ~~~~~~~~">
<location
file="$HOME/Projects/Fossify/FossifyOrg/File-Manager/gradle/libs.versions.toml"
line="10"
column="11"/>
line="19"
column="21"/>
</issue>
<issue
@@ -85,7 +74,7 @@
errorLine2=" ~~~~">
<location
file="$HOME/Projects/Fossify/FossifyOrg/File-Manager/gradle/libs.versions.toml"
line="20"
line="21"
column="31"/>
</issue>

58
detekt.yml Normal file
View File

@@ -0,0 +1,58 @@
build:
maxIssues: 0
weights:
complexity: 2
LongParameterList: 2
style: 1
processors:
active: true
exclude:
- "FunctionCountProcessor"
- "PropertyCountProcessor"
config:
validation: true
complexity:
LongParameterList:
active: true
functionThreshold: 10
constructorThreshold: 8
ignoreDefaultParameters: true
ignoreAnnotated:
- "Composable"
LongMethod:
active: true
threshold: 120
ignoreAnnotated:
- "Composable"
- "Preview"
style:
MagicNumber:
active: true
ignoreAnnotated: ["Composable"]
ignoreEnums: true
ignoreNumbers: ["-1", "0", "1", "2", "42", "1000"]
MaxLineLength:
active: true
maxLineLength: 120
excludePackageStatements: true
excludeImportStatements: true
naming:
FunctionNaming:
active: true
ignoreAnnotated: ["Composable", "Preview"]
functionPattern: "[a-z][A-Za-z0-9]*"
Compose: # io.nlopez.compose.rules
ComposableParametersOrdering:
active: true
ModifierDefaultValue:
active: true
MissingModifierDefaultValue:
active: true
PublicComposablePreview:
active: true

View File

@@ -3,6 +3,7 @@
kotlin = "2.2.0"
#Detekt
detekt = "1.23.8"
detektCompose = "0.4.22"
#AndroidX
androidx-swiperefreshlayout = "1.1.0"
androidx-documentfile = "1.1.0"
@@ -26,6 +27,8 @@ app-build-kotlinJVMTarget = "17"
#AndroidX
androidx-swiperefreshlayout = { module = "androidx.swiperefreshlayout:swiperefreshlayout", version.ref = "androidx-swiperefreshlayout" }
androidx-documentfile = { module = "androidx.documentfile:documentfile", version.ref = "androidx-documentfile" }
#Compose
compose-detekt = { module = "io.nlopez.compose.rules:detekt", version.ref = "detektCompose" }
#Fossify
fossify-commons = { module = "org.fossify:commons", version.ref = "commons" }
#Other

View File

@@ -31,4 +31,5 @@
<issue id="IconDensities" severity="warning" />
<issue id="GradleDependency" severity="warning" />
<issue id="Overdraw" severity="warning" />
<issue id="ExtraTranslation" severity="warning" />
</lint>