brightdigit/MistKit

View on GitHub

Showing 1,004 of 1,005 total issues

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

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: MKValue.CodingKeys.self)
    switch self {
    case let .string(string):
      try container.encode(string, forKey: .value)
Severity: Minor
Found in Sources/MistKit/Models/MKValue.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

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

public struct ModifyRecordQueryRequest<RecordType: MKQueryRecord>: MKRequest {
  public typealias Response = ModifiedRecordQueryResponse

  public typealias Data = ModifyRecordQuery<RecordType>

Sources/MistKit/Requests/RecordsLookup/LookupRecordQueryRequest.swift on lines 1..15

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

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 database has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public func database<RequestType, ResponseType, HttpClientType>(
    _ database: MKDatabase<HttpClientType>,
    request: RequestType,
    completedWith result: Result<MKHttpResponse, Error>,
    shouldFailAuth: Bool,
Severity: Minor
Found in Sources/MistKit/Controllers/ResultSink.swift - About 1 hr to fix

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

public protocol ResultSinkProtocol {
  func database<RequestType: MKRequest, ResponseType, HttpClientType: MKHttpClient>(
    _ database: MKDatabase<HttpClientType>,
    request: RequestType,
    completedWith result: Result<MKHttpResponse, Error>,
Severity: Major
Found in Sources/MistKit/Protocols/ResultSinkProtocol.swift and 1 other location - About 1 hr to fix
Sources/MistKit/Controllers/ResultSink.swift on lines 37..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 77.

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

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

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

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

Refactorings

Further Reading

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

  public func database<RequestType, ResponseType, HttpClientType>(
    _ database: MKDatabase<HttpClientType>,
    request: RequestType,
    completedWith result: Result<MKHttpResponse, Error>,
    shouldFailAuth: Bool,
Severity: Major
Found in Sources/MistKit/Controllers/ResultSink.swift and 1 other location - About 1 hr to fix
Sources/MistKit/Protocols/ResultSinkProtocol.swift on lines 1..9

Duplicated Code

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

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

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

Tuning

This issue has a mass of 77.

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

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

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

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

Refactorings

Further Reading

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

  func assetIfExists(fromKey key: String) throws -> MKAsset? {
    switch fields[key] {
    case let .asset(value):
      return value

Severity: Major
Found in Sources/MistKit/Models/MKAnyRecord.swift and 6 other locations - About 1 hr to fix
Sources/MistKit/Models/MKAnyRecord.swift on lines 95..106
Sources/MistKit/Models/MKAnyRecord.swift on lines 108..119
Sources/MistKit/Models/MKAnyRecord.swift on lines 121..132
Sources/MistKit/Models/MKAnyRecord.swift on lines 134..145
Sources/MistKit/Models/MKAnyRecord.swift on lines 147..158
Sources/MistKit/Models/MKAnyRecord.swift on lines 160..171

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

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

  func dateIfExists(fromKey key: String) throws -> Date? {
    switch fields[key] {
    case let .date(value):
      return value

Severity: Major
Found in Sources/MistKit/Models/MKAnyRecord.swift and 6 other locations - About 1 hr to fix
Sources/MistKit/Models/MKAnyRecord.swift on lines 95..106
Sources/MistKit/Models/MKAnyRecord.swift on lines 108..119
Sources/MistKit/Models/MKAnyRecord.swift on lines 121..132
Sources/MistKit/Models/MKAnyRecord.swift on lines 147..158
Sources/MistKit/Models/MKAnyRecord.swift on lines 160..171
Sources/MistKit/Models/MKAnyRecord.swift on lines 173..184

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

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

  func locationIfExists(fromKey key: String) throws -> MKLocation? {
    switch fields[key] {
    case let .location(value):
      return value

Severity: Major
Found in Sources/MistKit/Models/MKAnyRecord.swift and 6 other locations - About 1 hr to fix
Sources/MistKit/Models/MKAnyRecord.swift on lines 95..106
Sources/MistKit/Models/MKAnyRecord.swift on lines 108..119
Sources/MistKit/Models/MKAnyRecord.swift on lines 121..132
Sources/MistKit/Models/MKAnyRecord.swift on lines 134..145
Sources/MistKit/Models/MKAnyRecord.swift on lines 147..158
Sources/MistKit/Models/MKAnyRecord.swift on lines 173..184

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

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

  func dataIfExists(fromKey key: String) throws -> Data? {
    switch fields[key] {
    case let .data(value):
      return value

Severity: Major
Found in Sources/MistKit/Models/MKAnyRecord.swift and 6 other locations - About 1 hr to fix
Sources/MistKit/Models/MKAnyRecord.swift on lines 108..119
Sources/MistKit/Models/MKAnyRecord.swift on lines 121..132
Sources/MistKit/Models/MKAnyRecord.swift on lines 134..145
Sources/MistKit/Models/MKAnyRecord.swift on lines 147..158
Sources/MistKit/Models/MKAnyRecord.swift on lines 160..171
Sources/MistKit/Models/MKAnyRecord.swift on lines 173..184

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

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

  func stringIfExists(fromKey key: String) throws -> String? {
    switch fields[key] {
    case let .string(value):
      return value

Severity: Major
Found in Sources/MistKit/Models/MKAnyRecord.swift and 6 other locations - About 1 hr to fix
Sources/MistKit/Models/MKAnyRecord.swift on lines 95..106
Sources/MistKit/Models/MKAnyRecord.swift on lines 121..132
Sources/MistKit/Models/MKAnyRecord.swift on lines 134..145
Sources/MistKit/Models/MKAnyRecord.swift on lines 147..158
Sources/MistKit/Models/MKAnyRecord.swift on lines 160..171
Sources/MistKit/Models/MKAnyRecord.swift on lines 173..184

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

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

  func integerIfExists(fromKey key: String) throws -> Int64? {
    switch fields[key] {
    case let .integer(value):
      return value

Severity: Major
Found in Sources/MistKit/Models/MKAnyRecord.swift and 6 other locations - About 1 hr to fix
Sources/MistKit/Models/MKAnyRecord.swift on lines 95..106
Sources/MistKit/Models/MKAnyRecord.swift on lines 108..119
Sources/MistKit/Models/MKAnyRecord.swift on lines 134..145
Sources/MistKit/Models/MKAnyRecord.swift on lines 147..158
Sources/MistKit/Models/MKAnyRecord.swift on lines 160..171
Sources/MistKit/Models/MKAnyRecord.swift on lines 173..184

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

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

  func doubleIfExists(fromKey key: String) throws -> Double? {
    switch fields[key] {
    case let .double(value):
      return value

Severity: Major
Found in Sources/MistKit/Models/MKAnyRecord.swift and 6 other locations - About 1 hr to fix
Sources/MistKit/Models/MKAnyRecord.swift on lines 95..106
Sources/MistKit/Models/MKAnyRecord.swift on lines 108..119
Sources/MistKit/Models/MKAnyRecord.swift on lines 121..132
Sources/MistKit/Models/MKAnyRecord.swift on lines 134..145
Sources/MistKit/Models/MKAnyRecord.swift on lines 160..171
Sources/MistKit/Models/MKAnyRecord.swift on lines 173..184

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

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

  func date(fromKey key: String) throws -> Date {
    switch fields[key] {
    case let .date(value):
      return value

Severity: Major
Found in Sources/MistKit/Models/MKAnyRecord.swift and 6 other locations - About 50 mins to fix
Sources/MistKit/Models/MKAnyRecord.swift on lines 25..33
Sources/MistKit/Models/MKAnyRecord.swift on lines 35..43
Sources/MistKit/Models/MKAnyRecord.swift on lines 45..53
Sources/MistKit/Models/MKAnyRecord.swift on lines 65..73
Sources/MistKit/Models/MKAnyRecord.swift on lines 75..83
Sources/MistKit/Models/MKAnyRecord.swift on lines 85..93

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

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

  func integer(fromKey key: String) throws -> Int64 {
    switch fields[key] {
    case let .integer(value):
      return value

Severity: Major
Found in Sources/MistKit/Models/MKAnyRecord.swift and 6 other locations - About 50 mins to fix
Sources/MistKit/Models/MKAnyRecord.swift on lines 25..33
Sources/MistKit/Models/MKAnyRecord.swift on lines 35..43
Sources/MistKit/Models/MKAnyRecord.swift on lines 55..63
Sources/MistKit/Models/MKAnyRecord.swift on lines 65..73
Sources/MistKit/Models/MKAnyRecord.swift on lines 75..83
Sources/MistKit/Models/MKAnyRecord.swift on lines 85..93

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

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

  func double(fromKey key: String) throws -> Double {
    switch fields[key] {
    case let .double(value):
      return value

Severity: Major
Found in Sources/MistKit/Models/MKAnyRecord.swift and 6 other locations - About 50 mins to fix
Sources/MistKit/Models/MKAnyRecord.swift on lines 25..33
Sources/MistKit/Models/MKAnyRecord.swift on lines 35..43
Sources/MistKit/Models/MKAnyRecord.swift on lines 45..53
Sources/MistKit/Models/MKAnyRecord.swift on lines 55..63
Sources/MistKit/Models/MKAnyRecord.swift on lines 75..83
Sources/MistKit/Models/MKAnyRecord.swift on lines 85..93

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

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

  func string(fromKey key: String) throws -> String {
    switch fields[key] {
    case let .string(value):
      return value

Severity: Major
Found in Sources/MistKit/Models/MKAnyRecord.swift and 6 other locations - About 50 mins to fix
Sources/MistKit/Models/MKAnyRecord.swift on lines 25..33
Sources/MistKit/Models/MKAnyRecord.swift on lines 45..53
Sources/MistKit/Models/MKAnyRecord.swift on lines 55..63
Sources/MistKit/Models/MKAnyRecord.swift on lines 65..73
Sources/MistKit/Models/MKAnyRecord.swift on lines 75..83
Sources/MistKit/Models/MKAnyRecord.swift on lines 85..93

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

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

  func location(fromKey key: String) throws -> MKLocation {
    switch fields[key] {
    case let .location(value):
      return value

Severity: Major
Found in Sources/MistKit/Models/MKAnyRecord.swift and 6 other locations - About 50 mins to fix
Sources/MistKit/Models/MKAnyRecord.swift on lines 25..33
Sources/MistKit/Models/MKAnyRecord.swift on lines 35..43
Sources/MistKit/Models/MKAnyRecord.swift on lines 45..53
Sources/MistKit/Models/MKAnyRecord.swift on lines 55..63
Sources/MistKit/Models/MKAnyRecord.swift on lines 65..73
Sources/MistKit/Models/MKAnyRecord.swift on lines 85..93

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

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

  func asset(fromKey key: String) throws -> MKAsset {
    switch fields[key] {
    case let .asset(value):
      return value

Severity: Major
Found in Sources/MistKit/Models/MKAnyRecord.swift and 6 other locations - About 50 mins to fix
Sources/MistKit/Models/MKAnyRecord.swift on lines 25..33
Sources/MistKit/Models/MKAnyRecord.swift on lines 35..43
Sources/MistKit/Models/MKAnyRecord.swift on lines 45..53
Sources/MistKit/Models/MKAnyRecord.swift on lines 55..63
Sources/MistKit/Models/MKAnyRecord.swift on lines 65..73
Sources/MistKit/Models/MKAnyRecord.swift on lines 75..83

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

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

  func data(fromKey key: String) throws -> Data {
    switch fields[key] {
    case let .data(value):
      return value

Severity: Major
Found in Sources/MistKit/Models/MKAnyRecord.swift and 6 other locations - About 50 mins to fix
Sources/MistKit/Models/MKAnyRecord.swift on lines 35..43
Sources/MistKit/Models/MKAnyRecord.swift on lines 45..53
Sources/MistKit/Models/MKAnyRecord.swift on lines 55..63
Sources/MistKit/Models/MKAnyRecord.swift on lines 65..73
Sources/MistKit/Models/MKAnyRecord.swift on lines 75..83
Sources/MistKit/Models/MKAnyRecord.swift on lines 85..93

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

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

import Foundation

public protocol ResultTransformerProtocol {
  func data(
    fromResult result: Result<MKHttpResponse, Error>,
Severity: Minor
Found in Sources/MistKit/Protocols/ResultTransformerProtocol.swift and 1 other location - About 45 mins to fix
Sources/MistKit/Controllers/ResultTransformer.swift on lines 4..18

Duplicated Code

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

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

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

Tuning

This issue has a mass of 56.

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

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

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

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

Refactorings

Further Reading

Severity
Category
Status
Source
Language