Showing 850 of 850 total issues
Parameter clause in closure signature should be preceded by exactly one space Open
self.performRequest("get", path: "/2/star/star", callback: {response in
- Exclude checks
Closure is the function's final argument and may be passed as a trailing closure instead Open
{ expectation in
- Read upRead up
- Exclude checks
trailing-closure
Closures that are the last argument of a function should be passed into the function using trailing closure syntax.
Preferred
reversed = names.sort { s1, s2 in return s1 > s2 }
Not Preferred
reversed = names.sort({ s1, s2 in return s1 > s2 })
Parameter clause in closure signature should be preceded by exactly one space Open
self.performRequest("get", path: "/error", callback: {response in
- Exclude checks
Closure is the function's final argument and may be passed as a trailing closure instead Open
}, { expectation in
- Read upRead up
- Exclude checks
trailing-closure
Closures that are the last argument of a function should be passed into the function using trailing closure syntax.
Preferred
reversed = names.sort { s1, s2 in return s1 > s2 }
Not Preferred
reversed = names.sort({ s1, s2 in return s1 > s2 })
Closure is the function's final argument and may be passed as a trailing closure instead Open
}, { expectation in
- Read upRead up
- Exclude checks
trailing-closure
Closures that are the last argument of a function should be passed into the function using trailing closure syntax.
Preferred
reversed = names.sort { s1, s2 in return s1 > s2 }
Not Preferred
reversed = names.sort({ s1, s2 in return s1 > s2 })
Closure is the function's final argument and may be passed as a trailing closure instead Open
}, { expectation in
- Read upRead up
- Exclude checks
trailing-closure
Closures that are the last argument of a function should be passed into the function using trailing closure syntax.
Preferred
reversed = names.sort { s1, s2 in return s1 > s2 }
Not Preferred
reversed = names.sort({ s1, s2 in return s1 > s2 })
Parameter clause in closure signature should be preceded by exactly one space Open
router.get("/2/sendcookie") {request, response, next in
- Exclude checks
Parameter clause in closure signature should be preceded by exactly one space Open
self.performRequest("get", path: "/1/plus", callback: {response in
- Exclude checks
Parameter clause in closure signature should be preceded by exactly one space Open
router.get("/1/(plus)+") {_, response, next in
- Exclude checks
Parameter clause in closure signature should be preceded by exactly one space Open
}) {req in
- Exclude checks
Parameter clause in closure signature should be preceded by exactly one space Open
self.performRequest("post", path: "/multibodytest", callback: {response in
- Exclude checks
Parameter clause in closure signature should be preceded by exactly one space Open
self.performRequest("get", path:"/customPage2", callback: {response in
- Exclude checks
Parameter clause in closure signature should be preceded by exactly one space Open
.post {_, response, next in
- Exclude checks
Empty parentheses following method call with trailing closure argument should be removed Open
requestQueue.async() {
- Read upRead up
- Exclude checks
redundant-parentheses
Control flow constructs (if
, else if
, switch
, for
, while
, repeat-while
, and guard
statements), Exception handling constructs (throw
, and do/catch
statements), and Initializers (array
, dictionary
, initializer patterns
) should not be enclosed in parentheses.
Additionally, method calls with no parameters and a trailing closure should not have empty parentheses following the method name.
Control flow constructs
- if, else if statement
Preferred
if SomeCondition {
} else if SomeOtherCondition {
}
Not Preferred
if (SomeCondition) {
} else if (SomeOtherCondition) {
}
- switch statement
Preferred
switch SomeData {
default:
break
}
Not Preferred
switch (SomeData) {
default:
break
}
- for loop
Preferred
for var i = 0; i < 10; i+=1 {
}
Not Preferred
for (var i = 0; i < 10; i+=1) {
}
- while loop
Preferred
while SomeCondition {
}
Not Preferred
while (SomeCondition) {
}
- repeat-while loop
Preferred
repeat {
} while SomeCondition
Not Preferred
repeat {
} while (SomeCondition)
- guard clause
Preferred
guard true else { }
Not Preferred
guard (true) else { }
Exception handling constructs
- do/catch statement
Preferred
do {
} catch SomeException {
}
Not Preferred
do {
} catch (SomeException) {
}
- throw statement
Preferred
throw SomeException
Not Preferred
throw (SomeException)
Initializers
- array items
Preferred
var shoppingList: [String] = ["Eggs", "Milk"]
Not Preferred
var shoppingList: [String] = [("Eggs"), ("Milk")]
- dictionary items
Preferred
var airports: [String: String] = ["YYZ": "Toronto Pearson", "DUB": "Dublin"]
Not Preferred
var airports: [String: String] = [("YYZ"): ("Toronto Pearson"), ("DUB"): ("Dublin")]
- initializer patterns
Preferred
var x: Int = 2
var y: String = "Sleekbyte"
var x = 2
Not Preferred
var x: Int = (2)
var y: String = ("Sleekbyte")
var x = (2)
Method calls
Preferred
items.map {
item in item.transform()
}
Not Preferred
items.map() {
item in item.transform()
}
Parameter clause in closure signature should be preceded by exactly one space Open
self.performRequest("get", path:"/sub/sub2/sub1", callback: {response in
- Exclude checks
Parentheses content should not end with whitespace Open
func putSingleAppleHandlerStringId(id: String, posted: Apple, completion: (Apple?, RequestError?) -> Void ) -> Void {
- Exclude checks
Global Constant should be either lowerCamelCase or UpperCamelCase Open
let enable_nio = !( ["0","false"].contains(ProcessInfo.processInfo.environment["KITURA_NIO"]) )
- Read upRead up
- Exclude checks
constant-naming
Global constants should follow either UpperCamelCase or lowerCamelCase naming conventions. Local constants should follow lowerCamelCase naming conventions.
Preferred
let MaxHeight = 42
let maxHeight = 42
Not Preferred
let max_height = 42
Global Constant should be either lowerCamelCase or UpperCamelCase Open
let percent_grade: Int
- Read upRead up
- Exclude checks
constant-naming
Global constants should follow either UpperCamelCase or lowerCamelCase naming conventions. Local constants should follow lowerCamelCase naming conventions.
Preferred
let MaxHeight = 42
let maxHeight = 42
Not Preferred
let max_height = 42
Parameter clause in closure signature should be preceded by exactly one space Open
self.performRequest("get", path: "/1/cookiedump", callback: {response in
- Exclude checks
Closure is the function's final argument and may be passed as a trailing closure instead Open
}, { expectation in
- Read upRead up
- Exclude checks
trailing-closure
Closures that are the last argument of a function should be passed into the function using trailing closure syntax.
Preferred
reversed = names.sort { s1, s2 in return s1 > s2 }
Not Preferred
reversed = names.sort({ s1, s2 in return s1 > s2 })