Skip to content
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

Apply more formatting rules to our code #3615

Merged
merged 4 commits into from
Mar 28, 2021
Merged

Conversation

BraisGabin
Copy link
Member

Fixes #3593

I enabled more formatting rules for this project and run detekt with autocorrect. Then I run ktlint 0.41.0 with the --experimental argument and push the changes that doesn't conflict with the current rules. And finally I fixed some minor style things manually.

I can't enable the rules:

  • ArgumentListWrapping because it have conflicts with Indentation
  • AnnotationOnSeparateLine because it have false positives.

@BraisGabin BraisGabin added the housekeeping Marker for housekeeping tasks and refactorings label Mar 27, 2021
@codecov
Copy link

codecov bot commented Mar 27, 2021

Codecov Report

Merging #3615 (04638ce) into main (7c4a690) will increase coverage by 0.65%.
The diff coverage is 88.45%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #3615      +/-   ##
============================================
+ Coverage     77.58%   78.23%   +0.65%     
  Complexity     2832     2832              
============================================
  Files           465      465              
  Lines          8807     9121     +314     
  Branches       1720     1722       +2     
============================================
+ Hits           6833     7136     +303     
- Misses         1047     1059      +12     
+ Partials        927      926       -1     
Impacted Files Coverage Δ Complexity Δ
...tlab/arturbosch/detekt/api/internal/PathFilters.kt 88.46% <ø> (ø) 5.00 <0.00> (ø)
...lab/arturbosch/detekt/api/internal/PathMatchers.kt 60.00% <ø> (ø) 0.00 <0.00> (ø)
...itlab/arturbosch/detekt/api/internal/Validation.kt 33.33% <ø> (ø) 0.00 <0.00> (ø)
.../kotlin/io/gitlab/arturbosch/detekt/cli/CliArgs.kt 100.00% <ø> (ø) 3.00 <0.00> (ø)
.../io/gitlab/arturbosch/detekt/cli/Configurations.kt 0.00% <ø> (ø) 0.00 <0.00> (ø)
...ain/kotlin/io/gitlab/arturbosch/detekt/cli/Spec.kt 82.00% <ø> (ø) 0.00 <0.00> (ø)
...otlin/io/gitlab/arturbosch/detekt/core/Analyzer.kt 80.26% <ø> (ø) 9.00 <0.00> (ø)
...io/gitlab/arturbosch/detekt/core/BindingContext.kt 5.26% <0.00%> (-0.99%) 0.00 <0.00> (ø)
...itlab/arturbosch/detekt/core/ProcessingSettings.kt 100.00% <ø> (ø) 5.00 <0.00> (ø)
...osch/detekt/core/baseline/BaselineResultMapping.kt 78.57% <0.00%> (+5.23%) 8.00 <0.00> (ø)
... and 173 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7c4a690...04638ce. Read the comment docs.

@chao2zhang
Copy link
Member

  • ArgumentListWrapping because it have conflicts with Indentation

This is what I have observed as well in other projects

@@ -9,6 +9,7 @@ class ConfigSpecBuilder : Builder<ConfigSpec> {

var shouldValidateBeforeAnalysis: Boolean = true
var knownPatterns: Collection<String> = emptyList()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this empty line addition done by autoCorrection from formatting rules? This is a little bit surprising if this is true.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is. I just did it again and this is a funny case... I needed to run detekt twice in this file to get the formatting rules happy... this seems like a bug.

Comment on lines +31 to +34
subject.compileAndLint(
"""
class A
""")).hasSize(1)
"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The multi-line string looks worse in my opinion. But we can always manually fix these as a follow-up

@chao2zhang chao2zhang merged commit 92b6a01 into detekt:main Mar 28, 2021
@cortinico cortinico added this to the 1.17.0 milestone Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
housekeeping Marker for housekeeping tasks and refactorings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reformat the project
4 participants