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

Fix TextLocation of Indentation rule #4030

Merged
merged 3 commits into from
Aug 13, 2021

Conversation

Yundin
Copy link
Contributor

@Yundin Yundin commented Aug 11, 2021

Although Indentation applies to the whole file, it's a local rule. Start of the real location reported by ktlint's offset. And I assume that the end location should be on first non-whitespace character.
This cause detekt plugin to highlight the whole file and html output to highlight everything to the end of snippet.

Relevant issue: detekt/detekt-intellij-plugin#131

Although Indentation applies to the whole file, it's a local rule.
Start of the real location reported by ktlint's offset. And I assume
that the end location should be on first non-whitespace character.
@codecov
Copy link

codecov bot commented Aug 11, 2021

Codecov Report

Merging #4030 (834492a) into main (a3ba379) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #4030      +/-   ##
============================================
+ Coverage     83.54%   83.57%   +0.02%     
- Complexity     3180     3186       +6     
============================================
  Files           459      459              
  Lines          9082     9097      +15     
  Branches       1770     1772       +2     
============================================
+ Hits           7588     7603      +15     
  Misses          561      561              
  Partials        933      933              
Impacted Files Coverage Δ
...lab/arturbosch/detekt/formatting/FormattingRule.kt 97.67% <100.00%> (+0.05%) ⬆️
...turbosch/detekt/formatting/wrappers/Indentation.kt 100.00% <100.00%> (ø)
.../io/gitlab/arturbosch/detekt/api/ConfigProperty.kt 100.00% <0.00%> (ø)
...rturbosch/detekt/rules/empty/EmptyFunctionBlock.kt 93.33% <0.00%> (ø)
...sch/detekt/rules/naming/FunctionParameterNaming.kt 90.90% <0.00%> (ø)
...bosch/detekt/rules/complexity/LongParameterList.kt 87.75% <0.00%> (ø)
...h/detekt/rules/naming/MemberNameEqualsClassName.kt 84.21% <0.00%> (ø)
...tlab/arturbosch/detekt/rules/style/UseDataClass.kt 77.94% <0.00%> (+0.32%) ⬆️
...ules/documentation/LicenceHeaderLoaderExtension.kt 80.95% <0.00%> (+0.46%) ⬆️
...eptions/ThrowingExceptionsWithoutMessageOrCause.kt 91.66% <0.00%> (+0.75%) ⬆️
... and 2 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 a3ba379...834492a. Read the comment docs.

Copy link
Member

@schalkms schalkms left a comment

Choose a reason for hiding this comment

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

Awesome 1st contribution! Thank you for that.
The code changes look fine to me. In my opinion, a test should be added in order to avoid this issue in the future.

Copy link
Member

@cortinico cortinico left a comment

Choose a reason for hiding this comment

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

great stuff 🎉

@Yundin
Copy link
Contributor Author

Yundin commented Aug 12, 2021

Great idea! I will add test for that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants