All Projects → Mkohm → detekt-hint

Mkohm / detekt-hint

Licence: other
Detection of design principle violations in Kotlin as a plugin to detekt.

Programming Languages

HTML
75241 projects
TeX
3793 projects
kotlin
9241 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to detekt-hint

Sonar Dotnet
Code analyzer for C# and VB.NET projects https://redirect.sonarsource.com/plugins/vbnet.html
Stars: ✭ 466 (+639.68%)
Mutual labels:  static-code-analysis, code-quality
codeclimate-phpcodesniffer
Code Climate Engine for PHP Code Sniffer
Stars: ✭ 27 (-57.14%)
Mutual labels:  static-code-analysis, code-quality
Pep8speaks
A GitHub app to automatically review Python code style over Pull Requests
Stars: ✭ 546 (+766.67%)
Mutual labels:  static-code-analysis, code-quality
Reviewdog
🐶 Automated code review tool integrated with any code analysis tools regardless of programming language
Stars: ✭ 4,541 (+7107.94%)
Mutual labels:  static-code-analysis, code-quality
Codeclimate
Code Climate CLI
Stars: ✭ 2,273 (+3507.94%)
Mutual labels:  static-code-analysis, code-quality
Pylint
It's not just a linter that annoys you!
Stars: ✭ 3,733 (+5825.4%)
Mutual labels:  static-code-analysis, code-quality
Checkstyle
Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard. By default it supports the Google Java Style Guide and Sun Code Conventions, but is highly configurable. It can be invoked with an ANT task and a command line program.
Stars: ✭ 6,481 (+10187.3%)
Mutual labels:  static-code-analysis, code-quality
qodana-action
⚙️ Scan your Java, Kotlin, PHP, Python, JavaScript, TypeScript projects at GitHub with Qodana
Stars: ✭ 112 (+77.78%)
Mutual labels:  static-code-analysis, code-quality
Infer
A static analyzer for Java, C, C++, and Objective-C
Stars: ✭ 12,823 (+20253.97%)
Mutual labels:  static-code-analysis, code-quality
Cflint
Static code analysis for CFML (a linter)
Stars: ✭ 156 (+147.62%)
Mutual labels:  static-code-analysis, code-quality
Sonar Php
🐘 SonarPHP: PHP static analyzer for SonarQube & SonarLint
Stars: ✭ 288 (+357.14%)
Mutual labels:  static-code-analysis, code-quality
eclipse-pmd
eclipse-pmd has been moved to
Stars: ✭ 20 (-68.25%)
Mutual labels:  static-code-analysis, code-quality
sonar-esql-plugin
Sonar plugin to analyze ESQL-sourcecode of IBM Integration Bus projects
Stars: ✭ 26 (-58.73%)
Mutual labels:  static-code-analysis, code-quality
Pmd
An extensible multilanguage static code analyzer.
Stars: ✭ 3,667 (+5720.63%)
Mutual labels:  static-code-analysis, code-quality
codeclimate-duplication
Code Climate engine for code duplication analysis
Stars: ✭ 96 (+52.38%)
Mutual labels:  static-code-analysis, code-quality
Sonarjs
SonarSource Static Analyzer for JavaScript and TypeScript
Stars: ✭ 696 (+1004.76%)
Mutual labels:  static-code-analysis, code-quality
codeclimate-eslint
Code Climate Engine for ESLint
Stars: ✭ 86 (+36.51%)
Mutual labels:  static-code-analysis, code-quality
static-code-analysis-plugin
A plugin to simplify Static Code Analysis on Gradle. Not restricted to, but specially useful, in Android projects, by making sure all analysis can access the SDK classes.
Stars: ✭ 36 (-42.86%)
Mutual labels:  static-code-analysis, code-quality
Static Analysis
⚙️ A curated list of static analysis (SAST) tools for all programming languages, config files, build tools, and more.
Stars: ✭ 9,310 (+14677.78%)
Mutual labels:  static-code-analysis, code-quality
memcheck-cover
An HTML generator for Valgrind's Memcheck tool
Stars: ✭ 30 (-52.38%)
Mutual labels:  static-code-analysis, code-quality

detekt-hint (Attention: Looking for developers)

Detection of design principle violations in Kotlin added as comments on pull requests.

