Use Android TV linter configuration

This commit is contained in:
Niels van Velzen
2026-06-07 16:19:28 +02:00
committed by Niels van Velzen
parent ed67292a8f
commit c877eea35d
4 changed files with 55 additions and 95 deletions
+7 -22
View File
@@ -1,33 +1,18 @@
root = true root = true
[*] [*]
end_of_line = lf
insert_final_newline = true insert_final_newline = true
ij_visual_guides = 120 max_line_length = 140
trim_trailing_whitespace = true
[*.bat] [{*.kts,*.kt}]
end_of_line = crlf
[*.{kt,kts,java}]
charset = utf-8 charset = utf-8
indent_style = space indent_style = space
indent_size = 4 indent_size = 4
max_line_length = 200 # Prefer manual wrapping # Disable wildcard imports in IntelliJ/Android Studio
trim_trailing_whitespace = true ij_kotlin_name_count_to_use_star_import = 1000
ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL ij_kotlin_name_count_to_use_star_import_for_members = 1000
ij_kotlin_allow_trailing_comma = true ij_kotlin_packages_to_use_import_on_demand = unset
ij_kotlin_allow_trailing_comma_on_call_site = true
ij_kotlin_blank_lines_around_block_when_branches = 0
ij_kotlin_line_break_after_multiline_when_entry = false
ij_kotlin_indent_before_arrow_on_new_line = false
ij_kotlin_name_count_to_use_star_import = 999
ij_kotlin_name_count_to_use_star_import_for_members = 999
ij_kotlin_packages_to_use_import_on_demand =
[*.json]
charset = utf-8
indent_style = space
indent_size = 2
[{*.md,*.yaml,*.yml}] [{*.md,*.yaml,*.yml}]
trim_trailing_whitespace = false trim_trailing_whitespace = false
+17 -11
View File
@@ -14,9 +14,9 @@ plugins {
detekt { detekt {
buildUponDefaultConfig = true buildUponDefaultConfig = true
allRules = false ignoreFailures = true
config.setFrom("${rootProject.projectDir}/detekt.yml") config.setFrom(files("$rootDir/detekt.yaml"))
autoCorrect = true parallel = true
} }
kotlin { kotlin {
@@ -90,16 +90,20 @@ android {
viewBinding = true viewBinding = true
compose = true compose = true
} }
compileOptions { compileOptions {
sourceCompatibility = JavaVersion.VERSION_11 sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11
isCoreLibraryDesugaringEnabled = true isCoreLibraryDesugaringEnabled = true
} }
lint { lint {
lintConfig = file("$rootDir/android-lint.xml") lintConfig = file("$rootDir/android-lint.xml")
abortOnError = false abortOnError = false
sarifReport = true sarifReport = true
checkDependencies = true
} }
room { room {
schemaDirectory("$projectDir/schemas") schemaDirectory("$projectDir/schemas")
} }
@@ -177,22 +181,24 @@ dependencies {
tasks { tasks {
withType<Detekt> { withType<Detekt> {
jvmTarget = JavaVersion.VERSION_11.toString()
reports { reports {
html.required.set(true)
xml.required.set(false)
txt.required.set(true)
sarif.required.set(true) sarif.required.set(true)
} }
} }
// Testing // Testing
withType<Test> { withType<Test> {
useJUnitPlatform() useJUnit()
testLogging { testLogging {
outputs.upToDateWhen { false } events(
showStandardStreams = true org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED,
org.gradle.api.tasks.testing.logging.TestLogEvent.STANDARD_ERROR,
org.gradle.api.tasks.testing.logging.TestLogEvent.SKIPPED
)
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
showExceptions = true
showCauses = true
showStackTraces = true
} }
} }
+31
View File
@@ -0,0 +1,31 @@
build:
maxIssues: 0
comments:
# Comments are always appreciated, even for private functions and properties
CommentOverPrivateFunction:
active: false
CommentOverPrivateProperty:
active: false
complexity:
# Some classes, especially repositories, can become big
TooManyFunctions:
thresholdInInterfaces: 15
thresholdInClasses: 15
naming:
InvalidPackageDeclaration:
active: false
FunctionNaming:
ignoreAnnotated:
- Composable
style:
# Allow TODO and FIXME comments
ForbiddenComment:
values: [ 'STOPSHIP:' ]
ReturnCount:
max: 6
MaxLineLength:
maxLineLength: 140
-62
View File
@@ -1,62 +0,0 @@
build:
maxIssues: 0
complexity:
CyclomaticComplexMethod:
ignoreSimpleWhenEntries: true
LongParameterList:
constructorThreshold: 10
functionThreshold: 10
TooManyFunctions:
thresholdInFiles: 16
thresholdInClasses: 20
thresholdInInterfaces: 8
thresholdInObjects: 16
thresholdInEnums: 8
ignoreOverridden: true
ignoreDeprecated: true
exceptions:
SwallowedException:
active: false
formatting:
MaximumLineLength:
# Already handled by detekt itself
active: false
NoWildcardImports:
# Already handled by detekt itself
active: false
PackageName:
# Already handled by detekt itself
active: false
TrailingCommaOnCallSite:
active: true
useTrailingCommaOnCallSite: true
TrailingCommaOnDeclarationSite:
active: true
useTrailingCommaOnDeclarationSite: true
naming:
FunctionNaming:
ignoreAnnotated:
- Composable
PackageNaming:
# Package names must be lowercase letters
packagePattern: '[a-z]+(\.[a-z]+)*'
performance:
SpreadOperator:
active: false
style:
ForbiddenComment:
# Allow TODOs
comments: [ 'FIXME:', 'STOPSHIP:' ]
LoopWithTooManyJumpStatements:
maxJumpCount: 2
MaxLineLength:
maxLineLength: 200
ReturnCount:
excludeGuardClauses: true
max: 3