XYOracleNetwork/sdk-xyo-swift

View on GitHub

Showing 189 of 674 total issues

Avoid too many return statements within this function.
Open

        return XYDeviceProximity.outOfRange

    Function promise has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      static func promise<T>(
        _ value: T,
        error: Error? = nil,
        shouldThrow: Bool = false,
        delay: TimeInterval = 0.0

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

        func processValue(for serviceCharacteristic: OtaService, value: XYBluetoothResult) {
            guard
                serviceCharacteristic == .servStatus,
                let data = value.asInteger else { 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

    Function processValue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        func processValue(for serviceCharacteristic: OtaService, value: XYBluetoothResult) {
            guard
                serviceCharacteristic == .servStatus,
                let data = value.asInteger else { 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

    Function pickerView has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
            guard self.currentSelectionIndex != row else { return }
            self.delegate = nil
            self.currentPanelView?.removeFromSuperview()
            if row == 0 {

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

        func wrapper(for button: NSButton, operation: @escaping () -> XYBluetoothResult) {
            guard
                let device = self.device
                else { 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

    Function attachPeripheral has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        override public func attachPeripheral(_ peripheral: XYPeripheral) -> Bool {
            guard let major = self.iBeacon?.major else {
                return false
            }
            
    Severity: Minor
    Found in Source/BleInterface/devices/XyoDifferentiableDevice.swift - About 25 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 retry has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    public func retry<Value>(
      on queue: DispatchQueue = .promises,
      attempts count: Int = __FBLPromiseRetryDefaultAttemptsCount,
      delay interval: TimeInterval = __FBLPromiseRetryDefaultDelayInterval,
      condition predicate: ((_ count: Int, _ error: Error) -> Bool)? = nil,
    Severity: Minor
    Found in Carthage/Checkouts/promises/Sources/Promises/Promise+Retry.swift - About 25 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 attachPeripheral has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        override public func attachPeripheral(_ peripheral: XYPeripheral) -> Bool {
            guard let major = self.iBeacon?.major else {
                return false
            }
            
    Severity: Minor
    Found in Sources/sdk-xyo-swift/BleInterface/devices/XyoDifferentiableDevice.swift - About 25 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

    Severity
    Category
    Status
    Source
    Language