XYOracleNetwork/sdk-xyo-swift

View on GitHub

Showing 189 of 674 total issues

File XYFirmwareUpdateManager.swift has 396 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import Foundation

public struct XYFirmwareUpdateParameters {
    let
    spiMISOAddress: Int32,

    File XYFirmwareUpdateManager.swift has 396 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import Foundation
    
    public struct XYFirmwareUpdateParameters {
        let
        spiMISOAddress: Int32,

      File GattRequest.swift has 346 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import Foundation
      import CoreBluetooth
      import Promises
      
      public enum GattRequestStatus: String {
      Severity: Minor
      Found in Carthage/Checkouts/sdk-ble-swift/Source/Gatt/GattRequest.swift - About 4 hrs to fix

        File GattRequest.swift has 346 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import Foundation
        import CoreBluetooth
        import Promises
        
        public enum GattRequestStatus: String {

          Function wait has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

              func wait(for device: XYBluetoothDevice) {
                  // Quick escape if we already have the device and it is connected or it's already connecting
                  guard !isConnectedOrConnecting(for: device) else { return }
          
                  // We have lost contact with the device, so we'll do a non-expiring connectiong try

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

              func wait(for device: XYBluetoothDevice) {
                  // Quick escape if we already have the device and it is connected or it's already connecting
                  guard !isConnectedOrConnecting(for: device) else { return }
          
                  // We have lost contact with the device, so we'll do a non-expiring connectiong try

          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

          File Promise+AllTests.swift has 331 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import PromisesTestHelpers
          import XCTest
          @testable import Promises
          
          class PromiseAllTests: XCTestCase {

            Function doStep has 90 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                func doStep() {
                    switch self.currentStep {
                    case .unstarted:
                        break
                    case .setMemoryType:

              Function doStep has 90 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  func doStep() {
                      switch self.currentStep {
                      case .unstarted:
                          break
                      case .setMemoryType:

                Function update has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                    public func update(_ success: @escaping () -> Void, failure: @escaping (_ error: XYBluetoothError) -> Void) {
                        self.success = success
                        self.failure = failure
                
                        // Watch for various events to properly handle the OTA

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

                    public func update(_ success: @escaping () -> Void, failure: @escaping (_ error: XYBluetoothError) -> Void) {
                        self.success = success
                        self.failure = failure
                
                        // Watch for various events to properly handle the OTA

                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

                File Promise+AnyTests.swift has 308 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import PromisesTestHelpers
                import XCTest
                @testable import Promises
                
                class PromiseAnyTests: XCTestCase {

                  NativeSecp256k1 has 25 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  public class NativeSecp256k1 {
                  
                      private static final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock();
                      private static final Lock r = rwl.readLock();
                      private static final Lock w = rwl.writeLock();

                    Function doStep has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                    Open

                        func doStep() {
                            switch self.currentStep {
                            case .unstarted:
                                break
                            case .setMemoryType:

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

                        func doStep() {
                            switch self.currentStep {
                            case .unstarted:
                                break
                            case .setMemoryType:

                    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

                    File XYSmartScan.swift has 277 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import Foundation
                    import CoreBluetooth
                    
                    public protocol XYSmartScanDelegate {
                      func smartScan(status: XYSmartScanStatus)
                    Severity: Minor
                    Found in Carthage/Checkouts/sdk-ble-swift/Source/XYSmartScan.swift - About 2 hrs to fix

                      File XYSmartScan.swift has 277 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import Foundation
                      import CoreBluetooth
                      
                      public protocol XYSmartScanDelegate {
                        func smartScan(status: XYSmartScanStatus)
                      Severity: Minor
                      Found in Carthage/Checkouts/sdk-ble-swift/Sources/XyBleSdk/XYSmartScan.swift - About 2 hrs to fix

                        File Promise+WrapTests.swift has 275 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import PromisesTestHelpers
                        import XCTest
                        @testable import Promises
                        
                        class PromiseResolveTests: XCTestCase {

                          Function connect has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                          Open

                              func connect(to device: XYBluetoothDevice) {
                                  let deviceId = device.id
                          
                                  print("STEP 1: Trying to connect to \(deviceId.shortId)...")
                          
                          

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

                              public func doBoundWitness (transfer: XyoIterableStructure?, completion : @escaping (_: XyoError?)->()?) {
                                  do {
                                      if (cycles >= XyoZigZagBoundWitnessSession.maxNumberOfCycles) {
                                          completion(XyoError.UNKNOWN_ERROR)
                                          return

                          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