IBM-Swift/Kitura

View on GitHub

Showing 850 of 850 total issues

Function update has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            update: function update(query) {
                var that = this, canceled = false, syncCalled = false, rendered = 0;
                this.cancel();
                this.cancel = function cancel() {
                    canceled = true;

    Function testDataIsNotCorrupted has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        func testDataIsNotCorrupted() {
            // Corrupted files will have more bytes or less bytes than required
            // So we check the file is intact after reconstructing it (after various range requests)
            performServerTest(router) { expectation in
                self.performRequest("get", path: "/qwer/index.html", callback: { response in
    Severity: Minor
    Found in Tests/KituraTests/TestStaticFileServer.swift - About 1 hr to fix

      Function update has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  update: function update(query) {
                      var that = this, canceled = false, syncCalled = false, rendered = 0;
                      this.cancel();
                      this.cancel = function cancel() {
                          canceled = true;
      Severity: Minor
      Found in docs/js/typeahead.jquery.js - About 1 hr to fix

        Function performSimpleMatch has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private func performSimpleMatch(path: String, request: RouterRequest, response: RouterResponse, next: @escaping () -> Void) {
                guard let pattern = pattern else {
                    next()
                    return
                }
        Severity: Minor
        Found in Sources/Kitura/RouterElement.swift - About 1 hr to fix

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

              @discardableResult
              public func send(json: [Any]) -> RouterResponse {
                  guard !state.invokedEnd else {
                      Log.warning("RouterResponse send(json:) invoked after end() for \(self.request.urlURL)")
                      return self
          Severity: Major
          Found in Sources/Kitura/RouterResponse.swift and 1 other location - About 1 hr to fix
          Sources/Kitura/RouterResponse.swift on lines 635..651

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

          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

              @discardableResult
              public func send(json: [String: Any]) -> RouterResponse {
                  guard !state.invokedEnd else {
                      Log.warning("RouterResponse send(json:) invoked after end() for \(self.request.urlURL)")
                      return self
          Severity: Major
          Found in Sources/Kitura/RouterResponse.swift and 1 other location - About 1 hr to fix
          Sources/Kitura/RouterResponse.swift on lines 611..627

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

          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

                  init<T: Encodable>(_ test: KituraTest, _ method: String, _ path: String, _ data: T, headers: [String:String]? = nil) {
                      self.test = test
                      self.invoker = { callback in
                          let data = try JSONEncoder().encode(data)
                          test.performRequest(method, path: path, callback: callback, headers: headers, requestModifier: { request in
          Severity: Major
          Found in Tests/KituraTests/KituraTestBuilder.swift and 1 other location - About 1 hr to fix
          Tests/KituraTests/KituraTestBuilder.swift on lines 98..107

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

          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

                  init<T: Encodable>(_ test: KituraTest, _ method: String, _ path: String, _ data: T, headers: [String:String]? = nil, encoder: @escaping () -> BodyEncoder, mediaType: MediaType = .json) {
                      self.test = test
                      self.invoker = { callback in
                          let data = try encoder().encode(data)
                          test.performRequest(method, path: path, callback: callback, headers: headers, requestModifier: { request in
          Severity: Major
          Found in Tests/KituraTests/KituraTestBuilder.swift and 1 other location - About 1 hr to fix
          Tests/KituraTests/KituraTestBuilder.swift on lines 87..96

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

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

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

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

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

          Refactorings

          Further Reading

          Function testConnectionRejectionCustomResponse has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              func testConnectionRejectionCustomResponse() {
                  let numClients = 5  // Number of clients to connect
                  let maxClients = 2  // Maximum number of concurrent clients
          
                  // Create client status objects and expectations
          Severity: Minor
          Found in Tests/KituraTests/TestServerOptions.swift - About 1 hr to fix

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

                    buildServerTest(router, timeout: 30)
                        .request("get", path: "/userMiddleware", headers: ["TestHeader": "Hello"])
                        .hasStatus(.OK)
                        .hasContentType(withPrefix: "application/json")
                        .hasData(user)
            Severity: Major
            Found in Tests/KituraTests/TestTypeSafeMiddleware.swift and 5 other locations - About 1 hr to fix
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 185..195
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 243..253
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 302..312
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 362..372
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 421..431

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

            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 6 locations. Consider refactoring.
            Open

                    buildServerTest(router, timeout: 30)
                        .request("get", path: "/userMiddleware/1", headers: ["TestHeader": "Hello"])
                        .hasStatus(.OK)
                        .hasContentType(withPrefix: "application/json")
                        .hasData(user)
            Severity: Major
            Found in Tests/KituraTests/TestTypeSafeMiddleware.swift and 5 other locations - About 1 hr to fix
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 132..142
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 185..195
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 302..312
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 362..372
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 421..431

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

            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 6 locations. Consider refactoring.
            Open

                    buildServerTest(router, timeout: 30)
                        .request("get", path: "/userMiddleware?id=2", headers: ["TestHeader": "Hello"])
                        .hasStatus(.OK)
                        .hasContentType(withPrefix: "application/json")
                        .hasData(expectedArray)
            Severity: Major
            Found in Tests/KituraTests/TestTypeSafeMiddleware.swift and 5 other locations - About 1 hr to fix
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 132..142
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 185..195
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 243..253
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 302..312
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 362..372

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

            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 6 locations. Consider refactoring.
            Open

                    buildServerTest(router, timeout: 30)
                        .request("get", path: "/userMiddleware", headers: ["TestHeader": "Hello"])
                        .hasStatus(.OK)
                        .hasContentType(withPrefix: "application/json")
                        .hasData(userArray)
            Severity: Major
            Found in Tests/KituraTests/TestTypeSafeMiddleware.swift and 5 other locations - About 1 hr to fix
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 132..142
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 243..253
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 302..312
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 362..372
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 421..431

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

            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 6 locations. Consider refactoring.
            Open

                    buildServerTest(router, timeout: 30)
                        .request("get", path: "/userMiddleware", headers: ["TestHeader": "Hello"])
                        .hasStatus(.OK)
                        .hasContentType(withPrefix: "application/json")
                        .hasData(expectedIntData)
            Severity: Major
            Found in Tests/KituraTests/TestTypeSafeMiddleware.swift and 5 other locations - About 1 hr to fix
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 132..142
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 185..195
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 243..253
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 362..372
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 421..431

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

            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 6 locations. Consider refactoring.
            Open

                    buildServerTest(router, timeout: 30)
                        .request("get", path: "/userMiddleware?id=1", headers: ["TestHeader": "Hello"])
                        .hasStatus(.OK)
                        .hasContentType(withPrefix: "application/json")
                        .hasData(user)
            Severity: Major
            Found in Tests/KituraTests/TestTypeSafeMiddleware.swift and 5 other locations - About 1 hr to fix
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 132..142
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 185..195
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 243..253
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 302..312
            Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 421..431

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

            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

                public init(withCACertificateDirectory caCertificateDirPath: String?, usingCertificateFile certificateFilePath: String?, withKeyFile keyFilePath: String? = nil, usingSelfSignedCerts selfSigned: Bool = true, cipherSuite: String? = nil) {
            
                    config = SSLService.Configuration(withCACertificateDirectory:caCertificateDirPath, usingCertificateFile: certificateFilePath, withKeyFile: keyFilePath, usingSelfSignedCerts: selfSigned, cipherSuite: cipherSuite)
                }
            Severity: Major
            Found in Sources/Kitura/SSLConfig.swift and 1 other location - About 1 hr to fix
            Sources/Kitura/SSLConfig.swift on lines 38..41

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

            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

                    performServerTest(customRouter) { expectation in
                        self.performRequest("get", path: "/sendjson", callback: { response in
                            if let response = response,
                               let responseJson = try? CodableDateAsTimeInterval(response: response) {
                                XCTAssertEqual(responseJson.date, 1519206456)
            Severity: Major
            Found in Tests/KituraTests/TestCustomCoders.swift and 1 other location - About 1 hr to fix
            Tests/KituraTests/TestCustomCoders.swift on lines 130..140

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

            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

                public init(withCACertificateFilePath caCertificateFilePath: String?, usingCertificateFile certificateFilePath: String?, withKeyFile keyFilePath: String? = nil, usingSelfSignedCerts selfSigned: Bool = true, cipherSuite: String? = nil) {
            
                    config = SSLService.Configuration(withCACertificateFilePath: caCertificateFilePath, usingCertificateFile: certificateFilePath, withKeyFile:keyFilePath, usingSelfSignedCerts: selfSigned, cipherSuite: cipherSuite)
                }
            Severity: Major
            Found in Sources/Kitura/SSLConfig.swift and 1 other location - About 1 hr to fix
            Sources/Kitura/SSLConfig.swift on lines 53..56

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

            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

                    performServerTest(customRouter) { expectation in
                        self.performRequest("get", path: "/rawget", callback: { response in
                            if let response = response,
                               let responseJson = try? CodableDateAsTimeInterval(response: response) {
                                XCTAssertEqual(responseJson.date, 1519206456)
            Severity: Major
            Found in Tests/KituraTests/TestCustomCoders.swift and 1 other location - About 1 hr to fix
            Tests/KituraTests/TestCustomCoders.swift on lines 232..242

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

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

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

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

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

            Refactorings

            Further Reading

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

                func testHeaderModifiers() {
            
                    router.get("/headerTest") { _, response, next in
            
                        response.headers.append("Content-Type", value: "text/html")
            Severity: Minor
            Found in Tests/KituraTests/TestResponse.swift - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language