-
Notifications
You must be signed in to change notification settings - Fork 39
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
Use :block rule as baseline indentation for :stair rule #98
base: main
Are you sure you want to change the base?
Conversation
test/cljstyle/format/indent_test.clj
Outdated
indent/reindent-lines {:indents indents} | ||
;; Note that this is parsed "wrong" as the expr-part is missing from the cond-> | ||
"(cond-> a? (a 123)\n b?\n(b true))" | ||
(str "(cond-> a? (a 123)\n" (space 13) "b?\n" (space 11) "(b true))"))) |
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.
This is some changed behaviour that I don't think would be possible to keep backwards compatibility with, afaik there's no way for the stair-indentation
to tell if the form that's on the same line is the "leading form" (expr
in cond->
) or if it's a condition that's on the same line...
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.
On further consideration, it could be solved by only using block-indent as the base when the idx
parameter is 0
which probably is reasonable.
Things like
(cond-> x a? (a 123)
b? (b true))
is quite silly after all and probably not something that should be encouraged.
Codecov ReportBase: 89.82% // Head: 89.83% // Increases project coverage by
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more Additional details and impacted files@@ Coverage Diff @@
## main #98 +/- ##
==========================================
+ Coverage 89.82% 89.83% +0.01%
==========================================
Files 20 20
Lines 1907 1909 +2
Branches 60 60
==========================================
+ Hits 1713 1715 +2
Misses 134 134
Partials 60 60
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Fix #97
Sorry about opening this before the underlying issue has been responded to, I had some extra time and thought I'd try my proposed fix.
A better solution might be to introduce a new rule instead, or add extra parameters to the rule as this would change some behaviour when leading forms are missing (see my comment in the tests).