IBM-Swift/Kitura

View on GitHub

Showing 279 of 850 total issues

Function highlight has 85 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var highlight = function(doc) {
        "use strict";
        var defaults = {
            node: null,
            pattern: null,

    Function highlight has 85 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        var highlight = function(doc) {
            "use strict";
            var defaults = {
                node: null,
                pattern: null,
    Severity: Major
    Found in docs/js/typeahead.jquery.js - About 3 hrs to fix

      File TestRouterHTTPVerbs_generated.swift has 304 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import XCTest
      import Foundation
      
      @testable import Kitura
      @testable import KituraNet
      Severity: Minor
      Found in Tests/KituraTests/TestRouterHTTPVerbs_generated.swift - About 3 hrs to fix

        Function testCustomQueryEncoder has 80 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            func testCustomQueryEncoder() {
                // Set up router for this test
                let customRouter = Router()
                customRouter.encoders[.urlEncoded] =  { return QueryEncoder() }
                
        Severity: Major
        Found in Tests/KituraTests/TestCustomCoders.swift - About 3 hrs to fix

          File KituraTest.swift has 299 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import XCTest
          import Kitura
          
          @testable import KituraNet
          
          
          Severity: Minor
          Found in Tests/KituraTests/KituraTest.swift - About 3 hrs to fix

            Function cookieFrom has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
            Open

                func cookieFrom(response: ClientResponse?, named: String) -> (HTTPCookie?, String?) {
                    guard let response = response else {
                        return (nil, nil)
                    }
                    var resultCookie: HTTPCookie? = nil
            Severity: Minor
            Found in Tests/KituraTests/TestCookies.swift - About 3 hrs 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 testSimpleMatches has 76 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                func testSimpleMatches() {
                    var router = Router()
            
                    router.all("/test", handler: handler)
            
            
            Severity: Major
            Found in Tests/KituraTests/TestRouteRegex.swift - About 3 hrs to fix

              TestTemplateEngine has 26 methods (exceeds 20 allowed). Consider refactoring.
              Open

              final class TestTemplateEngine: KituraTest, KituraTestSuite {
              
                  static var allTests: [(String, (TestTemplateEngine) -> () throws -> Void)] {
                      return [
                          ("testEmptyTemplateName", testEmptyTemplateName),
              Severity: Minor
              Found in Tests/KituraTests/TestTemplateEngine.swift - About 3 hrs to fix

                Function testQueryParameters has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    func testQueryParameters() {
                        // Set up router for this test
                        let router = Router()
                
                        struct Params: QueryParams {
                Severity: Major
                Found in Tests/KituraTests/TestRequests.swift - About 2 hrs to fix

                  Function testSend has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                  Open

                      func testSend() {
                          performServerTest(router) { expectation in
                              self.performRequest("get", path: "/data", callback: { response in
                                  XCTAssertNotNil(response, "ERROR!!! ClientRequest response object was nil")
                                  XCTAssertEqual(response?.statusCode, HTTPStatusCode.OK, "HTTP Status code was \(String(describing: response?.statusCode))")
                  Severity: Minor
                  Found in Tests/KituraTests/TestResponse.swift - About 2 hrs 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 testCookieFromServer has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      func testCookieFromServer() {
                          performServerTest(router, asyncTasks: { expectation in
                              self.performRequest("get", path: "/1/sendcookie", callback: {response in
                                  XCTAssertEqual(response?.statusCode, HTTPStatusCode.OK, "/1/sendcookie route did not match single path request")
                  
                  
                  Severity: Major
                  Found in Tests/KituraTests/TestCookies.swift - About 2 hrs to fix

                    Function testCustomQueryEncoder has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                    Open

                        func testCustomQueryEncoder() {
                            // Set up router for this test
                            let customRouter = Router()
                            customRouter.encoders[.urlEncoded] =  { return QueryEncoder() }
                            
                    Severity: Minor
                    Found in Tests/KituraTests/TestCustomCoders.swift - About 2 hrs 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 testQueryParameters has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                    Open

                        func testQueryParameters() {
                            // Set up router for this test
                            let router = Router()
                    
                            struct Params: QueryParams {
                    Severity: Minor
                    Found in Tests/KituraTests/TestRequests.swift - About 2 hrs 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 testFourthTypeVerbsAdded has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        func testFourthTypeVerbsAdded() {
                                let router = Router()
                                var verbsArray: [String] = []
                                let bodyParser = BodyParser()
                                verbsArray.append("ALL")
                    Severity: Major
                    Found in Tests/KituraTests/TestRouterHTTPVerbs_generated.swift - About 2 hrs to fix

                      File TestCookies.swift has 280 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import XCTest
                      import Foundation
                      #if swift(>=4.1)
                        #if canImport(FoundationNetworking)
                          import FoundationNetworking
                      Severity: Minor
                      Found in Tests/KituraTests/TestCookies.swift - About 2 hrs to fix

                        Function testThirdTypeVerbsAdded has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            func testThirdTypeVerbsAdded() {
                                    let router = Router()
                                    var verbsArray: [String] = []
                                    let bodyParser = BodyParser()
                                    verbsArray.append("ALL")
                        Severity: Major
                        Found in Tests/KituraTests/TestRouterHTTPVerbs_generated.swift - About 2 hrs to fix

                          Function testSecondTypeVerbsAdded has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              func testSecondTypeVerbsAdded() {
                                      let router = Router()
                                      var verbsArray: [String] = []
                                      verbsArray.append("ALL")
                                      router.all("/bodytest", handler: [self.bodyTestHandler, self.bodyTestHandler])
                          Severity: Major
                          Found in Tests/KituraTests/TestRouterHTTPVerbs_generated.swift - About 2 hrs to fix

                            Function testFirstTypeVerbsAdded has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                func testFirstTypeVerbsAdded() {
                                        let router = Router()
                                        var verbsArray: [String] = []
                                        verbsArray.append("ALL")
                                        router.all("/bodytest", handler: self.bodyTestHandler)
                            Severity: Major
                            Found in Tests/KituraTests/TestRouterHTTPVerbs_generated.swift - About 2 hrs to fix

                              ServerTestBuilder has 24 methods (exceeds 20 allowed). Consider refactoring.
                              Open

                              class ServerTestBuilder: RequestTestBuilder, AssertionTestBuilder {
                                  // An object to keep track of a request and store up a list of
                                  // assertions to be applied when the request is complete
                                  private class Request {
                                      let test: KituraTest
                              Severity: Minor
                              Found in Tests/KituraTests/KituraTestBuilder.swift - About 2 hrs to fix

                                Function parse has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    static func parse(size: UInt64, headerValue: String, shouldCombine: Bool = true) throws -> RangeHeader {
                                
                                        guard let index = headerValue.range(of: "=")?.lowerBound else {
                                            // malformed
                                            throw RangeHeader.Error.malformed
                                Severity: Minor
                                Found in Sources/Kitura/staticFileServer/RangeHeader.swift - About 2 hrs 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