-
-
Notifications
You must be signed in to change notification settings - Fork 764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non deterministic output. False positives on Indentation rule #1633
Comments
Can I ask if you can replicate using ktlint directly? |
I've tried but could not reproduce this on KtLint, it always obeyed the provided .editorconfig (tried on the version we're using on 1.0.0.RC14) |
Could you post a screenshot with the line and column markers? |
We're hitting same issue on Detekt Here is reproducible example with just one file being checked that sometimes passes and sometimes fails on multiple machines in our team: artem-zinnatullin/envoy-mobile@622d501 Passes: ci/detekt
.
1 kotlin file was analyzed.
Ruleset: comments
Ruleset: complexity
Ruleset: empty-blocks
Ruleset: exceptions
Ruleset: formatting
Ruleset: naming
Ruleset: performance
Ruleset: potential-bugs
Ruleset: style
Complexity Report:
- 100 lines of code (loc)
- 81 source lines of code (sloc)
- 54 logical lines of code (lloc)
- 4 comment lines of code (cloc)
- 11 McCabe complexity (mcc)
- 0 number of total code smells
- 4 % comment source ratio
- 203 mcc per 1000 lloc
- 0 code smells per 1000 lloc
Project Statistics:
- number of properties: 17
- number of functions: 6
- number of classes: 1
- number of packages: 1
- number of kt files: 1
detekt finished in 988 ms. Fails: ci/detekt
.
1 kotlin file was analyzed.
Ruleset: comments
Ruleset: complexity
Ruleset: empty-blocks
Ruleset: exceptions
Ruleset: formatting - 4h 10min debt
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:24:34
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:25:50
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:26:66
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:27:36
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:29:55
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:30:39
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:31:43
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:33:28
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:35:42
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:36:19
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:37:19
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:38:50
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:40:68
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:41:59
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:43:48
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:44:35
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:45:108
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:46:58
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:47:19
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:48:41
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:50:55
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:51:44
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:52:27
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:53:14
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:54:39
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:56:35
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:58:10
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:60:29
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:64:4
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:66:29
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:67:22
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:69:4
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:71:40
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:72:17
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:73:30
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:74:76
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:75:65
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:76:43
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:77:27
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:78:77
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:79:49
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:80:44
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:81:28
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:83:15
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:86:31
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:89:4
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:91:62
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:93:4
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:95:81
Indentation - [PsiWhiteSpace] at /Users/azinnatullin/projects/lyft.com/envoy-mobile/examples/kotlin/hello_world/MainActivity.kt:96:79
Ruleset: naming
Ruleset: performance
Ruleset: potential-bugs
Ruleset: style
Overall debt: 4h 10min
Complexity Report:
- 100 lines of code (loc)
- 81 source lines of code (sloc)
- 54 logical lines of code (lloc)
- 4 comment lines of code (cloc)
- 11 McCabe complexity (mcc)
- 50 number of total code smells
- 4 % comment source ratio
- 203 mcc per 1000 lloc
- 925 code smells per 1000 lloc
Project Statistics:
- number of properties: 17
- number of functions: 6
- number of classes: 1
- number of packages: 1
- number of kt files: 1
Build failed with 50 weighted issues (threshold defined was 0).
io.gitlab.arturbosch.detekt.cli.console.BuildFailure: Build failed with 50 weighted issues (threshold defined was 0). |
Are there any updates on this issue? I am looking into integrating detekt with our repo and ci (https://github.com/lyft/envoy-mobile) more 🙂 If you have a workaround for this, I could give that a shot too! |
So this is still present for you in newest detekt version? |
I'm going to take a look and see if it still repro. I'll give an update about this before the end of the week. |
I've just updated to 1.2.0 and this issue is still present, @arturbosch. Note: I only was able to reproduce it once I tried to lint more than one file. That means:
|
@hick209 thanks for confirming this. Does it print valid lines/columns for you or just 1:1? |
Possible fixed by #2709. |
It looks like KtLint sometimes does not pick up indentation rules
Expected Behavior
When running an analysis on a file more than once, the output should be the same if the file contents have not changed.
Observed Behavior
Sometimes it outputs cleanly, no issues, 0 debt
Every now and then (and it's not at all rare) if you run the analysis again without touching the file, it will output a whole bunch of Indentation errors.
Steps to Reproduce
Create a configuration file with indentation
!= 4
, for exampleTest in a file that is compliant to the rules, like:
Make sure you're adding the formatting plugin, for example, I ran the following commands:
Context
Making sure the output is deterministic and there are no false positives on Indentation issues.
Your Environment
The text was updated successfully, but these errors were encountered: