IBM-Swift/Kitura

View on GitHub

Showing 279 of 850 total issues

Function render has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    func render<T: Encodable>(filePath: String, with: T, forKey: String?, options: RenderingOptions, templateName: String) throws -> String {
Severity: Minor
Found in Tests/KituraTests/TestTemplateEngine.swift - About 35 mins to fix

    Function handleMatch has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            private static func handleMatch(rawHeaderValue: String, type: String, matchAllPattern: String,
                                            criteriaMatches: inout CriteriaMatches, headerOrder: Int) {
    Severity: Minor
    Found in Sources/Kitura/MimeTypeAcceptor.swift - About 35 mins to fix

      Function doPerformServerTest has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          func doPerformServerTest(router: ServerDelegate, options: ServerOptions?, timeout: TimeInterval, line: Int, asyncTasks: [(XCTestExpectation) -> Void]) {
      Severity: Minor
      Found in Tests/KituraTests/KituraTest.swift - About 35 mins to fix

        Function addCookie has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public func addCookie(name: String, value: String, domain: String, path: String, otherAttributes: [AdditionalCookieAttribute]? = nil ) {
        Severity: Minor
        Found in Sources/Kitura/RouterResponse.swift - About 35 mins to fix

          Function serveExistingFile has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  private func serveExistingFile(_ filePath: String, requestPath: String, queryString: String,
                                                 isDirectory: Bool, response: RouterResponse) {
          Severity: Minor
          Found in Sources/Kitura/staticFileServer/FileServer.swift - About 35 mins to fix

            Function buildServerTest has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                func buildServerTest(_ router: ServerDelegate, sslOption: SSLOption = SSLOption.both, socketTypeOption: SocketTypeOption = SocketTypeOption.both, timeout: TimeInterval = 10,
                                       line: Int = #line) -> RequestTestBuilder {
            Severity: Minor
            Found in Tests/KituraTests/KituraTest.swift - About 35 mins to fix

              Function handleMiddleware has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      _ middlewareOneType: T1.Type,
                      _ middlewareTwoType: T2.Type,
                      request: RouterRequest,
                      response: RouterResponse,
                      completion: @escaping (T1?, T2?) -> Void
              Severity: Minor
              Found in Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift - About 35 mins to fix

                Function get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public func get<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, Q: QueryParams, O: Codable>(
                        _ route: String,
                        handler: @escaping (T1, T2, Q, @escaping CodableArrayResultClosure<O>) -> Void
                    ) {
                        registerGetRoute(route: route, queryParams: Q.self, optionalQParam: false, outputType: O.self, outputIsArray: true)
                Severity: Minor
                Found in Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift - About 35 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function post has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public func post<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, T3: TypeSafeMiddleware, I: Codable, O: Codable>(
                        _ route: String,
                        handler: @escaping (T1, T2, T3, I, @escaping CodableResultClosure<O>) -> Void
                    ) {
                        registerPostRoute(route: route, inputType: I.self, outputType: O.self)
                Severity: Minor
                Found in Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift - About 35 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public func get<T: TypeSafeMiddleware, Q: QueryParams, O: Codable>(
                        _ route: String,
                        handler: @escaping (T, Q, @escaping CodableResultClosure<O>) -> Void
                    ) {
                        registerGetRoute(route: route, queryParams: Q.self, optionalQParam: false, outputType: O.self)
                Severity: Minor
                Found in Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift - About 35 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function delete has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public func delete<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, Q: QueryParams>(
                        _ route: String,
                        handler: @escaping (T1, T2, Q, @escaping ResultClosure) -> Void
                    ) {
                        registerDeleteRoute(route: route, queryParams: Q.self, optionalQParam: false)
                Severity: Minor
                Found in Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift - About 35 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function doPerformServerTest has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    func doPerformServerTest(router: ServerDelegate, options: ServerOptions?, timeout: TimeInterval, line: Int, asyncTasks: [(XCTestExpectation) -> Void]) {
                
                        if self.useUnixSocket {
                            guard let socketPath = startUnixSocketServer(router: router, options: options) else {
                                return XCTFail("Error starting server. useSSL:\(self.useSSL), useUnixSocket:\(self.useUnixSocket)")
                Severity: Minor
                Found in Tests/KituraTests/KituraTest.swift - About 35 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function post has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public func post<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, I: Codable, O: Codable>(
                        _ route: String,
                        handler: @escaping (T1, T2, I, @escaping CodableResultClosure<O>) -> Void
                    ) {
                        registerPostRoute(route: route, inputType: I.self, outputType: O.self)
                Severity: Minor
                Found in Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift - About 35 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public func get<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, T3: TypeSafeMiddleware, Q: QueryParams, O: Codable>(
                        _ route: String,
                        handler: @escaping (T1, T2, T3, Q, @escaping CodableResultClosure<O>) -> Void
                    ) {
                        registerGetRoute(route: route, queryParams: Q.self, optionalQParam: false, outputType: O.self)
                Severity: Minor
                Found in Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift - About 35 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function post has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public func post<T: TypeSafeMiddleware, I: Codable, Id: Identifier, O: Codable>(
                        _ route: String,
                        handler: @escaping (T, I, @escaping IdentifierCodableResultClosure<Id, O>) -> Void
                    ) {
                        registerPostRoute(route: route, id: Id.self, inputType: I.self, outputType: O.self)
                Severity: Minor
                Found in Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift - About 35 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function post has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public func post<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, I: Codable, Id: Identifier, O: Codable>(
                        _ route: String,
                        handler: @escaping (T1, T2, I, @escaping IdentifierCodableResultClosure<Id, O>) -> Void
                    ) {
                        registerPostRoute(route: route, id: Id.self, inputType: I.self, outputType: O.self)
                Severity: Minor
                Found in Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift - About 35 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function delete has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public func delete<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, T3: TypeSafeMiddleware, Q: QueryParams>(
                        _ route: String,
                        handler: @escaping (T1, T2, T3, Q, @escaping ResultClosure) -> Void
                    ) {
                        registerDeleteRoute(route: route, queryParams: Q.self, optionalQParam: false)
                Severity: Minor
                Found in Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift - About 35 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public func get<T: TypeSafeMiddleware, Q: QueryParams, O: Codable>(
                        _ route: String,
                        handler: @escaping (T, Q, @escaping CodableArrayResultClosure<O>) -> Void
                    ) {
                        registerGetRoute(route: route, queryParams: Q.self, optionalQParam: false, outputType: O.self, outputIsArray: true)
                Severity: Minor
                Found in Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift - About 35 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public func get<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, T3: TypeSafeMiddleware, Q: QueryParams, O: Codable>(
                        _ route: String,
                        handler: @escaping (T1, T2, T3, Q, @escaping CodableArrayResultClosure<O>) -> Void
                    ) {
                        registerGetRoute(route: route, queryParams: Q.self, optionalQParam: false, outputType: O.self, outputIsArray: true)
                Severity: Minor
                Found in Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift - About 35 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function serveExistingFile has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                        private func serveExistingFile(_ filePath: String, requestPath: String, queryString: String,
                                                       isDirectory: Bool, response: RouterResponse) {
                            if isDirectory {
                                if redirect {
                                    do {
                Severity: Minor
                Found in Sources/Kitura/staticFileServer/FileServer.swift - About 35 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Severity
                Category
                Status
                Source
                Language