-
-
Notifications
You must be signed in to change notification settings - Fork 755
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
Respect RunAfterRule
constraint from ktlint
#6159
Conversation
detekt-formatting/src/main/kotlin/io/gitlab/arturbosch/detekt/formatting/FormattingRuleSort.kt
Fixed
Show fixed
Hide fixed
detekt-formatting/src/main/kotlin/io/gitlab/arturbosch/detekt/formatting/FormattingRuleSort.kt
Fixed
Show fixed
Hide fixed
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #6159 +/- ##
============================================
+ Coverage 85.21% 85.23% +0.01%
+ Complexity 4055 4051 -4
============================================
Files 566 565 -1
Lines 13252 13278 +26
Branches 2382 2384 +2
============================================
+ Hits 11293 11317 +24
- Misses 774 775 +1
- Partials 1185 1186 +1
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
detekt found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.
461cf5d
to
521c00c
Compare
521c00c
to
781155b
Compare
detekt-formatting/src/main/kotlin/io/gitlab/arturbosch/detekt/formatting/FormattingRuleSort.kt
Fixed
Show fixed
Hide fixed
|
||
@Test | ||
fun `run as late as possible is observed`() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we disable the test until pinterest/ktlint#2062 is merged and updated in detekt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rule sorter first runs all rules without any VisitorModifier.
The next group of rules are the rules marked with RunAsLateAsPossible.
The last group are the rules marked with RunAfter.
Should we update this PR to emulate the same mechanics as ktlint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are following the same logic in this PR, let me add some comments for posterity
detekt-formatting/src/main/kotlin/io/gitlab/arturbosch/detekt/formatting/FormattingRuleSort.kt
Fixed
Show fixed
Hide fixed
detekt-formatting/src/main/kotlin/io/gitlab/arturbosch/detekt/formatting/FormattingRuleSort.kt
Fixed
Show fixed
Hide fixed
detekt-formatting/src/main/kotlin/io/gitlab/arturbosch/detekt/formatting/FormattingRuleSort.kt
Fixed
Show fixed
Hide fixed
detekt-formatting/src/main/kotlin/io/gitlab/arturbosch/detekt/formatting/FormattingRuleSort.kt
Fixed
Show fixed
Hide fixed
ff548aa
to
859697a
Compare
859697a
to
1bc8d20
Compare
1bc8d20
to
b365f10
Compare
This PR is stale because it has been open 90 days with no activity. Please comment or this will be closed in 7 days. |
* Respect `RunAfterRule` constraint from ktlint * Fix detekt * Suppress detekt * Add more tests * Implement using ktlint's algorithms * Address comments
Resolves #5259
Consulted with ktlint in pinterest/ktlint#2062, we are building a consistent sorting logic in detekt to match ktlint.