diff --git a/.editorconfig b/.editorconfig index ccf87c0b..dca15928 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,33 +1,18 @@ root = true [*] -end_of_line = lf insert_final_newline = true -ij_visual_guides = 120 +max_line_length = 140 +trim_trailing_whitespace = true -[*.bat] -end_of_line = crlf - -[*.{kt,kts,java}] +[{*.kts,*.kt}] charset = utf-8 indent_style = space indent_size = 4 -max_line_length = 200 # Prefer manual wrapping -trim_trailing_whitespace = true -ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL -ij_kotlin_allow_trailing_comma = true -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 +# Disable wildcard imports in IntelliJ/Android Studio +ij_kotlin_name_count_to_use_star_import = 1000 +ij_kotlin_name_count_to_use_star_import_for_members = 1000 +ij_kotlin_packages_to_use_import_on_demand = unset [{*.md,*.yaml,*.yml}] trim_trailing_whitespace = false diff --git a/app/build.gradle.kts b/app/build.gradle.kts index f1a98fd1..b462365d 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -14,9 +14,9 @@ plugins { detekt { buildUponDefaultConfig = true - allRules = false - config.setFrom("${rootProject.projectDir}/detekt.yml") - autoCorrect = true + ignoreFailures = true + config.setFrom(files("$rootDir/detekt.yaml")) + parallel = true } kotlin { @@ -90,16 +90,20 @@ android { viewBinding = true compose = true } + compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 isCoreLibraryDesugaringEnabled = true } + lint { lintConfig = file("$rootDir/android-lint.xml") abortOnError = false sarifReport = true + checkDependencies = true } + room { schemaDirectory("$projectDir/schemas") } @@ -177,22 +181,24 @@ dependencies { tasks { withType { - jvmTarget = JavaVersion.VERSION_11.toString() - reports { - html.required.set(true) - xml.required.set(false) - txt.required.set(true) sarif.required.set(true) } } // Testing withType { - useJUnitPlatform() + useJUnit() testLogging { - outputs.upToDateWhen { false } - showStandardStreams = true + events( + 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 } } diff --git a/detekt.yaml b/detekt.yaml new file mode 100644 index 00000000..9440c1b9 --- /dev/null +++ b/detekt.yaml @@ -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 diff --git a/detekt.yml b/detekt.yml deleted file mode 100644 index 88cc9863..00000000 --- a/detekt.yml +++ /dev/null @@ -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