IBM-Swift/Kitura

View on GitHub

Showing 850 of 850 total issues

Parameter clause in closure signature should be preceded by exactly one space
Open

            }) {req in
Severity: Minor
Found in Tests/KituraTests/TestResponse.swift by tailor

Parameter clause in closure signature should be preceded by exactly one space
Open

            self.performRequest("post", path: "/route", callback: {response in
Severity: Minor
Found in Tests/KituraTests/TestResponse.swift by tailor

Parentheses content should not end with whitespace
Open

func putSingleAppleHandlerIntId(id: Int, posted: Apple, completion: (Apple?, RequestError?) -> Void ) -> Void {

Parentheses content should not end with whitespace
Open

            XCTAssert(parsedParams.key1 == "value1" && parsedParams.key2 == "value2" && parsedParams.key3 == ["value3.1","value3.2","value3.3"] )
Severity: Minor
Found in Tests/KituraTests/TestRequests.swift by tailor

Parameter clause in closure signature should be preceded by exactly one space
Open

            self.performRequest("get", path:"/emptyHandler", callback: {response in
Severity: Minor
Found in Tests/KituraTests/TestResponse.swift by tailor

Parameter clause in closure signature should be preceded by exactly one space
Open

            }) {req in
Severity: Minor
Found in Tests/KituraTests/TestResponse.swift by tailor

Parameter clause in closure signature should be preceded by exactly one space
Open

            }) {req in
Severity: Minor
Found in Tests/KituraTests/TestResponse.swift by tailor

Closure is the function's final argument and may be passed as a trailing closure instead
Open

        }, { expectation in
Severity: Minor
Found in Tests/KituraTests/TestResponse.swift by tailor

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

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

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 })

Empty parentheses following method call with trailing closure argument should be removed
Open

        requestQueue.async() {
Severity: Minor
Found in Tests/KituraTests/TestServer.swift by tailor

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/sub1", callback: {response in

Closure is the function's final argument and may be passed as a trailing closure instead
Open

        }, { expectation in

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

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 })

Parentheses content should not end with whitespace
Open

func getQueryUglifruitHandler6(query: QueryThreeParams?, completion: (Uglifruit?, RequestError?) -> Void ) -> Void {

Parentheses content should not end with whitespace
Open

func getArrayAppleHandler(completion: ([Apple]?, RequestError?) -> Void ) -> Void {

Parameter clause in closure signature should be preceded by exactly one space
Open

            }) {req in
Severity: Minor
Found in Tests/KituraTests/TestResponse.swift by tailor

Parentheses content should not end with whitespace
Open

func postSingleAppleHandler(posted: Apple, completion: (Int?, Apple?, RequestError?) -> Void ) -> Void {

TODO found
Open

                usleep(1000)  // TODO: properly fix crash when creating ClientRequests concurrently

FIXME found
Open

                // FIXME: This only works if encoders are configured _before_ route registration.
Severity: Minor
Found in Sources/Kitura/SwaggerGenerator.swift by fixme
Severity
Category
Status
Source
Language