IBM-Swift/Kitura

View on GitHub
Tests/KituraTests/TestCodableRouter.swift

Summary

Maintainability
F
1 wk
Test Coverage

File TestCodableRouter.swift has 674 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import XCTest
import Foundation
import KituraContracts

@testable import Kitura
Severity: Major
Found in Tests/KituraTests/TestCodableRouter.swift - About 1 day to fix

    Function testBasicPost has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        func testBasicPost() {
            router.post("/users") { (user: User, respondWith: (User?, RequestError?) -> Void) in
                print("POST on /users for user \(user)")
                respondWith(user, nil)
            }
    Severity: Minor
    Found in Tests/KituraTests/TestCodableRouter.swift - About 1 hr to fix

      Function testErrorOverridesBody has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          func testErrorOverridesBody() {
              let status = Status("This should not be sent")
              router.get("/status") { (id: Int, respondWith: (Status?, RequestError?) -> Void) in respondWith(status, .conflict) }
              router.post("/status") { (status: Status, respondWith: (Status?, RequestError?) -> Void) in respondWith(status, .conflict) }
              router.put("/status") { (id: Int, status: Status, respondWith: (Status?, RequestError?) -> Void) in respondWith(status, .conflict) }
      Severity: Minor
      Found in Tests/KituraTests/TestCodableRouter.swift - About 1 hr to fix

        Function testBasicPatch has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            func testBasicPatch() {
                router.patch("/users") { (id: Int, patchUser: OptionalUser, respondWith: (User?, RequestError?) -> Void) -> Void in
                    print("PATCH on /users/\(id)")
                    guard let existingUser = self.userStore[id] else {
                        respondWith(nil, .notFound)
        Severity: Minor
        Found in Tests/KituraTests/TestCodableRouter.swift - About 1 hr to fix

          Function testBasicGetIdentifiersArray has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              func testBasicGetIdentifiersArray() {
                  let intTuple: [(Int, User)] = [(1, User(id: 1, name: "Andy")), (2, User(id: 2, name: "Dave")), (3, User(id: 3, name: "Ian"))]
                  // expectedIntData = [["1": User(id: 1, name: "Andy")], ["2": User(id: 2, name: "Dave")], ["3": User(id: 3, name: "Ian")]]
                  let expectedIntData: [[String: User]] = intTuple.map({ [$0.value: $1] })
                  
          Severity: Minor
          Found in Tests/KituraTests/TestCodableRouter.swift - About 1 hr to fix

            Function testCodableGetSingleQueryParameters has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                func testCodableGetSingleQueryParameters() {
                    let date: Date = Coder.defaultDateFormatter.date(from: Coder.defaultDateFormatter.string(from: Date()))!
            
                    let expectedQuery = MyQuery(intField: 23, optionalIntField: 282, stringField: "a string", intArray: [1, 2, 3], dateField: date, optionalDateField: date, nested: Nested(nestedIntField: 333, nestedStringField: "nested string"))
            
            
            Severity: Minor
            Found in Tests/KituraTests/TestCodableRouter.swift - About 1 hr to fix

              Function testCodableGetArrayQueryParameters has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  func testCodableGetArrayQueryParameters() {
                      /// 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

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

                    Function testBasicPut has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        func testBasicPut() {
                            router.put("/users") { (id: Int, user: User, respondWith: (User?, RequestError?) -> Void) in
                                print("PUT on /users/\(id)")
                                self.userStore[id] = user
                                respondWith(user, nil)
                    Severity: Minor
                    Found in Tests/KituraTests/TestCodableRouter.swift - About 1 hr to fix

                      Function testBasicDeleteSingle has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          func testBasicDeleteSingle() {
                              router.delete("/users") { (id: Int, respondWith: (RequestError?) -> Void) in
                                  print("DELETE on /users/\(id)")
                                  guard let _ = self.userStore.removeValue(forKey: id) else {
                                      respondWith(.notFound)
                      Severity: Minor
                      Found in Tests/KituraTests/TestCodableRouter.swift - About 1 hr to fix

                        Function testCodablePostSuccessStatuses has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            func testCodablePostSuccessStatuses() {
                                // Test POST success statuses other than .created
                                router.post("/ok") { (user: User, respondWith: (User?, RequestError?) -> Void) in
                                    print("POST on /ok for user \(user)")
                                    respondWith(user, .ok)
                        Severity: Minor
                        Found in Tests/KituraTests/TestCodableRouter.swift - About 1 hr to fix

                          Function testBasicPostIdentifier has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              func testBasicPostIdentifier() {
                                  router.post("/users") { (user: User, respondWith: (Int?, User?, RequestError?) -> Void) in
                                      print("POST on /users for user \(user)")
                                      respondWith(user.id, user, nil)
                                  }
                          Severity: Minor
                          Found in Tests/KituraTests/TestCodableRouter.swift - About 1 hr to fix

                            Function testBasicDelete has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                func testBasicDelete() {
                                    router.delete("/users") { (respondWith: (RequestError?) -> Void) in
                                        print("DELETE on /users")
                                        self.userStore.removeAll()
                                        respondWith(nil)
                            Severity: Minor
                            Found in Tests/KituraTests/TestCodableRouter.swift - About 1 hr to fix

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

                                      buildServerTest(router, timeout: 30)
                                          .request("patch", path: "/users/2", data: user)
                                          .hasStatus(.OK)
                                          .hasContentType(withPrefix: "application/json")
                                          .hasData(user)
                              Severity: Major
                              Found in Tests/KituraTests/TestCodableRouter.swift and 1 other location - About 2 hrs to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 476..492

                              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 152.

                              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("put", path: "/users/1", data: user)
                                          .hasStatus(.OK)
                                          .hasContentType(withPrefix: "application/json")
                                          .hasData(user)
                              Severity: Major
                              Found in Tests/KituraTests/TestCodableRouter.swift and 1 other location - About 2 hrs to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 575..591

                              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 152.

                              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

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

                                  struct User: Codable, Equatable {
                                      let id: Int
                                      let name: String
                              
                                      init(id: Int, name: String) {
                              Severity: Major
                              Found in Tests/KituraTests/TestCodableRouter.swift and 1 other location - About 1 hr to fix
                              Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 72..84

                              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 117.

                              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("get", path: "/users/1")
                                          .hasStatus(.OK)
                                          .hasContentType(withPrefix: "application/json")
                                          .hasData(user)
                              Severity: Major
                              Found in Tests/KituraTests/TestCodableRouter.swift and 1 other location - About 1 hr to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 689..702

                              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 98.

                              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("get", path: "/query\(queryStr)")
                                          .hasStatus(.OK)
                                          .hasContentType(withPrefix: "application/json")
                                          .hasData(expectedQuery)
                              Severity: Major
                              Found in Tests/KituraTests/TestCodableRouter.swift and 1 other location - About 1 hr to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 371..384

                              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 98.

                              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("post", path: "/ok", data: user)
                                          .hasStatus(.OK)
                                          .hasContentType(withPrefix: "application/json")
                                          .hasData(user)
                              Severity: Major
                              Found in Tests/KituraTests/TestCodableRouter.swift and 1 other location - About 1 hr to fix
                              Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 516..527

                              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 89.

                              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

                                      let intTuple: [(Int, User)] = [(1, User(id: 1, name: "Andy")), (2, User(id: 2, name: "Dave")), (3, User(id: 3, name: "Ian"))]
                              Severity: Major
                              Found in Tests/KituraTests/TestCodableRouter.swift and 3 other locations - About 1 hr to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 301..301
                              Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 293..293
                              Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 316..316

                              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 78.

                              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

                                      let stringTuple: [(String, User)] = [("1", User(id: 1, name: "Andy")), ("2", User(id: 2, name: "Dave")), ("3", User(id: 3, name: "Ian"))]
                              Severity: Major
                              Found in Tests/KituraTests/TestCodableRouter.swift and 3 other locations - About 1 hr to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 297..297
                              Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 293..293
                              Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 316..316

                              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 78.

                              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

                                  struct Conflict: Codable, Equatable {
                                      let field: String
                              
                                      init(on field: String) {
                                          self.field = field
                              Severity: Major
                              Found in Tests/KituraTests/TestCodableRouter.swift and 2 other locations - About 1 hr to fix
                              Tests/KituraTests/TestCustomCoders.swift on lines 33..41
                              Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 86..95

                              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 78.

                              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("post", path: "/noBody", data: user)
                                          .hasStatus(.created)
                                          .hasHeader("Location", only: "1")
                              Severity: Major
                              Found in Tests/KituraTests/TestCodableRouter.swift and 1 other location - About 1 hr to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 507..518

                              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 77.

                              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("post", path: "/noBody", data: user)
                                          .hasStatus(.noContent)
                                          .hasHeader("Location", only: "1")
                              Severity: Major
                              Found in Tests/KituraTests/TestCodableRouter.swift and 1 other location - About 1 hr to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 534..545

                              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 77.

                              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

                                      router.post("/noBody") { (data: User, respondWith: (Int?, User?, RequestError?) -> Void) in
                                          print("POST on /noBody")
                                          respondWith(1, nil, .noContent)
                                      }
                              Severity: Major
                              Found in Tests/KituraTests/TestCodableRouter.swift and 1 other location - About 1 hr to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 203..206

                              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 73.

                              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

                                      router.post("/error/users") { (user: User, respondWith: (Int?, User?, RequestError?) -> Void) in
                                          print("POST on /error/users for user \(user)")
                                          respondWith(nil, nil, .conflict)
                                      }
                              Severity: Major
                              Found in Tests/KituraTests/TestCodableRouter.swift and 1 other location - About 1 hr to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 501..504

                              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 73.

                              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

                                      router.put("/error/users") { (id: Int, user: User, respondWith: (User?, RequestError?) -> Void) in
                                          print("PUT on /error/users/\(id)")
                                          respondWith(nil, .serviceUnavailable)
                                      }
                              Severity: Major
                              Found in Tests/KituraTests/TestCodableRouter.swift and 2 other locations - About 1 hr to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 497..500
                              Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 1142..1145

                              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 70.

                              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

                                      router.put("/noBody") { (id: Int, data: User, respondWith: (User?, RequestError?) -> Void) in
                                          print("PUT on /noBody/\(id)")
                                          respondWith(nil, .noContent)
                                      }
                              Severity: Major
                              Found in Tests/KituraTests/TestCodableRouter.swift and 2 other locations - About 1 hr to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 464..467
                              Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 1142..1145

                              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 70.

                              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

                                      router.get("/int/users") { (respondWith: ([(Int, User)]?, RequestError?) -> Void) in
                                          print("GET on /int/users")
                                          respondWith(intTuple, nil)
                                      }
                              Severity: Minor
                              Found in Tests/KituraTests/TestCodableRouter.swift and 1 other location - About 1 hr to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 315..318

                              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 69.

                              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

                                      router.get("/string/users") { (respondWith: ([(String, User)]?, RequestError?) -> Void) in
                                          print("GET on /string/users")
                                          respondWith(stringTuple, nil)
                                      }
                              Severity: Minor
                              Found in Tests/KituraTests/TestCodableRouter.swift and 1 other location - About 1 hr to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 305..308

                              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 69.

                              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

                                      router.patch("/bodyerror/status") { (id: Int, status: Status, respondWith: (Status?, RequestError?) -> Void) in respondWith(status, bodyError) }
                              Severity: Minor
                              Found in Tests/KituraTests/TestCodableRouter.swift and 1 other location - About 55 mins to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 605..605

                              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 63.

                              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

                                      router.post("/urlencoded") { (user: User, respondWith: (User?, RequestError?) -> Void) in
                                          print("POST on /urlencoded for user \(user)")
                                          respondWith(user, nil)
                                      }
                              Severity: Major
                              Found in Tests/KituraTests/TestCodableRouter.swift and 2 other locations - About 55 mins to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 144..147
                              Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 127..130

                              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 63.

                              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

                                      router.get("/error/users") { (id: Int, respondWith: (User?, RequestError?) -> Void) in
                                          print("GET on /error/users/\(id)")
                                          respondWith(nil, .serviceUnavailable)
                                      }
                              Severity: Minor
                              Found in Tests/KituraTests/TestCodableRouter.swift and 1 other location - About 55 mins to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 148..151

                              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 63.

                              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

                                      router.post("/error/users") { (user: User, respondWith: (User?, RequestError?) -> Void) in
                                          print("POST on /error/users for user \(user)")
                                          respondWith(nil, .conflict)
                                      }
                              Severity: Minor
                              Found in Tests/KituraTests/TestCodableRouter.swift and 1 other location - About 55 mins to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 358..361

                              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 63.

                              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

                                      router.put("/bodyerror/status") { (id: Int, status: Status, respondWith: (Status?, RequestError?) -> Void) in respondWith(status, bodyError) }
                              Severity: Minor
                              Found in Tests/KituraTests/TestCodableRouter.swift and 1 other location - About 55 mins to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 606..606

                              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 63.

                              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

                                      router.put("/status") { (id: Int, status: Status, respondWith: (Status?, RequestError?) -> Void) in respondWith(status, .conflict) }
                              Severity: Minor
                              Found in Tests/KituraTests/TestCodableRouter.swift and 1 other location - About 55 mins to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 599..599

                              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 63.

                              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

                                      router.post("/ok") { (user: User, respondWith: (User?, RequestError?) -> Void) in
                                          print("POST on /ok for user \(user)")
                                          respondWith(user, .ok)
                                      }
                              Severity: Minor
                              Found in Tests/KituraTests/TestCodableRouter.swift and 1 other location - About 55 mins to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 821..824

                              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 63.

                              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

                                      router.post("/users") { (user: User, respondWith: (User?, RequestError?) -> Void) in
                                          print("POST on /users for user \(user)")
                                          respondWith(user, nil)
                                      }
                              Severity: Major
                              Found in Tests/KituraTests/TestCodableRouter.swift and 2 other locations - About 55 mins to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 156..159
                              Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 127..130

                              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 63.

                              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

                                      router.post("/partialContent") { (user: User, respondWith: (User?, RequestError?) -> Void) in
                                          print("POST on /partialContent for user \(user)")
                                          respondWith(user, .partialContent)
                                      }
                              Severity: Minor
                              Found in Tests/KituraTests/TestCodableRouter.swift and 1 other location - About 55 mins to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 817..820

                              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 63.

                              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

                                      router.patch("/status") { (id: Int, status: Status, respondWith: (Status?, RequestError?) -> Void) in respondWith(status, .conflict) }
                              Severity: Minor
                              Found in Tests/KituraTests/TestCodableRouter.swift and 1 other location - About 55 mins to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 598..598

                              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 63.

                              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

                                      router.get("/status") { (id: Int, respondWith: (Status?, RequestError?) -> Void) in respondWith(status, .conflict) }
                              Severity: Minor
                              Found in Tests/KituraTests/TestCodableRouter.swift and 1 other location - About 45 mins to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 597..597

                              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 56.

                              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

                                      router.post("/bodyerror/status") { (status: Status, respondWith: (Status?, RequestError?) -> Void) in respondWith(status, bodyError) }
                              Severity: Minor
                              Found in Tests/KituraTests/TestCodableRouter.swift and 1 other location - About 45 mins to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 603..603

                              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 56.

                              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

                                      router.get("/bodyerror/status") { (id: Int, respondWith: (Status?, RequestError?) -> Void) in respondWith(status, bodyError) }
                              Severity: Minor
                              Found in Tests/KituraTests/TestCodableRouter.swift and 1 other location - About 45 mins to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 604..604

                              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 56.

                              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

                                      router.post("/status") { (status: Status, respondWith: (Status?, RequestError?) -> Void) in respondWith(status, .conflict) }
                              Severity: Minor
                              Found in Tests/KituraTests/TestCodableRouter.swift and 1 other location - About 45 mins to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 596..596

                              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 56.

                              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

                                      router.delete("/error/users") { (id: Int, respondWith: (RequestError?) -> Void) in
                                          print("DELETE on /error/users/\(id)")
                                          respondWith(.serviceUnavailable)
                                      }
                              Severity: Major
                              Found in Tests/KituraTests/TestCodableRouter.swift and 2 other locations - About 45 mins to fix
                              Tests/KituraTests/TestCodablePathParams.swift on lines 100..103
                              Tests/KituraTests/TestCodablePathParams.swift on lines 144..147

                              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 53.

                              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

                                      userStore = [1: User(id: 1, name: "Mike"), 2: User(id: 2, name: "Chris"), 3: User(id: 3, name: "Ricardo")]
                              Severity: Minor
                              Found in Tests/KituraTests/TestCodableRouter.swift and 1 other location - About 40 mins to fix
                              Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 69..69

                              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 48.

                              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

                                      router.delete("/error/users") { (respondWith: (RequestError?) -> Void) in
                                          print("DELETE on /error/users")
                                          respondWith(.serviceUnavailable)
                                      }
                              Severity: Minor
                              Found in Tests/KituraTests/TestCodableRouter.swift and 1 other location - About 35 mins to fix
                              Tests/KituraTests/TestCodablePathParams.swift on lines 121..124

                              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 46.

                              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

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

                                      let expectedQuery = MyQuery(intField: 23, optionalIntField: 282, stringField: "a string", intArray: [1, 2, 3], dateField: date, optionalDateField: date, nested: Nested(nestedIntField: 333, nestedStringField: "nested string"))
                              Severity: Minor
                              Found in Tests/KituraTests/TestCodableRouter.swift and 2 other locations - About 35 mins to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 668..668
                              Tests/KituraTests/TestCodableRouter.swift on lines 772..772

                              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 44.

                              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

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

                                      let expectedQuery = MyQuery(intField: 23, optionalIntField: 282, stringField: "a string", intArray: [1, 2, 3], dateField: date, optionalDateField: date, nested: Nested(nestedIntField: 333, nestedStringField: "nested string"))
                              Severity: Minor
                              Found in Tests/KituraTests/TestCodableRouter.swift and 2 other locations - About 35 mins to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 668..668
                              Tests/KituraTests/TestCodableRouter.swift on lines 720..720

                              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 44.

                              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

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

                                      let expectedQuery = MyQuery(intField: 23, optionalIntField: 282, stringField: "a string", intArray: [1, 2, 3], dateField: date, optionalDateField: date, nested: Nested(nestedIntField: 333, nestedStringField: "nested string"))
                              Severity: Minor
                              Found in Tests/KituraTests/TestCodableRouter.swift and 2 other locations - About 35 mins to fix
                              Tests/KituraTests/TestCodableRouter.swift on lines 720..720
                              Tests/KituraTests/TestCodableRouter.swift on lines 772..772

                              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 44.

                              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

                              Operator definitions should be followed by exactly one space
                              Open

                                      static func ==(lhs: Status, rhs: Status) -> Bool {

                              Operator definitions should be followed by exactly one space
                              Open

                                      static func ==(lhs: OptionalUser, rhs: OptionalUser) -> Bool {

                              Operator definitions should be followed by exactly one space
                              Open

                                      static func ==(lhs: User, rhs: User) -> Bool {

                              Operator definitions should be followed by exactly one space
                              Open

                                      public static func ==(lhs: MyQuery, rhs: MyQuery) -> Bool {

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

                                      let expectedStringData: [[String: User]] = stringTuple.map({ [$0.value: $1] })

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

                              Operator definitions should be followed by exactly one space
                              Open

                                      public static func ==(lhs: Nested, rhs: Nested) -> Bool {

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

                                      let expectedIntData: [[String: User]] = intTuple.map({ [$0.value: $1] })

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

                              Operator definitions should be followed by exactly one space
                              Open

                                      static func ==(lhs: Conflict, rhs: Conflict) -> Bool {

                              There are no issues that match your filters.

                              Category
                              Status