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
Rule S4507: debug features activated in production (deprecate S1442 and S1525) #2061
Conversation
ee57107
to
381b28e
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.
few minor comments, otherwise lgtm
const { callee, arguments: args } = callExpression; | ||
if ( | ||
callee.type === 'MemberExpression' && | ||
callee.property.type === 'Identifier' && |
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.
you can use isIdentifier
from utils
} | ||
} | ||
|
||
function conditional(context: Rule.RuleContext) { |
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 would suggest more descriptive name, like isInsideConditional
, hasConditionalAncestor
|
||
function conditional(context: Rule.RuleContext) { | ||
const ancestors = context.getAncestors(); | ||
return !!ancestors.find(ancestor => ancestor.type === 'IfStatement'); |
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.
you can use ancestors.some
and avoid !!
Kudos, SonarQube Quality Gate passed! |
Fixes #1839