-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Make SIM401 catch ternary operations #7415
Make SIM401 catch ternary operations #7415
Conversation
6c53ca1
to
da38373
Compare
da38373
to
720d476
Compare
PR Check ResultsEcosystemℹ️ ecosystem check detected changes. (+3, -1, 0 error(s)) rotki (+3, -1)
- [*] 11 fixable with the `--fix` option (223 hidden fixes can be enabled with the `--unsafe-fixes` option). + [*] 11 fixable with the `--fix` option (225 hidden fixes can be enabled with the `--unsafe-fixes` option). + rotkehlchen/db/updates.py:204:27: SIM401 Use `rule_data.get('links', {})` instead of an `if` block + rotkehlchen/externalapis/cryptocompare.py:327:24: SIM401 Use `json_ret.get('Data', json_ret)` instead of an `if` block
|
let node = orelse.clone(); | ||
let node1 = *test_key.clone(); | ||
let node2 = ast::ExprAttribute { | ||
value: expected_subscript.clone(), | ||
attr: Identifier::new("get".to_string(), TextRange::default()), | ||
ctx: ExprContext::Load, | ||
range: TextRange::default(), | ||
}; | ||
let node3 = ast::ExprCall { |
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.
nit: could you give them more descriptive names than node 1/2/3?
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.
Sure !
CodSpeed Performance ReportMerging #7415 will not alter performanceComparing Summary
|
a070c74
to
2334c66
Compare
My only hesitation here is whether this should be a separate rule and / or whether it should be behind the preview flag. |
I've looked at |
I'll take this one to completion -- gonna put this behavior under preview mode. |
Summary
Fixes #7288
Make SIM401 rules to catch ternary operations.
Test Plan
Tested against SIM401.py fixtures