XYOracleNetwork/sdk-ble-flutter

View on GitHub

Showing 226 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 {

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

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

      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 {

        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

            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

                            Method dynamicMethod has 43 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 43 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) {
                                Severity
                                Category
                                Status
                                Source
                                Language