Skip to content

Commit

Permalink
Enable only for gradle version after 7.6
Browse files Browse the repository at this point in the history
  • Loading branch information
BraisGabin committed Mar 8, 2024
1 parent e5885ce commit 9065dd9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Expand Up @@ -49,6 +49,7 @@ import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.options.Option
import org.gradle.language.base.plugins.LifecycleBasePlugin
import org.gradle.workers.WorkerExecutor
import org.jetbrains.kotlin.gradle.utils.isGradleVersionAtLeast
import javax.inject.Inject

@CacheableTask
Expand Down Expand Up @@ -175,7 +176,7 @@ abstract class Detekt @Inject constructor(

@TaskAction
fun check() {
if (providers.gradleProperty(USE_WORKER_API).getOrElse("true").toBoolean()) {
if (providers.gradleProperty(USE_WORKER_API).getOrElse(isGradleVersionAtLeast(7, 6).toString()).toBoolean()) {

Check failure

Code scanning / detekt

Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Error

This expression contains a magic number. Consider defining it to a well named constant.

Check failure

Code scanning / detekt

Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Error

This expression contains a magic number. Consider defining it to a well named constant.
logger.info("Executing $name using Worker API")
val workQueue = workerExecutor.processIsolation { workerSpec ->
workerSpec.classpath.from(detektClasspath)
Expand Down
Expand Up @@ -40,6 +40,7 @@ import org.gradle.api.tasks.SourceTask
import org.gradle.api.tasks.TaskAction
import org.gradle.language.base.plugins.LifecycleBasePlugin
import org.gradle.workers.WorkerExecutor
import org.jetbrains.kotlin.gradle.utils.isGradleVersionAtLeast
import javax.inject.Inject

@CacheableTask
Expand Down Expand Up @@ -143,7 +144,7 @@ abstract class DetektCreateBaselineTask @Inject constructor(

@TaskAction
fun baseline() {
if (providers.gradleProperty(USE_WORKER_API).getOrElse("true").toBoolean()) {
if (providers.gradleProperty(USE_WORKER_API).getOrElse(isGradleVersionAtLeast(7, 6).toString()).toBoolean()) {

Check failure

Code scanning / detekt

Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Error

This expression contains a magic number. Consider defining it to a well named constant.

Check failure

Code scanning / detekt

Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Error

This expression contains a magic number. Consider defining it to a well named constant.
logger.info("Executing $name using Worker API")
val workQueue = workerExecutor.processIsolation { workerSpec ->
workerSpec.classpath.from(detektClasspath)
Expand Down
Expand Up @@ -17,6 +17,7 @@ import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
import org.gradle.language.base.plugins.LifecycleBasePlugin
import org.gradle.workers.WorkerExecutor
import org.jetbrains.kotlin.gradle.utils.isGradleVersionAtLeast
import java.nio.file.Files
import javax.inject.Inject

Expand Down Expand Up @@ -55,7 +56,7 @@ abstract class DetektGenerateConfigTask @Inject constructor(

Files.createDirectories(configFile.get().asFile.parentFile.toPath())

if (providers.gradleProperty(USE_WORKER_API).getOrElse("true").toBoolean()) {
if (providers.gradleProperty(USE_WORKER_API).getOrElse(isGradleVersionAtLeast(7, 6).toString()).toBoolean()) {

Check failure

Code scanning / detekt

Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Error

This expression contains a magic number. Consider defining it to a well named constant.

Check failure

Code scanning / detekt

Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Error

This expression contains a magic number. Consider defining it to a well named constant.
logger.info("Executing $name using Worker API")
val workQueue = workerExecutor.processIsolation { workerSpec ->
workerSpec.classpath.from(detektClasspath)
Expand Down

0 comments on commit 9065dd9

Please sign in to comment.