Giter Site home page Giter Site logo

sczerwinski / detekt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from detekt/detekt

0.0 2.0 0.0 19.13 MB

Static code analysis for Kotlin

Home Page: https://detekt.github.io

License: Apache License 2.0

Kotlin 99.72% Groovy 0.10% HTML 0.17% CSS 0.01% Shell 0.01%

detekt's Introduction

detekt

Join the chat at https://kotlinlang.slack.com/messages/C88E12QH4/convo/C0BQ5GZ0S-1511956674.000289/ Visit the website at https://detekt.github.io/detekt/ Maven Central gradle plugin

Pre Merge Checks codecov CodeFactor FOSSA Status Awesome Kotlin Badge dependabot

Meet detekt, a static code analysis tool for the Kotlin programming language. It operates on the abstract syntax tree provided by the Kotlin compiler.

detekt in action

Features

  • Code smell analysis for your Kotlin projects
  • Complexity reports based on lines of code, cyclomatic complexity and amount of code smells
  • Highly configurable rule sets
  • Suppression of findings with Kotlin's @Suppress and Java's @SuppressWarnings annotations
  • Specification of quality gates which will break your build
  • Code Smell baseline and suppression for legacy projects
  • Gradle plugin for code analysis via Gradle builds
  • SonarQube integration
  • Extensibility by enabling incorporation of personal rule sets, FileProcessListener's and OutputReport's
  • IntelliJ integration
  • Third party integrations for Maven, Bazel and Github Actions (Docker based and Javascript based)

Project Website

Visit the project website for installation guides, release notes, migration guides, rule descriptions and configuration options.

Quick-Links

Quick Start ...

with the command-line interface

curl -sSLO https://github.com/detekt/detekt/releases/download/v[version]/detekt && chmod a+x detekt
./detekt --help

You can find other ways to install detekt here

with Gradle

Gradle 5.4+ is required:

buildscript {
    repositories {
        jcenter()
    }

    // or

    mavenCentral()
    jcenter {
        content {
            // Only download the 'kotlinx-html-jvm' module from JCenter, but nothing else.
            // detekt needs 'kotlinx-html-jvm' for the HTML report.
            includeModule("org.jetbrains.kotlinx", "kotlinx-html-jvm")
        }
    }
}

plugins {
    id("io.gitlab.arturbosch.detekt").version("[version]")
}

detekt {
    buildUponDefaultConfig = true // preconfigure defaults
    allRules = false // activate all available (even unstable) rules.
    config = files("$projectDir/config/detekt.yml") // point to your custom config defining rules to run, overwriting default behavior
    baseline = file("$projectDir/config/baseline.xml") // a way of suppressing issues before introducing detekt

    reports {
        html.enabled = true // observe findings in your browser with structure and code snippets
        xml.enabled = true // checkstyle like format mainly for integrations like Jenkins
        txt.enabled = true // similar to the console output, contains issue signature to manually edit baseline files
        sarif.enabled = true // standardized SARIF format (https://sarifweb.azurewebsites.net/) to support integrations with Github Code Scanning
    }
}


// Groovy DSL
tasks.withType(Detekt).configureEach {
    jvmTarget = "1.8"
}

// or

// Kotlin DSL
tasks.withType<Detekt>.configureEach {
    // Target version of the generated JVM bytecode. It is used for type resolution.
    jvmTarget = "1.8"
}

See maven central for releases and sonatype for snapshots.

If you want to use a SNAPSHOT version, you can find more info on this documentation page.

Adding more rule sets

detekt itself provides a wrapper over ktlint as a formatting rule set which can be easily added to the Gradle configuration:

dependencies {
    detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:[version]")
}

Likewise custom extensions can be added to detekt.

Contributors

If you contributed to detekt but your name is not in the list, please feel free to add yourself to it!

Mentions

androidweekly androidweekly

As mentioned in...

Integrations:

Custom rules from 3rd parties:

Credits

detekt's People

Contributors

3flex avatar arturbosch avatar braisgabin avatar chao2zhang avatar cortinico avatar deeprim avatar dependabot-preview[bot] avatar egor-n avatar epeee avatar geralt-encore avatar jkaan avatar lummax avatar marianosimone avatar marschwar avatar mauin avatar mishkun avatar mkobit avatar mydogtom avatar pavlospt avatar radimvaculik avatar rock3r avatar schalkms avatar scottkennedy avatar snowe2010 avatar sowmyav24 avatar sschuberth avatar t-kameyama avatar tagantroy avatar vanniktech avatar veyndan avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.