-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add excessive_nesting
lint
#10672
Add excessive_nesting
lint
#10672
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Alexendoo (or someone else) soon. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
ok, I see an issue with this. local bindings seem to be checked as well even if they're a block, which makes sense. this means, even if the actual code never reaches above column 100, it'll still be triggered if the length of the entire block is above 100. Not ideal... I'll check back on here later with hopefully the knowledge needed to eliminate that. |
excessive_width
and excessive_indentation
lintsexcessive_width
~~ and excessive_indentation
lints
excessive_width
~~ and excessive_indentation
lints~~excessive_width~~
and excessive_indentation
lints
~~excessive_width~~
and excessive_indentation
lintsexcessive_indentation
lints
excessive_indentation
lintsexcessive_indentation
lints
Although it's unstable rustfmt does have an option to error on lines that go above the For indentation that does seem like something more in our area, at least I wouldn't expect for rustfmt to add an option for that. Does that sound reasonable @flip1995? |
Yeah, I remembered that option and so excessive_width seems unnecessary. I'll remove it in a later commit |
For general feedback, please see Zulip. Also please discuss the IF we should add this lint there. Implementing a lint on number of whitespaces is not a good idea. Maybe some people use 2 whitespace indentation vs 4. Then this lint would behave differently. But if you try to determine indentation by analyzing statements, see Zulip and #3793 (comment) FYI @felix91gr: This again is an attempt at doing something in the direction of cognitive/cyclomatic complexity. I like to page you in on those discussions, if you're still around and interested (either here, on Zulip or not at all) 😄 |
Ok, I think this is ready! @Alexendoo, feel free to review this whenever you can and once consensus on whether this should be added has been reached 🙂 the current implementation is a bit verbose but I'm not sure if it's possible to get it better.
|
excessive_indentation
lintsexcessive_nesting
lint
☔ The latest upstream changes (presumably #10578) made this pull request unmergeable. Please resolve the merge conflicts. |
9d45979
to
c584823
Compare
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.
👋
I'll apply these changes tomorrow 🙂 thanks! Glad to see this could've been done better |
a633034
to
7fb987b
Compare
7fb987b
to
5da3455
Compare
Thanks! @bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
changelog: new lint [
excessive_nesting
]