XYOracleNetwork/sdk-ble-flutter

View on GitHub

Showing 312 of 312 total issues

Range has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

  public  static final class Range extends
      com.google.protobuf.GeneratedMessageLite<
          Range, Range.Builder> implements
      // @@protoc_insertion_point(message_implements:Range)
      RangeOrBuilder {

    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

    Consider simplifying this complex logical expression.
    Open

                if device.id == "xy:ibeacon:d684352e-df36-484e-bc98-2d5398c5593e.54849.44291" ||
                    device.id == "xy:ibeacon:d684352e-df36-484e-bc98-2d5398c5593e.51201.59139" ||
                    device.id == "xy:ibeacon:d684352e-df36-484e-bc98-2d5398c5593e.34177.48642" ||
                    device.id == "xy:ibeacon:d684352e-df36-484e-bc98-2d5398c5593e.29889.48387" ||
                    device.id == "xy:ibeacon:d684352e-df36-484e-bc98-2d5398c5593e.34753.17667"  ||
    Severity: Critical
    Found in ios/Classes/AddDeviceManager.swift - About 2 hrs to fix

      Method process has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              // Run the operations
              @kotlin.ExperimentalUnsignedTypes
              suspend fun process(device: XYBluetoothDevice, operation: Gatt.DefinedOperation): XYBluetoothResult<Any>? {
                      val finder = device as? XYFinderBluetoothDevice
                      val sentinelX = device as? XyoSentinelX

        Function traverse has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

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

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

        struct RssiResolver: XyoHumanHeuristicResolver {
            func getHumanKey(partyIndex: Int) -> String {
                return String(format: NSLocalizedString("RSSI %d", comment: "rssi value"), partyIndex)
            }
        
        
        Severity: Major
        Found in ios/Classes/XyoHumanHeuristics.swift and 1 other location - About 2 hrs to fix
        ios/Classes/XyoHumanHeuristics.swift on lines 85..101

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

        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

        struct IndexResolver: XyoHumanHeuristicResolver {
          func getHumanKey(partyIndex: Int) -> String {
            return String(format: NSLocalizedString("Index %d", comment: "index value"), partyIndex)
          }
          
        Severity: Major
        Found in ios/Classes/XyoHumanHeuristics.swift and 1 other location - About 2 hrs to fix
        ios/Classes/XyoHumanHeuristics.swift on lines 67..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 142.

        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 == 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

        Method getHumanBoundWitnessName has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring.
        Open

            // todo find way to localise strings with flutter
            fun getHumanBoundWitnessName(boundWitness: XyoBoundWitness, publicKey: ByteArray?): String {
                if (boundWitness.numberOfParties == 1) {
                    if (getIndexForParty(boundWitness, 0) == 0) {
                        return "First block!"

        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

        Method dynamicMethod has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @java.lang.Override
            @java.lang.SuppressWarnings({"unchecked", "fallthrough"})
            protected final java.lang.Object dynamicMethod(
                com.google.protobuf.GeneratedMessageLite.MethodToInvoke method,
                java.lang.Object arg0, java.lang.Object arg1) {

          Method dynamicMethod has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              @java.lang.Override
              @java.lang.SuppressWarnings({"unchecked", "fallthrough"})
              protected final java.lang.Object dynamicMethod(
                  com.google.protobuf.GeneratedMessageLite.MethodToInvoke method,
                  java.lang.Object arg0, java.lang.Object arg1) {

            Method dynamicMethod has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @java.lang.Override
                @java.lang.SuppressWarnings({"unchecked", "fallthrough"})
                protected final java.lang.Object dynamicMethod(
                    com.google.protobuf.GeneratedMessageLite.MethodToInvoke method,
                    java.lang.Object arg0, java.lang.Object arg1) {

              Method dynamicMethod has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  @java.lang.Override
                  @java.lang.SuppressWarnings({"unchecked", "fallthrough"})
                  protected final java.lang.Object dynamicMethod(
                      com.google.protobuf.GeneratedMessageLite.MethodToInvoke method,
                      java.lang.Object arg0, java.lang.Object arg1) {

                Method dynamicMethod has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    @java.lang.Override
                    @java.lang.SuppressWarnings({"unchecked", "fallthrough"})
                    protected final java.lang.Object dynamicMethod(
                        com.google.protobuf.GeneratedMessageLite.MethodToInvoke method,
                        java.lang.Object arg0, java.lang.Object arg1) {

                  Method dynamicMethod has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      @java.lang.Override
                      @java.lang.SuppressWarnings({"unchecked", "fallthrough"})
                      protected final java.lang.Object dynamicMethod(
                          com.google.protobuf.GeneratedMessageLite.MethodToInvoke method,
                          java.lang.Object arg0, java.lang.Object arg1) {

                    Method dynamicMethod has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        @java.lang.Override
                        @java.lang.SuppressWarnings({"unchecked", "fallthrough"})
                        protected final java.lang.Object dynamicMethod(
                            com.google.protobuf.GeneratedMessageLite.MethodToInvoke method,
                            java.lang.Object arg0, java.lang.Object arg1) {

                      Method dynamicMethod has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          @java.lang.Override
                          @java.lang.SuppressWarnings({"unchecked", "fallthrough"})
                          protected final java.lang.Object dynamicMethod(
                              com.google.protobuf.GeneratedMessageLite.MethodToInvoke method,
                              java.lang.Object arg0, java.lang.Object arg1) {

                        Method process has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring.
                        Open

                                // Run the operations
                                @kotlin.ExperimentalUnsignedTypes
                                suspend fun process(device: XYBluetoothDevice, operation: Gatt.DefinedOperation): XYBluetoothResult<Any>? {
                                        val finder = device as? XYFinderBluetoothDevice
                                        val sentinelX = device as? XyoSentinelX

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language