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
Update: Logical-and is counted in complexity
rule (fixes #8535)
#9754
Conversation
lib/rules/complexity.js
Outdated
|
||
// Avoiding && | ||
if (node.operator === "||") { | ||
if (node.operator === "&&" || node.operator === "||") { |
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.
Could this if
statement be removed?
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.
In fact, I can remove the whole function!
@not-an-aardvark Please take another look, at your convenience. Thanks! |
Closing/reopening to attempt another AppVeyor build. |
This was a breaking change |
@jking90 ESLint’s policy is that a minor release can break your build, and they recommend using |
@j-f1 thanks for clarifying |
What is the purpose of this pull request? (put an "X" next to item)
[ ] Documentation update
[x] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:
See #8535.
What changes did you make? (Give an overview)
Logical-and now counts the same as logical-or for increasing cyclomatic complexity in a function. (
a && b
is the same as!(!a || !b)
, so either operator should increase complexity)Since this change will result in strictly non-decreasing complexity, this will result in more warnings reported, hence "Update".
Is there anything you'd like reviewers to focus on?
Not really.