Detecting deprecated code via detekt and fixed detekt detection for the issues in project, and refactored deprecated rules of detekt

This commit is contained in:
MohitMali 2023-07-04 19:08:33 +05:30 committed by Kelson
parent 73fe388514
commit af23cf56b7
4 changed files with 17 additions and 8 deletions

View File

@ -72,7 +72,7 @@ jobs:
${{ runner.os }}-gradle- ${{ runner.os }}-gradle-
- name: Static Analysis - name: Static Analysis
run: ./gradlew detekt run: ./gradlew detektDebug detektCustomExampleDebug
- name: Upload Lint Reports - name: Upload Lint Reports
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
if: ${{ always() }} if: ${{ always() }}

View File

@ -22,6 +22,8 @@ import Config
import Libs import Libs
import com.android.build.api.dsl.CommonExtension import com.android.build.api.dsl.CommonExtension
import com.android.build.gradle.BaseExtension import com.android.build.gradle.BaseExtension
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask
import io.gitlab.arturbosch.detekt.extensions.DetektExtension import io.gitlab.arturbosch.detekt.extensions.DetektExtension
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.kotlin.dsl.apply import org.gradle.kotlin.dsl.apply
@ -67,6 +69,12 @@ class AllProjectConfigurer {
target.tasks.withType(KotlinCompile::class.java) { target.tasks.withType(KotlinCompile::class.java) {
kotlinOptions.jvmTarget = "1.8" kotlinOptions.jvmTarget = "1.8"
} }
target.tasks.withType(Detekt::class.java).configureEach {
jvmTarget = "1.8"
}
target.tasks.withType(DetektCreateBaselineTask::class.java).configureEach {
jvmTarget = "1.8"
}
buildFeatures.viewBinding = true buildFeatures.viewBinding = true
testOptions { testOptions {

View File

@ -79,7 +79,8 @@ complexity:
threshold: 60 threshold: 60
LongParameterList: LongParameterList:
active: true active: true
threshold: 6 functionThreshold: 6
constructorThreshold: 6
ignoreDefaultParameters: false ignoreDefaultParameters: false
MethodOverloading: MethodOverloading:
active: false active: false
@ -316,7 +317,7 @@ potential-bugs:
LateinitUsage: LateinitUsage:
active: false active: false
excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
excludeAnnotatedProperties: "" ignoreAnnotated: []
ignoreOnClassesPattern: "" ignoreOnClassesPattern: ""
MapGetWithNotNullAssertionOperator: MapGetWithNotNullAssertionOperator:
active: false active: false
@ -379,7 +380,7 @@ style:
active: true active: true
ignoreOverridableFunction: true ignoreOverridableFunction: true
excludedFunctions: 'describeContents' excludedFunctions: 'describeContents'
excludeAnnotatedFunction: "dagger.Provides" ignoreAnnotated: ["dagger.Provides"]
LibraryCodeMustSpecifyReturnType: LibraryCodeMustSpecifyReturnType:
active: true active: true
LoopWithTooManyJumpStatements: LoopWithTooManyJumpStatements:
@ -450,10 +451,10 @@ style:
active: false active: false
UnderscoresInNumericLiterals: UnderscoresInNumericLiterals:
active: false active: false
acceptableDecimalLength: 5 acceptableLength: 5
UnnecessaryAbstractClass: UnnecessaryAbstractClass:
active: true active: true
excludeAnnotatedClasses: "dagger.Module" ignoreAnnotated: ["dagger.Module"]
UnnecessaryAnnotationUseSiteTarget: UnnecessaryAnnotationUseSiteTarget:
active: false active: false
UnnecessaryApply: UnnecessaryApply:
@ -479,7 +480,7 @@ style:
active: false active: false
UseDataClass: UseDataClass:
active: false active: false
excludeAnnotatedClasses: "" ignoreAnnotated: []
allowVars: false allowVars: false
UseIfInsteadOfWhen: UseIfInsteadOfWhen:
active: false active: false

View File

@ -2,7 +2,7 @@
echo "Running lint..." echo "Running lint..."
./gradlew ktlintCheck detekt app:lintDebug custom:lintCustomexampleDebug --daemon ./gradlew ktlintCheck detektDebug detektCustomExampleDebug app:lintDebug custom:lintCustomexampleDebug --daemon
status=$? status=$?