-
Couldn't load subscription status.
- Fork 0
control_statement
Ian Applebaum edited this page Jun 13, 2020
·
1 revision
if, for, guard, switch, while, and catch statements shouldn't unnecessarily wrap their conditionals or arguments in parentheses.
- Identifier: control_statement
- Enabled by default: Enabled
- Supports autocorrection: Yes
- Kind: style
- Analyzer rule: No
- Minimum Swift compiler version: 3.0.0
- Default configuration: warning
if condition {if (a, b) == (0, 1) {if (a || b) && (c || d) {if (min...max).contains(value) {if renderGif(data) {renderGif(data)for item in collection {for (key, value) in dictionary {for (index, value) in enumerate(array) {for var index = 0; index < 42; index++ {guard condition else {while condition {} while condition {do { ; } while condition {switch foo {do {
} catch let error as NSError {
}foo().catch(all: true) {}if max(a, b) < c {switch (lhs, rhs) {↓if (condition) {↓if(condition) {↓if (condition == endIndex) {↓if ((a || b) && (c || d)) {↓if ((min...max).contains(value)) {↓for (item in collection) {↓for (var index = 0; index < 42; index++) {↓for(item in collection) {↓for(var index = 0; index < 42; index++) {↓guard (condition) else {↓while (condition) {↓while(condition) {} ↓while (condition) {} ↓while(condition) {do { ; } ↓while(condition) {do { ; } ↓while (condition) {↓switch (foo) {do {
} ↓catch(let error as NSError) {
}↓if (max(a, b) < c) {