Getting started | 🏁 Roadmap | 💭 Ask a question | 📖 Documentation

Maintainability codecov Build Status Download Kotlinlang slack Awesome Kotlin Badge

ucih

detekt-hint is a plugin for detekt that includes detection of violation of programming principles. Since such violations are hard to detect with low false-positive rates, detekt-hint will provide hints during QA, minimizing noise during development. The idea is that a higher false-positive rate can be accepted if the detection could be of high value, and is easy to ignore. Detections on the architectural level of code is therefore most likely to provide value.

Through integration with Danger comments are added to the PR. Getting feedback directly on the PR makes it easy to ignore possible false-positives. Comments also include context and tips, making it easier for the developer to make the correct decisions.

Contributions are very much welcome and if you like the project - help me out with a . Especially help in which rules to implement, how to implement them and how to reduce the false-positives.

Currently supported detections

Use composition instead of inheritance - Will help developer ensure Liskov Substitution Principle is not violated. Will not report if you inherit from third-party libraries.

Lack Of Cohesion of Methods - Notifies you if the LCOM value is too high.

Interface Segregation Principles - Notifies you if you implement methods that the class does not need.

Open-Closed Principle - This rule reports use of switching on enums and classes, which may be a sign of violation the open closed principle.

Interface Segregation Principle

lcom

Single Responsibility Principle

lcom

Open-Closed Principle

lcom

Using detekt-hint

If you just want to analyze some code without bothering with the Danger integration (which really defeats the purpose of the tool) head to the command line section.

With Github Actions

  1. Configure a detekt-hint-config.yml to include detekt-hint rules and put it in a folder called "config" in your root project folder.

config/detekt-hint-config.yml

detekt-hint:
  UseCompositionInsteadOfInheritance:
    active: true
    yourUniquePackageName: "io.github.mkohm"
  LackOfCohesionMethods:
    active: true
    threshold: "0.8"
  InterfaceSegregationPrinciple:
      active: true
  OpenClosedPrinciple:
      active: true

Make sure you enter your unique package name in the configuration for the UseCompositionInsteadOfInheritance rule.

  1. Create a github action using the detekt-hint docker action.

.github/workflows/detekt-hint.yml

name: detekt hint

on:
  pull_request:
    branches:
      - '*'

jobs:
  gradle:
    strategy:
      matrix:
        os: [ubuntu-latest]
        jdk: [11]
    runs-on: ${{ matrix.os }}
    if: ${{ !contains(github.event.head_commit.message, 'detekt hint skip') }}
    env:
      JDK_VERSION:  ${{ matrix.jdk }}
    steps:
      - name: Checkout Repo
        uses: actions/checkout@v2
        
      - name: Run detekt hint
        uses: mkohm/[email protected]
        with:
          github-api-token: ${{ secrets.GITHUB_TOKEN }}
  1. Create a PR and see detekt-hint run as a separate action.

Having trouble? Please create an issue or contact me on the kotlinlang Slack (username: mkohm), and i will help you out.

With the command line

If you only want to do some analysis on your code without the power of Danger commenting on your PR you can use the tool from the command line. You must first clone detekt and detekt-hint repositories, and then build the required jars:

git clone https://github.com/Mkohm/detekt-hint && git clone https://github.com/arturbosch/detekt && cd detekt-hint && ./gradlew jar && cd ../detekt/ && ./gradlew build shadowJar && cd ..

Use the command line utility:

java -jar detekt/detekt-cli/build/libs/detekt-cli-[version]-all.jar --plugins detekt-hint/build/libs/detekt-hint-[version].jar --config detekt-hint/config/detekt.yml --classpath <your-classpath> --input <path-to-your-awesome-project>

For example:

java -jar detekt/detekt-cli/build/libs/detekt-cli-1.5.0-all.jar --plugins detekt-hint/build/libs/detekt-hint-0.0.2.jar --config detekt-hint/config/detekt.yml --classpath detekt-hint/ --input detekt-hint/

Remember to enter the latest detekt-cli version, the latest detekt-hint version and the path to your classpath and source code. Also, make sure that the detekt.yml you are using contains the unique package name in the configuration for the UseCompositionInsteadOfInheritance rule.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].