XYOracleNetwork/sdk-ble-flutter

View on GitHub
ios/Classes/protos/gatt.pb.swift

Summary

Maintainability
F
1 wk
Test Coverage

File gatt.pb.swift has 500 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import Foundation
import SwiftProtobuf

// If the compiler emits an error on this type, it is because this file
// was generated by a version of the `protoc` Swift plug-in that is
Severity: Minor
Found in ios/Classes/protos/gatt.pb.swift - About 1 day to fix

    Function decodeMessage has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

      mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
        _ = _uniqueStorage()
        try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
          while let fieldNumber = try decoder.nextFieldNumber() {
            switch fieldNumber {
    Severity: Minor
    Found in ios/Classes/protos/gatt.pb.swift - About 3 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 decodeMessage has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

      mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
        _ = _uniqueStorage()
        try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
          while let fieldNumber = try decoder.nextFieldNumber() {
            switch fieldNumber {
    Severity: Minor
    Found in ios/Classes/protos/gatt.pb.swift - About 3 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 == has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

      static func ==(lhs: GattOperation, rhs: GattOperation) -> Bool {
        if lhs._storage !== rhs._storage {
          let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
            let _storage = _args.0
            let rhs_storage = _args.1
    Severity: Minor
    Found in ios/Classes/protos/gatt.pb.swift - About 2 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 == has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

      static func ==(lhs: GattResponse, rhs: GattResponse) -> Bool {
        if lhs._storage !== rhs._storage {
          let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
            let _storage = _args.0
            let rhs_storage = _args.1
    Severity: Minor
    Found in ios/Classes/protos/gatt.pb.swift - About 2 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 traverse has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
        try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
          if !_storage._deviceID.isEmpty {
            try visitor.visitSingularStringField(value: _storage._deviceID, fieldNumber: 1)
          }
    Severity: Minor
    Found in ios/Classes/protos/gatt.pb.swift - About 55 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 traverse has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
        try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
          if !_storage._deviceID.isEmpty {
            try visitor.visitSingularStringField(value: _storage._deviceID, fieldNumber: 1)
          }
    Severity: Minor
    Found in ios/Classes/protos/gatt.pb.swift - About 55 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

    Avoid too many return statements within this function.
    Open

        if lhs.unknownFields != rhs.unknownFields {return false}
    Severity: Major
    Found in ios/Classes/protos/gatt.pb.swift - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return true
      Severity: Major
      Found in ios/Classes/protos/gatt.pb.swift - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return true
        Severity: Major
        Found in ios/Classes/protos/gatt.pb.swift - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return true
          Severity: Major
          Found in ios/Classes/protos/gatt.pb.swift - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  if !storagesAreEqual {return false}
            Severity: Major
            Found in ios/Classes/protos/gatt.pb.swift - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return true
              Severity: Major
              Found in ios/Classes/protos/gatt.pb.swift - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    if lhs.unknownFields != rhs.unknownFields {return false}
                Severity: Major
                Found in ios/Classes/protos/gatt.pb.swift - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        if !storagesAreEqual {return false}
                  Severity: Major
                  Found in ios/Classes/protos/gatt.pb.swift - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return true
                    Severity: Major
                    Found in ios/Classes/protos/gatt.pb.swift - About 30 mins to fix

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

                        mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
                          _ = _uniqueStorage()
                          try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
                            while let fieldNumber = try decoder.nextFieldNumber() {
                              switch fieldNumber {
                      Severity: Major
                      Found in ios/Classes/protos/gatt.pb.swift and 1 other location - About 5 hrs to fix
                      ios/Classes/protos/gatt.pb.swift on lines 562..587

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

                      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

                        mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
                          _ = _uniqueStorage()
                          try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
                            while let fieldNumber = try decoder.nextFieldNumber() {
                              switch fieldNumber {
                      Severity: Major
                      Found in ios/Classes/protos/gatt.pb.swift and 1 other location - About 5 hrs to fix
                      ios/Classes/protos/gatt.pb.swift on lines 396..421

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

                      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

                      extension GattResponseList: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
                        static let protoMessageName: String = "GattResponseList"
                        static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
                          1: .same(proto: "responses"),
                        ]
                      Severity: Major
                      Found in ios/Classes/protos/gatt.pb.swift and 1 other location - About 4 hrs to fix
                      ios/Classes/protos/bound_witness.pb.swift on lines 58..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 257.

                      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

                        static func ==(lhs: GattOperation, rhs: GattOperation) -> Bool {
                          if lhs._storage !== rhs._storage {
                            let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
                              let _storage = _args.0
                              let rhs_storage = _args.1
                      Severity: Major
                      Found in ios/Classes/protos/gatt.pb.swift and 1 other location - About 3 hrs to fix
                      ios/Classes/protos/gatt.pb.swift on lines 611..626

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

                      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

                        static func ==(lhs: GattResponse, rhs: GattResponse) -> Bool {
                          if lhs._storage !== rhs._storage {
                            let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
                              let _storage = _args.0
                              let rhs_storage = _args.1
                      Severity: Major
                      Found in ios/Classes/protos/gatt.pb.swift and 1 other location - About 3 hrs to fix
                      ios/Classes/protos/gatt.pb.swift on lines 445..460

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

                      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

                        enum OneOf_Operation: Equatable {
                          case definedOperation(DefinedOperation)
                          case gattCall(GattCall)
                      
                        #if !swift(>=4.1)
                      Severity: Major
                      Found in ios/Classes/protos/gatt.pb.swift and 1 other location - About 2 hrs to fix
                      ios/Classes/protos/gatt.pb.swift on lines 251..264

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 152.

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

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

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

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

                      Refactorings

                      Further Reading

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

                        enum OneOf_Operation: Equatable {
                          case definedOperation(DefinedOperation)
                          case gattCall(GattCall)
                      
                        #if !swift(>=4.1)
                      Severity: Major
                      Found in ios/Classes/protos/gatt.pb.swift and 1 other location - About 2 hrs to fix
                      ios/Classes/protos/gatt.pb.swift on lines 162..175

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 152.

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

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

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

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

                      Refactorings

                      Further Reading

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

                        static func ==(lhs: GattOperationList, rhs: GattOperationList) -> Bool {
                          if lhs.deviceID != rhs.deviceID {return false}
                          if lhs.operations != rhs.operations {return false}
                          if lhs.disconnectOnCompletion != rhs.disconnectOnCompletion {return false}
                          if lhs.unknownFields != rhs.unknownFields {return false}
                      Severity: Major
                      Found in ios/Classes/protos/gatt.pb.swift and 1 other location - About 1 hr to fix
                      ios/Classes/protos/device.pb.swift on lines 250..256

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

                      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

                        mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
                          while let fieldNumber = try decoder.nextFieldNumber() {
                            switch fieldNumber {
                            case 1: try decoder.decodeSingularStringField(value: &self.deviceID)
                            case 2: try decoder.decodeRepeatedMessageField(value: &self.operations)
                      Severity: Major
                      Found in ios/Classes/protos/gatt.pb.swift and 1 other location - About 1 hr to fix
                      ios/Classes/protos/device.pb.swift on lines 226..235

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

                      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

                        static func ==(lhs: GattCall, rhs: GattCall) -> Bool {
                          if lhs.serviceUuid != rhs.serviceUuid {return false}
                          if lhs.characteristicUuid != rhs.characteristicUuid {return false}
                          if lhs.unknownFields != rhs.unknownFields {return false}
                          return true
                      Severity: Major
                      Found in ios/Classes/protos/gatt.pb.swift and 1 other location - About 1 hr to fix
                      ios/Classes/protos/device.pb.swift on lines 210..215

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

                      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

                        mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
                          while let fieldNumber = try decoder.nextFieldNumber() {
                            switch fieldNumber {
                            case 1: try decoder.decodeSingularBytesField(value: &self.request)
                            case 2: try decoder.decodeSingularBoolField(value: &self.requiresResponse)
                      Severity: Major
                      Found in ios/Classes/protos/gatt.pb.swift and 2 other locations - About 1 hr to fix
                      ios/Classes/protos/device.pb.swift on lines 190..198
                      ios/Classes/protos/gatt.pb.swift on lines 333..341

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

                      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

                        mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
                          while let fieldNumber = try decoder.nextFieldNumber() {
                            switch fieldNumber {
                            case 1: try decoder.decodeSingularStringField(value: &self.serviceUuid)
                            case 2: try decoder.decodeSingularStringField(value: &self.characteristicUuid)
                      Severity: Major
                      Found in ios/Classes/protos/gatt.pb.swift and 2 other locations - About 1 hr to fix
                      ios/Classes/protos/device.pb.swift on lines 190..198
                      ios/Classes/protos/gatt.pb.swift on lines 470..478

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

                      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

                            switch _storage._operation {
                            case .definedOperation(let v)?:
                              try visitor.visitSingularEnumField(value: v, fieldNumber: 2)
                            case .gattCall(let v)?:
                              try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
                      Severity: Major
                      Found in ios/Classes/protos/gatt.pb.swift and 1 other location - About 1 hr to fix
                      ios/Classes/protos/gatt.pb.swift on lines 428..434

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

                      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

                            switch _storage._operation {
                            case .definedOperation(let v)?:
                              try visitor.visitSingularEnumField(value: v, fieldNumber: 2)
                            case .gattCall(let v)?:
                              try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
                      Severity: Major
                      Found in ios/Classes/protos/gatt.pb.swift and 1 other location - About 1 hr to fix
                      ios/Classes/protos/gatt.pb.swift on lines 594..600

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

                      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

                        static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
                          1: .standard(proto: "device_id"),
                          2: .standard(proto: "defined_operation"),
                          3: .standard(proto: "gatt_call"),
                          4: .standard(proto: "write_request"),
                      Severity: Major
                      Found in ios/Classes/protos/gatt.pb.swift and 1 other location - About 1 hr to fix
                      ios/Classes/protos/gatt.pb.swift on lines 529..535

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

                        static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
                          1: .standard(proto: "device_id"),
                          2: .standard(proto: "defined_operation"),
                          3: .standard(proto: "gatt_call"),
                          4: .same(proto: "response"),
                      Severity: Major
                      Found in ios/Classes/protos/gatt.pb.swift and 1 other location - About 1 hr to fix
                      ios/Classes/protos/gatt.pb.swift on lines 363..369

                      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

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

                        var gattCall: GattCall {
                          get {
                            if case .gattCall(let v)? = _storage._operation {return v}
                            return GattCall()
                          }
                      Severity: Minor
                      Found in ios/Classes/protos/gatt.pb.swift and 1 other location - About 55 mins to fix
                      ios/Classes/protos/gatt.pb.swift on lines 231..237

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

                      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

                        var gattCall: GattCall {
                          get {
                            if case .gattCall(let v)? = _storage._operation {return v}
                            return GattCall()
                          }
                      Severity: Minor
                      Found in ios/Classes/protos/gatt.pb.swift and 1 other location - About 55 mins to fix
                      ios/Classes/protos/gatt.pb.swift on lines 138..144

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

                      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

                        var definedOperation: DefinedOperation {
                          get {
                            if case .definedOperation(let v)? = _storage._operation {return v}
                            return .stayAwake
                          }
                      Severity: Minor
                      Found in ios/Classes/protos/gatt.pb.swift and 1 other location - About 50 mins to fix
                      ios/Classes/protos/gatt.pb.swift on lines 130..136

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

                      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

                        var definedOperation: DefinedOperation {
                          get {
                            if case .definedOperation(let v)? = _storage._operation {return v}
                            return .stayAwake
                          }
                      Severity: Minor
                      Found in ios/Classes/protos/gatt.pb.swift and 1 other location - About 50 mins to fix
                      ios/Classes/protos/gatt.pb.swift on lines 223..229

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

                      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

                        static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
                          1: .standard(proto: "device_id"),
                          2: .same(proto: "operations"),
                          3: .standard(proto: "disconnect_on_completion"),
                        ]
                      Severity: Minor
                      Found in ios/Classes/protos/gatt.pb.swift and 1 other location - About 40 mins to fix
                      ios/Classes/protos/device.pb.swift on lines 220..224

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

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

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

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

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

                      Refactorings

                      Further Reading

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

                        fileprivate mutating func _uniqueStorage() -> _StorageClass {
                          if !isKnownUniquelyReferenced(&_storage) {
                            _storage = _StorageClass(copying: _storage)
                          }
                          return _storage
                      Severity: Minor
                      Found in ios/Classes/protos/gatt.pb.swift and 2 other locations - About 35 mins to fix
                      ios/Classes/protos/device.pb.swift on lines 298..303
                      ios/Classes/protos/gatt.pb.swift on lines 555..560

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

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

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

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

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

                      Refactorings

                      Further Reading

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

                        fileprivate mutating func _uniqueStorage() -> _StorageClass {
                          if !isKnownUniquelyReferenced(&_storage) {
                            _storage = _StorageClass(copying: _storage)
                          }
                          return _storage
                      Severity: Minor
                      Found in ios/Classes/protos/gatt.pb.swift and 2 other locations - About 35 mins to fix
                      ios/Classes/protos/device.pb.swift on lines 298..303
                      ios/Classes/protos/gatt.pb.swift on lines 389..394

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

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

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

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

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

                      Refactorings

                      Further Reading

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

                          init(copying source: _StorageClass) {
                            _deviceID = source._deviceID
                            _operation = source._operation
                            _writeRequest = source._writeRequest
                            _disconnectOnCompletion = source._disconnectOnCompletion
                      Severity: Minor
                      Found in ios/Classes/protos/gatt.pb.swift and 1 other location - About 30 mins to fix
                      ios/Classes/protos/gatt.pb.swift on lines 547..552

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

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

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

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

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

                      Refactorings

                      Further Reading

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

                          init(copying source: _StorageClass) {
                            _deviceID = source._deviceID
                            _operation = source._operation
                            _response = source._response
                            _error = source._error
                      Severity: Minor
                      Found in ios/Classes/protos/gatt.pb.swift and 1 other location - About 30 mins to fix
                      ios/Classes/protos/gatt.pb.swift on lines 381..386

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

                      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

                      There are no issues that match your filters.

                      Category
                      Status