IBM-Swift/Kitura

View on GitHub

Showing 850 of 850 total issues

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    static var allTests: [(String, (TestCodablePathParams) -> () throws -> Void)] {
        return [
            ("testJoinPath", testJoinPath),
            ("testRouteWithTrailingSlash", testRouteWithTrailingSlash),
            ("testInvalidRouteParameters", testInvalidRouteParameters),
Severity: Major
Found in Tests/KituraTests/TestCodablePathParams.swift and 2 other locations - About 1 hr to fix
Tests/KituraTests/TestRouteRegex.swift on lines 52..62
Tests/KituraTests/TestServerOptions.swift on lines 32..42

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 94.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        customRouter.put("/customCoder2") { (middleware: UserMiddleware, middleware2: UserMiddleware, id: Int, inDate: CodableDate, respondWith: (CodableDate?, RequestError?) -> Void) in
            print("PUT on /customCoder/\(id)")
            XCTAssertEqual(inDate, codableDate)
            respondWith(codableDate, nil)
        }
Severity: Major
Found in Tests/KituraTests/TestTypeSafeMiddleware.swift and 1 other location - About 1 hr to fix
Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 1110..1114

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 94.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        customRouter.patch("/customCoder2") { (middleware: UserMiddleware, middleware2: UserMiddleware, id: Int, inDate: CodableDate, respondWith: (CodableDate?, RequestError?) -> Void) in
            print("PATCH on /customCoder/\(id)")
            XCTAssertEqual(inDate, codableDate)
            respondWith(codableDate, nil)
        }
Severity: Major
Found in Tests/KituraTests/TestTypeSafeMiddleware.swift and 1 other location - About 1 hr to fix
Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 1105..1109

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 94.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    static var allTests: [(String, (TestRouteRegex) -> () throws -> Void)] {
        return [
            ("testBuildRegexFromPattern", testBuildRegexFromPattern),
            ("testSimplePaths", testSimplePaths),
            ("testSimpleMatches", testSimpleMatches),
Severity: Major
Found in Tests/KituraTests/TestRouteRegex.swift and 2 other locations - About 1 hr to fix
Tests/KituraTests/TestCodablePathParams.swift on lines 24..34
Tests/KituraTests/TestServerOptions.swift on lines 32..42

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 94.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    static var allTests: [(String, (TestServerOptions) -> () throws -> Void)] {
        return [
            ("testSmallPostSucceeds", testSmallPostSucceeds),
            ("testLargePostExceedsLimit", testLargePostExceedsLimit),
            ("testRequestSizeLimitCustomResponse", testRequestSizeLimitCustomResponse),
Severity: Major
Found in Tests/KituraTests/TestServerOptions.swift and 2 other locations - About 1 hr to fix
Tests/KituraTests/TestCodablePathParams.swift on lines 24..34
Tests/KituraTests/TestRouteRegex.swift on lines 52..62

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 94.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

        delete(route) { request, response, next in
            Log.verbose("Received DELETE (plural with middleware) type-safe request")
            self.handleMiddleware(T1.self, T2.self, request: request, response: response) { typeSafeMiddleware1, typeSafeMiddleware2 in
                guard let typeSafeMiddleware1 = typeSafeMiddleware1, let typeSafeMiddleware2 = typeSafeMiddleware2 else {
                    return next()
Severity: Major
Found in Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift and 3 other locations - About 1 hr to fix
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 92..100
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 202..210
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 440..448

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

        get(route) { request, response, next in
            Log.verbose("Received GET(Array) with identifier typed middleware request")
            self.handleMiddleware(T1.self, T2.self, request: request, response: response) { typeSafeMiddleware1, typeSafeMiddleware2 in
                guard let typeSafeMiddleware1 = typeSafeMiddleware1, let typeSafeMiddleware2 = typeSafeMiddleware2 else {
                    return next()
Severity: Major
Found in Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift and 3 other locations - About 1 hr to fix
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 92..100
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 202..210
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 998..1006

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

        get(route) { request, response, next in
            Log.verbose("Received GET(Single) typed middleware request")
            self.handleMiddleware(T1.self, T2.self, request: request, response: response) { typeSafeMiddleware1, typeSafeMiddleware2 in
                guard let typeSafeMiddleware1 = typeSafeMiddleware1, let typeSafeMiddleware2 = typeSafeMiddleware2 else {
                    return next()
Severity: Major
Found in Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift and 3 other locations - About 1 hr to fix
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 202..210
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 440..448
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 998..1006

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

        get(route) { request, response, next in
            Log.verbose("Received GET(Array) typed middleware request")
            self.handleMiddleware(T1.self, T2.self, request: request, response: response) { typeSafeMiddleware1, typeSafeMiddleware2 in
                guard let typeSafeMiddleware1 = typeSafeMiddleware1, let typeSafeMiddleware2 = typeSafeMiddleware2 else {
                    return next()
Severity: Major
Found in Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift and 3 other locations - About 1 hr to fix
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 92..100
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 440..448
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 998..1006

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        buildServerTest(router, timeout: 30)
            .request("delete", path: "/userMiddleware/1", headers: ["TestHeader": "Hello"])
            .hasStatus(.noContent)
            .hasNoData()
            .has { _ in XCTAssertNil(self.userStore[1]) }
Severity: Major
Found in Tests/KituraTests/TestTypeSafeMiddleware.swift and 1 other location - About 1 hr to fix
Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 657..667

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        buildServerTest(router, timeout: 30)
            .request("delete", path: "/userMiddleware?id=1", headers: ["TestHeader": "Hello"])
            .hasStatus(.noContent)
            .hasNoData()
            .has { _ in XCTAssertNil(self.userStore[1]) }
Severity: Major
Found in Tests/KituraTests/TestTypeSafeMiddleware.swift and 1 other location - About 1 hr to fix
Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 598..608

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function testBasicGetSingle has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    func testBasicGetSingle() {
        router.get("/users") { (id: Int, respondWith: (User?, RequestError?) -> Void) in
            print("GET on /users/\(id)")
            guard let user = self.userStore[id] else {
                XCTFail("ERROR!!! Couldn't find user with id \(id)")
Severity: Minor
Found in Tests/KituraTests/TestCodableRouter.swift - About 1 hr to fix

    Function process has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        func process(request: RouterRequest, response: RouterResponse, parameterWalker: RouterParameterWalker, next: @escaping () -> Void) {
            guard let path = request.parsedURLPath.path else {
                Log.error("Failed to process request (path is nil)")
                next()
                return
    Severity: Minor
    Found in Sources/Kitura/RouterElement.swift - About 1 hr to fix

      Function handle has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public func handle(request: ServerRequest, response: ServerResponse) {
              var decoder: (() -> BodyDecoder)?
              if let contentType = request.headers["Content-Type"]?[0], let mediaType = MediaType(contentTypeHeader: contentType) {
                  decoder = decoders[mediaType]
              }
      Severity: Minor
      Found in Sources/Kitura/Router.swift - About 1 hr to fix

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

                performServerTest(router, asyncTasks: { expectation in
                    self.performRequest("get", path: "/test", callback: { response in
                        XCTAssertEqual(response?.statusCode, .OK)
        
                        do {
        Severity: Major
        Found in Tests/KituraTests/TestRouteRegex.swift and 4 other locations - About 1 hr to fix
        Tests/KituraTests/TestRouteRegex.swift on lines 152..165
        Tests/KituraTests/TestRouteRegex.swift on lines 171..184
        Tests/KituraTests/TestRouteRegex.swift on lines 210..223
        Tests/KituraTests/TestRouteRegex.swift on lines 248..261

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 91.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

                performServerTest(router, asyncTasks: { expectation in
                    self.performRequest("get", path: "/123/abc/456/def", callback: { response in
                        XCTAssertEqual(response?.statusCode, .OK)
        
                        do {
        Severity: Major
        Found in Tests/KituraTests/TestRouteRegex.swift and 4 other locations - About 1 hr to fix
        Tests/KituraTests/TestRouteRegex.swift on lines 152..165
        Tests/KituraTests/TestRouteRegex.swift on lines 171..184
        Tests/KituraTests/TestRouteRegex.swift on lines 210..223
        Tests/KituraTests/TestRouteRegex.swift on lines 284..297

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 91.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

                performServerTest(router, asyncTasks: { expectation in
                    self.performRequest("get", path: "", callback: { response in
                        XCTAssertEqual(response?.statusCode, .OK)
        
                        do {
        Severity: Major
        Found in Tests/KituraTests/TestRouteRegex.swift and 4 other locations - About 1 hr to fix
        Tests/KituraTests/TestRouteRegex.swift on lines 171..184
        Tests/KituraTests/TestRouteRegex.swift on lines 210..223
        Tests/KituraTests/TestRouteRegex.swift on lines 248..261
        Tests/KituraTests/TestRouteRegex.swift on lines 284..297

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 91.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

                performServerTest(router, asyncTasks: { expectation in
                    self.performRequest("get", path: "/helloworld", callback: { response in
                        XCTAssertEqual(response?.statusCode, .OK)
        
                        do {
        Severity: Major
        Found in Tests/KituraTests/TestRouteRegex.swift and 4 other locations - About 1 hr to fix
        Tests/KituraTests/TestRouteRegex.swift on lines 152..165
        Tests/KituraTests/TestRouteRegex.swift on lines 210..223
        Tests/KituraTests/TestRouteRegex.swift on lines 248..261
        Tests/KituraTests/TestRouteRegex.swift on lines 284..297

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 91.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

                performServerTest(router, asyncTasks: { expectation in
                    self.performRequest("get", path: "", callback: { response in
                        XCTAssertEqual(response?.statusCode, .OK)
        
                        do {
        Severity: Major
        Found in Tests/KituraTests/TestRouteRegex.swift and 4 other locations - About 1 hr to fix
        Tests/KituraTests/TestRouteRegex.swift on lines 152..165
        Tests/KituraTests/TestRouteRegex.swift on lines 171..184
        Tests/KituraTests/TestRouteRegex.swift on lines 248..261
        Tests/KituraTests/TestRouteRegex.swift on lines 284..297

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 91.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function testCodableDeleteQueryParameters has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            func testCodableDeleteQueryParameters() {
                /// Currently the milliseconds are cut off by our date formatter
                /// This synchronizes it for testing with the codable route
                let date: Date = Coder.defaultDateFormatter.date(from: Coder.defaultDateFormatter.string(from: Date()))!
        
        
        Severity: Minor
        Found in Tests/KituraTests/TestCodableRouter.swift - About 1 hr to fix
          Severity
          Category
          Status
          Source
          Language