-
Notifications
You must be signed in to change notification settings - Fork 5
Implement line length and breaking rules #109
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
base: main
Are you sure you want to change the base?
Conversation
a36462e to
d9bb070
Compare
d9bb070 to
3110e82
Compare
b934564 to
cca1d93
Compare
ed9dae7 to
faf5b2a
Compare
308ee69 to
18a10ea
Compare
* Add MethodOutputBreak (LL5) Rule
* Add LL3 rule for conditional expression breaking * Cover more test cases * Add ll3 to features.md * Add to example_lint_cfg
18a10ea to
d9825d1
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.
Will examine further next week, but looks good so far
| ``` | ||
| x = (a_very_long_expression | ||
| + another_very_long_expression) | ||
| * a_third_long_expression; |
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.
indentation error in example?
| # Change Log | ||
|
|
||
| ## 0.9.14 | ||
| - Added support for line length and breaking rules break_func_call_open_paren, break_method_output, break_conditional_expression and break_before_binary_op. |
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.
Should probably primarily focus on user-friendly version of description of what linting has improved (this is allowed to be vague, or just a reference to the rule number in-doc), followed by the identifier of the linting rules (this is still valuable feedback, as these now also appear in linting messages)
| structure::{MethodContent, ObjectStatementsContent}, | ||
| tree::TreeElementTokenIterator, | ||
| types::{BitfieldsContent, LayoutContent, StructTypeContent}}; | ||
| use crate::analysis::parsing::{expression::{CastContent, FunctionCallContent, ParenExpressionContent}, lexer::TokenKind, parser::Token, statement::{self, CompoundContent, DoContent, ForContent, ForeachContent, IfContent, StatementContent, SwitchCase, SwitchContent, WhileContent}, structure::{DMLObjectContent, MethodContent, ObjectStatementsContent}, tree::TreeElementTokenIterator, types::{BitfieldsContent, LayoutContent, StructTypeContent}}; |
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 change to the import indentation is a downgrade, and I am not sure what prompted it? IMO I think using multiple branches of sub-modules in an import a little awkward (so I'd prefer multiple lines all starting with "crate::analysis::parsing::") , but I'd accept this as it was pre-change.
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 think the changelog merge conflict blocks the ability to run a CI on this (which is weird), but likely you need to run clippy on this also
| let mut tokens = node.tokens(); | ||
| Self::filter_out_last_semi_ranges(&mut tokens); | ||
| return Some(IndentContinuationLineArgs { | ||
| token_list: IndentParenExprArgs::filter_out_parenthesized_tokens(tokens), |
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.
slight indentation error
| || ! IndentParenExprArgs::is_broken_after_lparen( | ||
| node.lparen.range(), | ||
| filtered_member_ranges.first()?.to_owned()) { | ||
| return None |
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.
Missing semicolon in return statement
This PR introduces Line Length and Breaking style rules to the lint module. It also covers rule IN6 which was left out of scope for previous Indentation rules patch and had important implications for line length implementation.