IBM-Swift/Kitura

View on GitHub
Tests/KituraTests/TestRouteRegex.swift

Summary

Maintainability
F
1 wk
Test Coverage

File TestRouteRegex.swift has 774 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import Foundation
import XCTest

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

    Function testCustomMatchesWithModifiers has 231 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        func testCustomMatchesWithModifiers() {
            var router = Router()
    
            router.all("/:id(\\d+)?", handler: handler)
    
    
    Severity: Major
    Found in Tests/KituraTests/TestRouteRegex.swift - About 1 day to fix

      Function testSimpleModifiers has 201 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          func testSimpleModifiers() {
              var router = Router()
      
              router.all("/:id?", handler: handler)
      
      
      Severity: Major
      Found in Tests/KituraTests/TestRouteRegex.swift - About 1 day to fix

        Function testCustomMatchesWithModifiers has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
        Open

            func testCustomMatchesWithModifiers() {
                var router = Router()
        
                router.all("/:id(\\d+)?", handler: handler)
        
        
        Severity: Minor
        Found in Tests/KituraTests/TestRouteRegex.swift - About 6 hrs to fix

        Cognitive Complexity

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

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

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

        Further reading

        Function testSimpleModifiers has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
        Open

            func testSimpleModifiers() {
                var router = Router()
        
                router.all("/:id?", handler: handler)
        
        
        Severity: Minor
        Found in Tests/KituraTests/TestRouteRegex.swift - About 6 hrs to fix

        Cognitive Complexity

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

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

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

        Further reading

        Function testSimplePaths has 90 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Function testSimpleMatches has 76 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

            Function testBuildRegexFromPattern has 61 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                func testBuildRegexFromPattern() {
                    var regex: NSRegularExpression?
            
                    var isSimpleString = false
                    var strings: [String]?
            Severity: Major
            Found in Tests/KituraTests/TestRouteRegex.swift - About 2 hrs to fix

              Function testSimpleMatches has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

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

              Cognitive Complexity

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

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

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

              Further reading

              Function testSimplePaths has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  func testSimplePaths() {
                      var router = Router()
              
                      router.all("", handler: handler)
              
              
              Severity: Minor
              Found in Tests/KituraTests/TestRouteRegex.swift - About 1 hr to fix

              Cognitive Complexity

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

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

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

              Further reading

              Function testSimpleCustomMatches has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  func testSimpleCustomMatches() {
                      var router = Router()
              
                      router.all("/:id(\\d+)", handler: handler)
              
              
              Severity: Minor
              Found in Tests/KituraTests/TestRouteRegex.swift - About 1 hr to fix

                Function testSimpleCustomMatches has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    func testSimpleCustomMatches() {
                        var router = Router()
                
                        router.all("/:id(\\d+)", handler: handler)
                
                
                Severity: Minor
                Found in Tests/KituraTests/TestRouteRegex.swift - About 25 mins to fix

                Cognitive Complexity

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

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

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

                Further reading

                Function testRouteWithPercentEncoding has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    func testRouteWithPercentEncoding() {
                        let router = Router()
                        router.get("/say hello", handler: makeHandler(helloworld + " with whitespace"))
                        router.get("/say%20hello", handler: makeHandler(helloworld + " with %20"))
                        router.get("/say+hello", handler: makeHandler(helloworld + " with +"))
                Severity: Minor
                Found in Tests/KituraTests/TestRouteRegex.swift - About 25 mins to fix

                Cognitive Complexity

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

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

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

                Further reading

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

                /**
                 * Copyright IBM Corporation 2016, 2017
                 *
                 * Licensed under the Apache License, Version 2.0 (the "License");
                 * you may not use this file except in compliance with the License.
                Severity: Major
                Found in Tests/KituraTests/TestRouteRegex.swift and 5 other locations - About 2 hrs to fix
                Tests/KituraTests/TestRouteRegex.swift on lines 1..1069
                Tests/KituraTests/TestRouteRegex.swift on lines 1..1069
                Tests/KituraTests/TestRouteRegex.swift on lines 1..1069
                Tests/KituraTests/TestRouteRegex.swift on lines 1..1069
                Tests/KituraTests/TestRouteRegex.swift on lines 1..1069

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

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

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

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

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

                Refactorings

                Further Reading

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

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

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 94.

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

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

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

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

                Refactorings

                Further Reading

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

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

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 91.

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

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

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

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

                Refactorings

                Further Reading

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

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

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 91.

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

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

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

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

                Refactorings

                Further Reading

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

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

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 91.

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

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

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

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

                Refactorings

                Further Reading

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

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

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 91.

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

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

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

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

                Refactorings

                Further Reading

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

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

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 91.

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

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

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

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

                Refactorings

                Further Reading

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

                        XCTAssertEqual(strings![0], "id")
                
                        (regex, isSimpleString, strings) = RouteRegex.sharedInstance.buildRegex(fromPattern: "/test/(Kitura\\d*)", allowPartialMatch: false)
                Severity: Major
                Found in Tests/KituraTests/TestRouteRegex.swift and 3 other locations - About 35 mins to fix
                Tests/KituraTests/TestRouteRegex.swift on lines 108..110
                Tests/KituraTests/TestRouteRegex.swift on lines 116..118
                Tests/KituraTests/TestRouteRegex.swift on lines 124..126

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

                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

                        XCTAssertEqual(strings![0], "id")
                
                        (regex, isSimpleString, strings) = RouteRegex.sharedInstance.buildRegex(fromPattern: "test/:id*", allowPartialMatch: false)
                Severity: Major
                Found in Tests/KituraTests/TestRouteRegex.swift and 3 other locations - About 35 mins to fix
                Tests/KituraTests/TestRouteRegex.swift on lines 116..118
                Tests/KituraTests/TestRouteRegex.swift on lines 124..126
                Tests/KituraTests/TestRouteRegex.swift on lines 132..134

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

                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

                        XCTAssertEqual(strings![0], "id")
                
                        (regex, isSimpleString, strings) = RouteRegex.sharedInstance.buildRegex(fromPattern: "/test/:id(Kitura\\d*)", allowPartialMatch: false)
                Severity: Major
                Found in Tests/KituraTests/TestRouteRegex.swift and 3 other locations - About 35 mins to fix
                Tests/KituraTests/TestRouteRegex.swift on lines 108..110
                Tests/KituraTests/TestRouteRegex.swift on lines 116..118
                Tests/KituraTests/TestRouteRegex.swift on lines 132..134

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

                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

                        XCTAssertEqual(strings![0], "id")
                
                        (regex, isSimpleString, strings) = RouteRegex.sharedInstance.buildRegex(fromPattern: "/test/:id(\\d*)", allowPartialMatch: false)
                Severity: Major
                Found in Tests/KituraTests/TestRouteRegex.swift and 3 other locations - About 35 mins to fix
                Tests/KituraTests/TestRouteRegex.swift on lines 108..110
                Tests/KituraTests/TestRouteRegex.swift on lines 124..126
                Tests/KituraTests/TestRouteRegex.swift on lines 132..134

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

                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

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

                        }, { expectation in

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

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

                        }, { expectation in

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

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

                        }, { expectation in

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

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

                        }, { expectation in

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

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

                        }, { expectation in

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

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

                        }, { expectation in

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

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

                        }, { expectation in

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

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

                        }, { expectation in

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

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

                        }, { expectation in

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

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

                        }, { expectation in

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

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

                        }, { expectation in

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

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

                        }, { expectation in

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

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

                        }, { expectation in

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

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

                        }, { expectation in

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

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

                        }, { expectation in

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

                There are no issues that match your filters.

                Category
                Status