Coder Social home page Coder Social logo

detekt-action's People

Contributors

alaegin avatar andy31415 avatar davidmag avatar gumil avatar kchernenko avatar kshitij09-sc avatar paolorotolo avatar rustamvaliev94 avatar swiesmann avatar swolfand avatar ulfsauer0815 avatar vovastelmashchuk avatar yunusmete avatar zhaohuazeng-at avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

detekt-action's Issues

Update reviewdog 0.17.4

Can you update reviewdog version? There's a bug in reviewdog where if your PR has more than 300 files changed it just craps out. Recent versions seem to fix it. Thanks

JDK version

Problem

Is seems like the JDK version used to run detekt is 11.
From Dockerfile:

RUN apk --no-cache --update add git curl openjdk11 bash \
    && rm -rf /var/cache/apk/*

This makes it impossible to run custom detekt rules, compiled with target version higher then 11:

java -jar /opt/detekt.jar --config detekt-ruleset.yml --report xml:detekt_report.xml --excludes **/build/**,**/.idea/** --plugins /opt/detekt-formatting.jar,detekt-custom-rules/compiled-rules.jar 
java.lang.UnsupportedClassVersionError: com/project/detektcustomrules/RuleSetProvider has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

Question

Could there be a way to bump/specify a java version for the action?
Is there something behind the choice of version 11, or could it be changed easily?

InjectDispatcher rule is not working

I wrote the following code which is clearly non-compliant.

suspend fun sample() {
    CoroutineScope(Dispatchers.IO).launch{

    }
    GlobalScope.launch(Dispatchers.IO){

    }
}

But it doesn't show warning on this line that the dispatchers should only be injected. I have also set the rule to active in the config file.

coroutines:
  active: true
  GlobalCoroutineUsage:
    active: false
  InjectDispatcher:
    active: true
    dispatcherNames:
      - 'IO'
      - 'Default'
      - 'Unconfined'
  RedundantSuspendModifier:
    active: false
  SleepInsteadOfDelay:
    active: false
  SuspendFunWithFlowReturnType:
    active: false

reviewdog_reporter: github_pr_review is not working

Hello, with this config I'm unable to see review comments with detected issues:

      - name: detekt
        uses: alaegin/[email protected]
        with:
          github_token: ${{ secrets.PAT || secrets.TOKEN }}
          reviewdog_reporter: github-pr-review
          detekt_config: detekt-config.yml # Change config path
          reviewdog_level: error

Build is failing (issues detected), checks are passing, no comments are posted. The github_token is valid.

Invalid Configuration file issue with [email protected]

io.gitlab.arturbosch.detekt.api.Config$InvalidConfigurationError: Provided configuration file is invalid: Structure must be from type Map<String,Any>!

GH action usage. We have prior step to download correct version of jar

- name: Run detekt with reviewdog
        uses: alaegin/[email protected]
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          detekt_config: kotlin/detekt/detekt.yaml
          reviewdog_reporter: github-pr-check
          detekt_plugins: 'kotlin/detekt/plugins/detekt-formatting.jar'

Error trace:

java -jar /opt/detekt.jar --config kotlin/detekt/detekt.yaml --report xml:detekt_report.xml --excludes **/build/**,**/.idea/** --plugins /opt/detekt-formatting.jar,kotlin/detekt/plugins/detekt-formatting.jar 
io.gitlab.arturbosch.detekt.api.Config$InvalidConfigurationError: Provided configuration file is invalid: Structure must be from type Map<String,Any>!
while constructing a mapping
 in reader, line 1, column 1:
    build:
    ^
found duplicate key formatting
 in reader, line 1057, column 1:
    formatting:
    ^

	at io.gitlab.arturbosch.detekt.core.config.YamlConfig$Companion.load(YamlConfig.kt:77)
	at io.gitlab.arturbosch.detekt.core.tooling.DefaultConfigProviderKt.getDefaultConfiguration(DefaultConfigProvider.kt:55)
	at io.gitlab.arturbosch.detekt.core.tooling.DefaultConfigProviderKt.getDefaultConfiguration(DefaultConfigProvider.kt:59)
	at io.gitlab.arturbosch.detekt.core.tooling.AnalysisFacade$run$1.invoke(AnalysisFacade.kt:26)

Sample config file(kotlin/detekt/detekt.yaml ) - This is working fine with previous versions 1.22.0

formatting:
  active: true
  autoCorrect: true
  FinalNewline:
    active: true
  NoUnusedImports:
    active: true
  ArgumentListWrapping:
    active: false

style:
  MaxLineLength:
    maxLineLength: 150
    excludeCommentStatements: true
  ReturnCount:
    max: 5
  ForbiddenComment:
    active: false
  UnnecessaryAbstractClass:
    active: false


complexity:
  LongParameterList:
    active: true
    functionThreshold: 6
    constructorThreshold: 20
    ignoreAnnotated:
      - Table
  LongMethod:
    threshold: 80
  TooManyFunctions:
    thresholdInFiles: 15
    thresholdInClasses: 15
    thresholdInInterfaces: 15
    thresholdInObjects: 15
    thresholdInEnums: 15
    ignorePrivate: true
  CyclomaticComplexMethod:
    threshold: 15
  CognitiveComplexMethod:
    threshold: 15

comments:
  UndocumentedPublicClass:
    active: false
  UndocumentedPublicFunction:
    active: false
  UndocumentedPublicProperty:
    active: false
  EndOfSentenceFormat:
    active: false
  CommentOverPrivateFunction:
    active: false
  CommentOverPrivateProperty:
    active: false

naming:
  FunctionMaxLength:
    active: true
    maximumFunctionNameLength: 100

coroutines:
  active: true

potential-bugs:
  active: true

Build Failure with (detekt_report.xml: No such file or directory)

        with:
          github_token: ${{ secrets.github_token }}
          detekt_config: config/detekt/detekt.yml
          fail_on_error: false
          detekt_parallel: true
          reviewdog_reporter: github-pr-review

Hello, my configuration is as above.

When I run action, I got below error and workflow stopped..

Can you please help..? ๐Ÿ˜ข

/*.kt:13:19: This empty block of code can be removed. [EmptyFunctionBlock]
/*.kt:13:5: Function names should match the pattern: [a-z][a-zA-Z0-9]* [FunctionNaming]

Build failed with 2 weighted issues.
/entrypoint.sh: line 37: detekt_report.xml: No such file or directory

line 46: detekt_report.xml: No such file or directory

Hi i keep getting those error, i've seen this issues before but i tried the fix but still no luck

output-reports:
active: true
exclude:
- 'XmlOutputReport'
- 'TxtOutputReport'
- 'HtmlOutputReport'

name: Versi trio

on:
pull_request:
branches: [ "main" ]

workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@v3
- name: detekt
uses: alaegin/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
detekt_config: config/detekt/detekt.yml
reviewdog_reporter: github-pr-review

Fails the current check if any error found

Hi,
I set up this action as suggested. However, the checks pass with errors. Any idea, how I can fail the current check on error?

Workflow

  ...
  detekt:
    name: Running Detekt
    runs-on: ubuntu-latest
    steps:
      - name: Clone Run detekt with reviewdog repo
        uses: actions/checkout@v2
        with:
          fetch-depth: 1
          ref: ${{ github.head_ref }}
      - name: Detekt
        uses: DominuS-RU/Detekt-Action@v1.15.0
        with:
          github_token: ${{ secrets.github_token }}
          detekt_config: detekt.yml
          reviewdog_reporter: github-pr-review
          detekt_excludes: '**/build/**,**/shared/db.dao/**,**.kts**,**/buildSrc/**,**/.idea/**'

Screenshot 2021-01-26 at 21 20 39

Would be nice to add a fail_on_error input just as in https://github.com/ScaCap/action-ktlint#fail_on_error.

Thanks!

Github action with plugins error

hello I'm using plugins but it's generating errors

this is the plugin i am using
https://github.com/twitter/compose-rules

java -jar /opt/detekt.jar --config config/detekt/detekt.yml --report xml:detekt_report.xml --excludes **/build/**,**/.idea/** --plugins /opt/detekt-formatting.jar,config/detekt/detekt-0.0.3.jar, config/detekt/common-0.0.3.jar 
Was passed main parameter 'config/detekt/common-0.0.3.jar' but no main parameter was defined in your arg class

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.