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

ControlStatementRule failing on acceptable use of parentheses #189

Closed
mattrubin opened this issue Nov 8, 2015 · 3 comments
Closed

ControlStatementRule failing on acceptable use of parentheses #189

mattrubin opened this issue Nov 8, 2015 · 3 comments

Comments

@mattrubin
Copy link
Contributor

ControlStatementRule is showing a warning on the following piece of code. I think this is an acceptable use of parens in an if statement, and the rule should be updated to accept it.

if (minValue...maxValue).contains(value) {
    // Do something...
}

Control Statement Parentheses Violation: if statements shouldn't wrap their conditionals in parentheses. (control_statement)

@jpsim
Copy link
Collaborator

jpsim commented Nov 8, 2015

Agreed. PRs welcome if you'd like to address this "false positive".

@mmorier
Copy link
Contributor

mmorier commented Nov 10, 2015

I also notice this issue for the following case where the cause is the same.

if (isA || isB) && (isC || isD) {
    // Do something...
}

I'll try to find a way to fix it and make a PR.

@jpsim
Copy link
Collaborator

jpsim commented Nov 10, 2015

I'll try to find a way to fix it and make a PR.

Great! Thanks for your help.

mmorier added a commit to mmorier/SwiftLint that referenced this issue Nov 11, 2015
mmorier added a commit to mmorier/SwiftLint that referenced this issue Nov 11, 2015
jpsim added a commit that referenced this issue Nov 11, 2015
Improve ControlStatementRule for issues #187 and #189
@mmorier mmorier closed this as completed Nov 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants