Skip to content
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

Merged
merged 2 commits into from Aug 13, 2020

Conversation

vilchik-elena
Copy link
Contributor

Fixes #1839

Copy link
Contributor

@saberduck saberduck left a 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' &&
Copy link
Contributor

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) {
Copy link
Contributor

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');
Copy link
Contributor

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 !!

@sonarsource-next
Copy link

Kudos, SonarQube Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

95.0% 95.0% Coverage
0.0% 0.0% Duplication

@vilchik-elena vilchik-elena merged commit c8566b5 into master Aug 13, 2020
@vilchik-elena vilchik-elena deleted the issue-1839 branch August 13, 2020 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants