• yahyabayramoglu

    yahyabayramoglu

    1 year ago
    Hey folks, I'm trying to write a check. Probably doing some rookie mistake there, but I couldn't find anything similar on stackoverflow nor a similar check in the repo 😅 So, I posted a question here - any help is appreciated 🙏
    yahyabayramoglu
    gammax
    4 replies
    Copy to Clipboard
  • v

    Vivek Krishnan

    1 year ago
    I’m having some trouble setting up detekt in my gradle build script:1. I have added
    id("io.gitlab.arturbosch.detekt") version "1.16.0" apply true
    in my plugins section 2. added
    jcenter()
    into my repositories section 3. In the subproject section, I’ve added a task to register detekAll
    * What went wrong:
    Script compilation errors:
    Line 58:         def autoFix = project.hasProperty('detektAutoFix')
    ^ Expecting an element
    Line 58:         def autoFix = project.hasProperty('detektAutoFix')
    ^ Expecting an element
    Line 55:     tasks.register()
    ^ None of the following functions can be called with the arguments supplied:
    public abstract fun register(p0: String!): TaskProvider<Task!>! defined in org.gradle.api.tasks.TaskContainer
    public abstract fun <T : Task!> register(p0: String!, p1: Class<TypeVariable(T)!>!): TaskProvider<TypeVariable(T)!>! defined in org.gradle.api.tasks.TaskContainer
    public abstract fun <T : Task!> register(p0: String!, p1: Class<TypeVariable(T)!>!, vararg p2: Any!): TaskProvider<TypeVariable(T)!>! defined in org.gradle.api.tasks.TaskContainer
    public abstract fun <T : Task!> register(p0: String!, p1: Class<TypeVariable(T)!>!, p2: Action<in TypeVariable(T)!>!): TaskProvider<TypeVariable(T)!>! defined in org.gradle.api.tasks.TaskContainer
    public abstract fun register(p0: String!, p1: Action<in Task!>!): TaskProvider<Task!>! defined in org.gradle.api.tasks.TaskContainer
    Line 57:     tasks.register("detektAll", io.gitlab.arturbosch.detekt.Detekt) {
    ^ Not enough information to infer type variable T
    Line 57:     tasks.register("detektAll", io.gitlab.arturbosch.detekt.Detekt) {
    ^ Classifier 'Detekt' does not have a companion object, and thus must be initialized here
    Line 58:         def autoFix = project.hasProperty('detektAutoFix')
    ^ Too many characters in a character literal ''detektAutoFix''
    Line 60:         description = "Custom DETEKT build for all modules"
    ^ Variable expected
    Line 61:         parallel = true
    ^ Variable expected
    Line 62:         ignoreFailures = false
    ^ Variable expected
    Line 63:         autoCorrect = autoFix
    ^ Variable expected
    Line 64:         buildUponDefaultConfig = true
    ^ Variable expected
    Line 71:             html.enabled = true
    ^ Variable expected
    Line 72:             xml.enabled = false
    ^ Variable expected
    Line 73:             txt.enabled = false
    ^ Variable expected
    v
    gammax
    4 replies
    Copy to Clipboard
  • v

    Vivek Krishnan

    1 year ago
    import org.gradle.plugins.ide.idea.model.IdeaLanguageLevel
    import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
    import org.springframework.boot.gradle.plugin.SpringBootPlugin
    import org.springframework.boot.gradle.tasks.run.BootRun
    
    plugins {
        base
        id("com.dorongold.task-tree") version "1.4"
        id("org.springframework.boot") version "2.4.1" apply false
        kotlin("jvm") version "1.4.21"
        kotlin("plugin.spring") version "1.4.21" apply false
        id("org.sonarqube") version "3.1.1"
        idea
        jacoco
        id("io.gitlab.arturbosch.detekt") version "1.16.0" apply true
    }
    
    group = "com.abc.engine"
    
    allprojects {
        val runningOnGitlabCI = System.getenv("GITLAB_CI")?.toBoolean() == true
    
        version = when {
            runningOnGitlabCI -> System.getenv("CI_COMMIT_TAG") ?: System.getenv("CI_PIPELINE_ID") ?: "ci_undefined"
            else -> "undefined"
        }
    
        repositories {
            mavenCentral()
            maven(url = "<https://oss.jfrog.org/artifactory/oss-snapshot-local/>")
            jcenter()
        }
    }
    
    val SRC_ENCODING = "UTF-8"
    val SRC_VERSION = 11
    
    idea {
        project {
            jdkName = "$SRC_VERSION"
            languageLevel = IdeaLanguageLevel("$SRC_VERSION")
            vcs = "Git"
        }
    
        module {
            excludeDirs = excludeDirs + file(".gradle/")
        }
    }
    
    subprojects {
        apply(plugin = "kotlin")
        apply(plugin = "jacoco")
        apply(plugin = "detek")
    
    //    tasks.register()
    
    //    tasks.register("detektAll", io.gitlab.arturbosch.detekt.Detekt) {
    //        def autoFix = project.hasProperty('detektAutoFix')
    //
    //        description = "Custom DETEKT build for all modules"
    //        parallel = true
    //        ignoreFailures = false
    //        autoCorrect = autoFix
    //        buildUponDefaultConfig = true
    //        setSource(projectSource)
    //        baseline.set(baselineFile)
    //        config.setFrom(configFile)
    //        include(kotlinFiles)
    //        exclude(resourceFiles, buildFiles)
    //        reports {
    //            html.enabled = true
    //            xml.enabled = false
    //            txt.enabled = false
    //        }
    //    }
    
    //    tasks.register("detektGenerateBaseline", io.gitlab.arturbosch.detekt.DetektCreateBaselineTask) {
    //        description = "Custom DETEKT build to build baseline for all modules"
    //        parallel = true
    //        ignoreFailures = false
    //        buildUponDefaultConfig = true
    //        setSource(projectSource)
    //        baseline.set(baselineFile)
    //        config.setFrom(configFile)
    //        include(kotlinFiles)
    //        exclude(resourceFiles, buildFiles)
    //    }
    
        tasks.withType<Test>().configureEach {
            useJUnitPlatform()
            testLogging {
                events("failed")
            }
            maxParallelForks = Runtime.getRuntime().availableProcessors()
    
        }
    
        tasks.withType<KotlinCompile>().configureEach {
            kotlinOptions {
                jvmTarget = "11"
                kotlinOptions.useIR = true
            }
        }
    
        tasks.withType<BootRun>().configureEach {
            val profiles = System.getenv("SPRING_PROFILES_ACTIVE")
            if (profiles == null || profiles.trim() == "") {
                val springProfilesActive = project.gradle.startParameter.systemPropertiesArgs["spring.profiles.active"]
                        ?: "localdev"
                args = ((args ?: emptyList()) + "--spring.profiles.active=$springProfilesActive")
            }
            jvmArgs = listOf("-Xmx512m")
        }
    
        tasks.check {
            finalizedBy(tasks.jacocoTestReport)
        }
    
        tasks.jacocoTestReport {
            dependsOn(tasks.test)
            reports {
                xml.isEnabled = true
                csv.isEnabled = false
                html.isEnabled = false
            }
        }
    
        // global dependencies configuration
        dependencies {
            "annotationProcessor"(platform(SpringBootPlugin.BOM_COORDINATES))
    
            "implementation"(platform(SpringBootPlugin.BOM_COORDINATES))
            "implementation"(enforcedPlatform("com.amazonaws:aws-java-sdk-bom:1.11.862")) // amazon v1 bom
            "implementation"(enforcedPlatform("software.amazon.awssdk:bom:2.14.19")) // amazon v2 bom
            "implementation"(kotlin("stdlib"))
            "implementation"(kotlin("reflect"))
    
            "compileOnly"(platform(SpringBootPlugin.BOM_COORDINATES))
            "compileOnly"("org.springframework.boot:spring-boot-configuration-processor")
    
            "testImplementation"(platform(SpringBootPlugin.BOM_COORDINATES))
            "testImplementation"("org.junit.jupiter:junit-jupiter-api")
            "testImplementation"("org.junit.jupiter:junit-jupiter-params")
    
            "testRuntimeOnly"(platform(SpringBootPlugin.BOM_COORDINATES))
            "testRuntimeOnly"("org.junit.jupiter:junit-jupiter-engine")
    //        "detektPlugins"("io.gitlab.arturbosch.detekt:detekt-formatting:1.16.0")
        }
    }
    v
    gammax
    6 replies
    Copy to Clipboard
  • Sebastian Kaspari

    Sebastian Kaspari

    1 year ago
    Is anyone already looking into updating
    kotlinx-html-jvm
    to
    0.7.3
    which made it to Maven Central?
    Sebastian Kaspari
    2 replies
    Copy to Clipboard
  • j

    Jakub Chrzanowski

    1 year ago
    Hi folks! Is there any plan for releasing i.e.
    1.16.1
    with https://github.com/detekt/detekt/pull/3455 ?
    j
    gammax
    2 replies
    Copy to Clipboard
  • gammax

    gammax

    1 year ago
    :android-wave: Detekt
    1.17.0-RC1
    is out: https://github.com/detekt/detekt/releases/tag/v1.17.0-RC1 Please test it and report issues if you find any 🙏
    gammax
    c
    +2
    5 replies
    Copy to Clipboard
  • c

    chao

    1 year ago
    c
    o
    4 replies
    Copy to Clipboard
  • m

    mkrussel

    1 year ago
    How would you create a gradle task to run all the detekt targets. I tried.
    val detektAll = tasks.register("detektAll") {
        dependsOn(tasks.withType<io.gitlab.arturbosch.detekt.Detekt>())
    }
    m
    s
    +1
    9 replies
    Copy to Clipboard
  • iamthevoid

    iamthevoid

    1 year ago
    What is the best way to add rule into configuration file to exclude annotated (with certain annotation) functions from check?
    iamthevoid
    5 replies
    Copy to Clipboard
  • iamthevoid

    iamthevoid

    1 year ago
    What actually
    ArgumentListWrapping
    checks?
    iamthevoid
    gammax
    7 replies
    Copy to Clipboard