Upgrade to Pro — share decks privately, control downloads, hide ads and more …

detektを使用して循環的複雑度を計測する

aAkiRa
July 27, 2023

 detektを使用して循環的複雑度を計測する

aAkiRa

July 27, 2023
Tweet

Other Decks in Programming

Transcript

  1. potatotips #
    8
    3
    iOS/Android Tips
    detekt

    View full-size slide



  2. detekt


    detekt

    View full-size slide

  3. 1




    if for
    IUUQTKQNBUIXPSLTDPNEJTDPWFSZDZDMPNBUJDDPNQMFYJUZIUNM

    View full-size slide





  4. IUUQTKQNBUIXPSLTDPNEJTDPWFSZDZDMPNBUJDDPNQMFYJUZIUNM

    View full-size slide

  5. detekt
    Kotlin



    ktlint
    IUUQTEFUFLUEFWEPDTJOUSP

    View full-size slide

  6. detekt
    Gradle


    detekt Con
    fi
    guration File

    View full-size slide

  7. detekt
    Gradle


    detekt Con
    fi
    guration File

    View full-size slide

  8. Detekt Gradle Plugin
    build.gradle
    plugins {
    id "io.gitlab.arturbosch.detekt" version “1.23.0"
    }
    Groovy DSL ⾒

    View full-size slide

  9. subprojects {
    apply plugin: “io.gitlab.arturbosch.detekt”.
    detekt {
    config.setFrom(file("$rootDir/config/detekt/detekt.yml"))
    buildUponDefaultConfig = true
    ignoreFailures = true
    basePath = “$buildDir/reports/detekt"
    }
    }
    detekt
    detekt
    Groovy DSL ⾒
    detekt con
    fi
    guration
    fi
    le
    con
    fi
    guration
    fi
    le


    build
    (build )

    View full-size slide

  10. detekt
    Gradle


    detekt Con
    fi
    guration File

    View full-size slide

  11. detekt Configuration File
    detekt YAML
    build:
    maxIssues: 100
    excludeCorrectable: false
    weights:
    # complexity: 2
    # LongParameterList: 1
    # style: 1
    # comments: 1
    config:
    validation: true
    warningsAsErrors: false
    checkExhaustiveness: false
    excludes: ‘'
    processors:
    active: true
    exclude:
    - ‘DetektProgressListener'
    # - ‘KtFileCountProcessor'
    # - ‘PackageCountProcessor'
    # - ‘ClassCountProcessor'
    # - ‘FunctionCountProcessor'
    # - ‘PropertyCountProcessor’.
    # - ‘ProjectComplexityProcessor'
    # - ‘ProjectLLOCProcessor'
    # - ‘ProjectCLOCProcessor'


    800
    ɾ
    ɾ
    ɾ

    View full-size slide

  12. Rule Set
    detekt Configuration File
    Rule Set 12
    Rule Set
    Rule
    Con
    fi
    guration File

    View full-size slide

  13. detekt Configuration File
    ./gradlew detektGenerateCon
    fi
    g
    buildUponDefaultConfig = true
    build.gradle
    config.setFrom(file(“$rootDir/config/detekt/detekt.yml"))
    detekt {ɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹ
    config.setFrom(file(“$rootDir/config/detekt/detekt.yml”))
    buildUponDefaultConfig = trueɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹ
    parallel = trueɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹ
    ignoreFailures = trueɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹ
    basePath = “$buildDir/reports/detekt"ɹɹɹɹɹɹɹɹɹɹɹɹ
    }ɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹ
    build.gradle

    View full-size slide

  14. detekt
    ./gradlew detekt

    View full-size slide



  15. detekt


    detekt

    View full-size slide