alaegin / detekt-action Goto Github PK
View Code? Open in Web Editor NEWRun Detekt with reviewdog
License: MIT License
Run Detekt with reviewdog
License: MIT License
it seems that detekt_input parameter doesn't work.
I specify parameter, but action nevertheless checks other paths
Thanks :)
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
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
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?
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
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.
It would be nice if you could create a v1
tag and update it everytime a non-breaking version is released.
Similar to this https://github.com/gradle-update/update-gradle-wrapper-action/releases/tag/v1
That would make it simple for consumers of the plugin to stay updated by just using
uses: alaegin/Detekt-Action@v1
Instead of having to update github workflow files for every new release
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
Much appreciated!
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
Can we add detekt HTML report as an option in the parameters?
Hi, thanks for this project.
I have the following settings in my config:
fail_on_error: true
reviewdog_level: error
But even tho detekt is failing reviewdog still shows a pass:
https://github.com/hbmartin/protobuf_java_to_protobufjs/runs/2255365060?check_suite_focus=true
Am I doing something wrong configuring this?
In the latest version of detekt you have this flag
--build-upon-default-config
https://detekt.dev/docs/introduction/configurations/
that allows you to use the default configuration values and your own as overrides, would be super nice if this could be added as a flag here
There's a new Detekt version available:
https://github.com/detekt/detekt/releases/tag/v1.19.0
PR already exists: #31
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
Pretty please :)
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/**'
Would be nice to add a fail_on_error
input just as in https://github.com/ScaCap/action-ktlint#fail_on_error.
Thanks!
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.