IBM-Swift/Kitura

View on GitHub

Showing 850 of 850 total issues

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

    public func get<T: TypeSafeMiddleware, Q: QueryParams, O: Codable>(
        _ route: String,
        handler: @escaping (T, Q, @escaping CodableResultClosure<O>) -> Void
    ) {
        registerGetRoute(route: route, queryParams: Q.self, optionalQParam: false, outputType: O.self)
Severity: Major
Found in Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift and 5 other locations - About 35 mins to fix
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 87..101
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 197..211
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 272..292
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 661..683
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 1491..1509

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

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 get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public func get<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, T3: TypeSafeMiddleware, Q: QueryParams, O: Codable>(
        _ route: String,
        handler: @escaping (T1, T2, T3, Q, @escaping CodableArrayResultClosure<O>) -> Void
    ) {
        registerGetRoute(route: route, queryParams: Q.self, optionalQParam: false, outputType: O.self, outputIsArray: true)
Severity: Minor
Found in Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift - About 35 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

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

    public func get<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, O: Codable>(
        _ route: String,
        handler: @escaping (T1, T2, @escaping CodableArrayResultClosure<O>) -> Void
    ) {
        registerGetRoute(route: route, outputType: O.self, outputIsArray: true)
Severity: Major
Found in Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift and 5 other locations - About 35 mins to fix
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 87..101
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 272..292
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 513..537
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 661..683
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 1491..1509

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

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 get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public func get<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, Q: QueryParams, O: Codable>(
        _ route: String,
        handler: @escaping (T1, T2, Q, @escaping CodableArrayResultClosure<O>) -> Void
    ) {
        registerGetRoute(route: route, queryParams: Q.self, optionalQParam: false, outputType: O.self, outputIsArray: true)
Severity: Minor
Found in Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift - About 35 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 post has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public func post<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, T3: TypeSafeMiddleware, I: Codable, Id: Identifier, O: Codable>(
        _ route: String,
        handler: @escaping (T1, T2, T3, I, @escaping IdentifierCodableResultClosure<Id, O>) -> Void
    ) {
        registerPostRoute(route: route, id: Id.self, inputType: I.self, outputType: O.self)
Severity: Minor
Found in Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift - About 35 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 doPerformServerTest has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    func doPerformServerTest(router: ServerDelegate, options: ServerOptions?, timeout: TimeInterval, line: Int, asyncTasks: [(XCTestExpectation) -> Void]) {

        if self.useUnixSocket {
            guard let socketPath = startUnixSocketServer(router: router, options: options) else {
                return XCTFail("Error starting server. useSSL:\(self.useSSL), useUnixSocket:\(self.useUnixSocket)")
Severity: Minor
Found in Tests/KituraTests/KituraTest.swift - About 35 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

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

    public func post<T: TypeSafeMiddleware, I: Codable, O: Codable>(
        _ route: String,
        handler: @escaping (T, I, @escaping CodableResultClosure<O>) -> Void
    ) {
        registerPostRoute(route: route, inputType: I.self, outputType: O.self)
Severity: Major
Found in Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift and 5 other locations - About 35 mins to fix
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 87..101
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 197..211
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 272..292
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 513..537
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 661..683

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

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 post has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public func post<T: TypeSafeMiddleware, I: Codable, O: Codable>(
        _ route: String,
        handler: @escaping (T, I, @escaping CodableResultClosure<O>) -> Void
    ) {
        registerPostRoute(route: route, inputType: I.self, outputType: O.self)
Severity: Minor
Found in Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift - About 35 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 post has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public func post<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, I: Codable, Id: Identifier, O: Codable>(
        _ route: String,
        handler: @escaping (T1, T2, I, @escaping IdentifierCodableResultClosure<Id, O>) -> Void
    ) {
        registerPostRoute(route: route, id: Id.self, inputType: I.self, outputType: O.self)
Severity: Minor
Found in Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift - About 35 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 post has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public func post<T: TypeSafeMiddleware, I: Codable, Id: Identifier, O: Codable>(
        _ route: String,
        handler: @escaping (T, I, @escaping IdentifierCodableResultClosure<Id, O>) -> Void
    ) {
        registerPostRoute(route: route, id: Id.self, inputType: I.self, outputType: O.self)
Severity: Minor
Found in Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift - About 35 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

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

    public func get<T: TypeSafeMiddleware, Id: Identifier, O: Codable>(
        _ route: String,
        handler: @escaping (T, Id, @escaping CodableResultClosure<O>) -> Void
    ) {
        if !pathSyntaxIsValid(route, identifierExpected: true) {
Severity: Major
Found in Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift and 5 other locations - About 35 mins to fix
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 87..101
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 197..211
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 513..537
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 661..683
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 1491..1509

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

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

    public func request<T: Encodable>(_ method: String, path: String, data: T, headers: [String:String]?) -> AssertionTestBuilder {
        requests.append(Request(test, method, path, data, headers: headers))
        return self
    }
Severity: Major
Found in Tests/KituraTests/KituraTestBuilder.swift and 3 other locations - About 35 mins to fix
Tests/KituraTests/KituraTestBuilder.swift on lines 1..331
Tests/KituraTests/KituraTestBuilder.swift on lines 1..331
Tests/KituraTests/KituraTestBuilder.swift on lines 164..167

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

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

    public func request(_ method: String, path: String, urlEncodedString: String, headers: [String:String]?) -> AssertionTestBuilder {
        requests.append(Request(test, method, path, urlEncodedString, headers: headers))
        return self
    }
Severity: Major
Found in Tests/KituraTests/KituraTestBuilder.swift and 3 other locations - About 35 mins to fix
Tests/KituraTests/KituraTestBuilder.swift on lines 1..331
Tests/KituraTests/KituraTestBuilder.swift on lines 1..331
Tests/KituraTests/KituraTestBuilder.swift on lines 150..153

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

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

    public func get<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, O: Codable>(
        _ route: String,
        handler: @escaping (T1, T2, @escaping CodableResultClosure<O>) -> Void
    ) {
        registerGetRoute(route: route, outputType: O.self)
Severity: Major
Found in Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift and 5 other locations - About 35 mins to fix
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 197..211
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 272..292
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 513..537
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 661..683
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 1491..1509

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

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

    public func get<T: TypeSafeMiddleware, Q: QueryParams, O: Codable>(
        _ route: String,
        handler: @escaping (T, Q, @escaping CodableArrayResultClosure<O>) -> Void
    ) {
        registerGetRoute(route: route, queryParams: Q.self, optionalQParam: false, outputType: O.self, outputIsArray: true)
Severity: Major
Found in Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift and 5 other locations - About 35 mins to fix
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 87..101
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 197..211
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 272..292
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 513..537
Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift on lines 1491..1509

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

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

    func testReturnNilOnInvalidNonDigitsRanges() {
        assertParseError(200, "bytes=xyz", error: .notSatisfiable)
        assertParseError(200, "bytes=xyz-", error: .notSatisfiable)
        assertParseError(200, "bytes=-xyz", error: .notSatisfiable)
    }
Severity: Minor
Found in Tests/KituraTests/TestRangeHeader.swift and 1 other location - About 35 mins to fix
Tests/KituraTests/TestRangeHeader.swift on lines 75..79

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

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

    func testReturnNilOnInvalidRanges() {
        assertParseError(200, "bytes=500-20", error: .notSatisfiable)
        assertParseError(200, "bytes=500-999", error: .notSatisfiable)
        assertParseError(200, "bytes=500-999,1000-1499", error: .notSatisfiable)
    }
Severity: Minor
Found in Tests/KituraTests/TestRangeHeader.swift and 1 other location - About 35 mins to fix
Tests/KituraTests/TestRangeHeader.swift on lines 81..85

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

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("/userMiddleware") { (middleware: UserMiddleware, query: MyQuery, respondWith: (RequestError?) -> Void) in
            print("DELETE on /userMiddleware - received header \(middleware.header)")
            guard self.userStore.removeValue(forKey: query.id) != nil else {
                respondWith(.notFound)
                return
Severity: Minor
Found in Tests/KituraTests/TestTypeSafeMiddleware.swift and 1 other location - About 35 mins to fix
Tests/KituraTests/TestTypeSafeMiddleware.swift on lines 704..711

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

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 static func constructTupleArrayOutResultHandler<Id: Identifier, OutputType: Codable>(successStatus: HTTPStatusCode = .OK, response: RouterResponse, completion: @escaping () -> Void) -> IdentifierCodableArrayResultClosure<Id, OutputType> {
        return { codableOutput, error in
            var status = successStatus
            if let error = error {
                status = httpStatusCode(from: error)
Severity: Minor
Found in Sources/Kitura/CodableRouter.swift and 1 other location - About 35 mins to fix
Sources/Kitura/CodableRouter.swift on lines 893..923

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

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 static func constructIdentOutResultHandler<IdType: Identifier, OutputType: Codable>(successStatus: HTTPStatusCode = .OK, response: RouterResponse, completion: @escaping () -> Void) -> IdentifierCodableResultClosure<IdType, OutputType> {
        return { id, codableOutput, error in
            var status = successStatus
            if let error = error {
                status = httpStatusCode(from: error)
Severity: Minor
Found in Sources/Kitura/CodableRouter.swift and 1 other location - About 35 mins to fix
Sources/Kitura/CodableRouter.swift on lines 835..862

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

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

Severity
Category
Status
Source
Language