Nick
07/28/2021, 4:03 PMname: Android CI
on:
# Trigger on every pull request and push to the main branches.
push:
branches:
- "1.0"
- mo_ql
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Detekt
run: ./gradlew detektMain
- name: Build with Gradle
run: ./gradlew assemble
But when I run ./gradlew detektMain
locally, it works fine. The baselines are on Github in the same folders as seen in the screenshot.
Also…
./gradlew detekt
runs real quickly, and outputs nothing detekt related.
My config is the default generated one.
What did I do wrong?gammax
07/28/2021, 4:46 PMAlso…
This is fine. Detekt has no output if it’s green. If you want to really make sure that it works correctly add aruns real quickly, and outputs nothing detekt related../gradlew detekt
val answer = 42
to any of your source file. ./gradlew detekt
should fail with a MagicNumber
.gammax
07/28/2021, 4:46 PMBut when I run“works fine” == uses the baseline correctly, while the CI is sort of ignoring it, right?locally, it works fine../gradlew detektMain
gammax
07/28/2021, 4:47 PMNick
07/28/2021, 5:21 PMNick
07/28/2021, 5:21 PMgammax
07/28/2021, 5:22 PMdetekt
is not using type resolution, therefore doesn’t need to compile your source code. The detektMain
task is running with type resolution and needs to compile your code to run more accurate and advanced analysis.Nick
07/28/2021, 5:23 PMNick
07/28/2021, 5:23 PMgammax
07/28/2021, 5:26 PMNick
07/28/2021, 5:33 PMNick
07/28/2021, 5:34 PMNick
07/28/2021, 5:34 PMNick
07/28/2021, 5:34 PMNick
07/28/2021, 5:37 PMapply plugin: "io.gitlab.arturbosch.detekt"
....
detekt {
config = files("$rootDir/config/detekt/detekt.yml")
}
project build.gradle:
buildscript {
....
dependencies {
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.18.0-RC2"
}
}
gammax
07/28/2021, 5:38 PM./gradlew :app:detektBaseline
and verified that a baseline file gets created?
If so have you verified that it works locally?
If so have you checked that the baseline file is actually committed (you might have a .gitignore
somewhere)?Nick
07/28/2021, 5:40 PMNick
07/28/2021, 5:40 PMNick
07/28/2021, 5:41 PMconfig =
part to see if that would fix it too, but no dice.gammax
07/28/2021, 6:00 PMNick
07/28/2021, 6:02 PMNick
07/28/2021, 7:01 PMNick
07/28/2021, 7:01 PMgammax
07/28/2021, 9:45 PMNick
07/29/2021, 6:07 PMgammax
07/29/2021, 6:10 PMNick
07/29/2021, 6:13 PM.jar
rather just the executable) it works on my local machine, but in the container it fails. Any suggestions?Nick
07/29/2021, 6:13 PMNick
07/29/2021, 6:14 PMgammax
07/29/2021, 6:14 PMNick
07/29/2021, 6:14 PMgammax
07/29/2021, 6:14 PMNick
07/29/2021, 6:14 PMNick
07/29/2021, 6:16 PMname: Android CI
on:
# Trigger on every pull request and push to the main branches.
push:
branches:
- "1.0"
- mo_ql
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: detekt
uses: nachtien/Detekt-Action@1.22
with:
github_token: ${{ secrets.DETEKT_TOKEN }}
detekt_config: config/detekt/detekt.yml
detekt_baseline: app/detekt-baseline.xml
- name: Build with Gradle
run: ./gradlew assemble
Nick
07/29/2021, 6:17 PMgammax
07/29/2021, 6:17 PMNick
07/29/2021, 6:17 PMgammax
07/29/2021, 6:17 PMNick
07/29/2021, 6:18 PMgammax
07/29/2021, 6:19 PMNick
07/29/2021, 6:20 PMgammax
07/29/2021, 6:21 PMNick
07/29/2021, 6:22 PMgammax
07/29/2021, 6:23 PMNick
07/29/2021, 6:25 PMgammax
07/29/2021, 6:25 PMgradlew detekt --debug
you might see what’s going onNick
07/29/2021, 6:28 PMNick
07/29/2021, 6:54 PMbaseline
file (it appears normal)
2. I passed in debug
, there doesn’t appear to be anything wrong
3. I’m using Act to run this locally, but am experiencing the same issue on Github
4. Command ran:
java -jar /opt/detekt.jar --fail-fast --debug --config config/detekt/detekt.yml --report xml:detekt_report.xml --baseline app/detekt-baseline.xml --excludes '**/build/**,**/.idea/**' --plugins /opt/detekt-formatting.jar
Output:
547 weighted issues (I didn’t write this code 😄 )
5. Locally in my terminal:
./detekt-cli-1.18.0-RC2/bin/detekt-cli --fail-fast --debug --config config/detekt/detekt.yml --report xml:detekt_report.xml --baseline app/detekt-baseline.xml --excludes '**/build/**,**/.idea/**'
It prints the rule sets, extensions, and everything seems fine.gammax
07/29/2021, 7:39 PMjava -jar
gammax
07/29/2021, 7:40 PMNick
07/29/2021, 8:02 PMNick
07/29/2021, 8:02 PM> java -jar /Users/nickachtien/Downloads/detekt-cli-1.18.0-RC2-all.jar --fail-fast --debug --config config/detekt/detekt.yml --report xml:detekt_report.xml --baseline app/detekt-baseline.xml --excludes '**/build/**,**/.idea/**'
Loaded extensions:
Registered rule sets:
io.gitlab.arturbosch.detekt.rules.complexity.ComplexityProvider@2cf92cc7
io.gitlab.arturbosch.detekt.rules.coroutines.CoroutinesProvider@30ea8c23
io.gitlab.arturbosch.detekt.rules.documentation.CommentSmellProvider@7b139eab
io.gitlab.arturbosch.detekt.rules.empty.EmptyCodeProvider@4e76dac
io.gitlab.arturbosch.detekt.rules.bugs.PotentialBugProvider@611df6e3
io.gitlab.arturbosch.detekt.rules.exceptions.ExceptionsProvider@5f2f577
io.gitlab.arturbosch.detekt.rules.naming.NamingProvider@6273c5a4
io.gitlab.arturbosch.detekt.rules.performance.PerformanceProvider@5d465e4b
io.gitlab.arturbosch.detekt.rules.style.StyleGuideProvider@53e211ee
Ignoring file '/Users/nickachtien/Projects/StructionSite_Android/app/build/generated/source/apollo/standardDebug/service/type/CustomType.kt'
Ignoring file '/Users/nickachtien/Projects/StructionSite_Android/app/build/generated/source/apollo/standardDebug/service/SignInMutation.kt'
Ignoring file '/Users/nickachtien/Projects/StructionSite_Android/app/build/generated/source/apollo/standardDebug/service/SignUpMutation.kt'
Loaded extensions:
io.gitlab.arturbosch.detekt.rules.documentation.LicenceHeaderLoaderExtension@59c70ceb
io.github.detekt.metrics.processors.ProjectSLOCProcessor@46f902e0
io.github.detekt.metrics.processors.ProjectLOCProcessor@64f981e2
io.github.detekt.metrics.processors.ProjectCLOCProcessor@361abd01
io.github.detekt.metrics.processors.ProjectLLOCProcessor@575b5f7d
io.github.detekt.metrics.processors.ProjectCognitiveComplexityProcessor@59bbb974
io.github.detekt.metrics.processors.ProjectComplexityProcessor@7165d530
io.github.detekt.metrics.processors.PropertyCountProcessor@12f49ca8
io.github.detekt.metrics.processors.FunctionCountProcessor@1fd9893c
io.github.detekt.metrics.processors.ClassCountProcessor@1b2df3aa
io.github.detekt.metrics.processors.PackageCountProcessor@44be69aa
io.github.detekt.metrics.processors.KtFileCountProcessor@7219ac49
Registered rule sets:
io.gitlab.arturbosch.detekt.rules.complexity.ComplexityProvider@9b76b60
io.gitlab.arturbosch.detekt.rules.coroutines.CoroutinesProvider@3fb9a67f
io.gitlab.arturbosch.detekt.rules.documentation.CommentSmellProvider@127705e4
io.gitlab.arturbosch.detekt.rules.empty.EmptyCodeProvider@5562c2c9
io.gitlab.arturbosch.detekt.rules.bugs.PotentialBugProvider@673c4f6e
io.gitlab.arturbosch.detekt.rules.exceptions.ExceptionsProvider@15c487a8
io.gitlab.arturbosch.detekt.rules.naming.NamingProvider@3f36e8d1
io.gitlab.arturbosch.detekt.rules.performance.PerformanceProvider@7c011174
io.gitlab.arturbosch.detekt.rules.style.StyleGuideProvider@794366a5
Loaded extensions:
io.gitlab.arturbosch.detekt.core.baseline.BaselineResultMapping@32ebfde1
Loaded extensions:
io.github.detekt.report.sarif.SarifOutputReport@448a2c5d
io.github.detekt.report.html.HtmlOutputReport@7054edda
io.github.detekt.report.xml.XmlOutputReport@4a09a4df
io.github.detekt.report.txt.TxtOutputReport@7de47f81
Loaded extensions:
io.gitlab.arturbosch.detekt.core.reporting.console.FindingsReport@62885131
Phase LoadConfig took PT0.073S
Phase CreateSettings took PT0.013S
Phase ValidateConfig took PT0.041S
Phase Parsing took PT1.403S
Phase Binding took PT0.005S
Phase LoadingExtensions took PT0.01S
Phase Analyzer took PT2.611S
Phase Reporting took PT0.021S
gammax
07/29/2021, 8:03 PMNick
07/29/2021, 8:27 PM