Showing 189 of 674 total issues
Function beacon
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static func beacon(from xyId: String) -> XYIBeaconDefinition? {
let parts = xyId.components(separatedBy: ":")
if parts[safe: 1] == "near" {
guard let uuid = UUID(uuidString: "00000000-0000-0000-0000-000000000000") else { return nil }
- Read upRead up
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 onPipe
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
func onPipe(pipe: XyoNetworkPipe) {
print("On Pipe Called")
delegate?.boundWitness(started: "From an XYO Device")
let handler = XyoNetworkHandler(pipe: pipe)
- Read upRead up
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 startMonitorTimer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public func startMonitorTimer() {
if monitorTimer == nil {
self.monitorTimer = DispatchSource.singleTimer(interval: XYFinderDeviceBase.monitorTimeout, queue: XYFinderDeviceBase.monitorTimerQueue) { [weak self] in
guard let strong = self else { return }
strong.monitorTimer = nil
- Read upRead up
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 urlSession
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didWriteData bytesWritten: Int64, totalBytesWritten: Int64, totalBytesExpectedToWrite: Int64) {
Function urlSession
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didWriteData bytesWritten: Int64, totalBytesWritten: Int64, totalBytesExpectedToWrite: Int64) {
Function retry
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
on queue: DispatchQueue = .promises,
attempts count: Int = __FBLPromiseRetryDefaultAttemptsCount,
delay interval: TimeInterval = __FBLPromiseRetryDefaultDelayInterval,
condition predicate: ((_ count: Int, _ error: Error) -> Bool)? = nil,
_ work: @escaping () throws -> Promise<Value>
Function all
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
on queue: DispatchQueue = .promises,
_ promiseA: Promise<A>,
_ promiseB: Promise<B>,
_ promiseC: Promise<C>,
_ promiseD: Promise<D>
Function notify
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
func notify(for device: XYBluetoothDevice, enabled: Bool) -> Promise<Void> {
var operationPromise = Promise<Void>.pending()
guard let peripheral = device.peripheral, peripheral.state == .connected else {
operationPromise.reject(XYBluetoothError.notConnected)
return operationPromise
- Read upRead up
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 set
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
func set(to device: XYBluetoothDevice, valueObj: XYBluetoothResult, withResponse: Bool = true) -> Promise<Void> {
var operationPromise = Promise<Void>.pending()
guard let peripheral = device.peripheral, peripheral.state == .connected else {
operationPromise.reject(XYBluetoothError.notConnected)
return operationPromise
- Read upRead up
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 display
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
func display(for serviceCharacteristic: XYServiceCharacteristic) -> String? {
switch serviceCharacteristic.characteristicType {
case .string:
guard let strVal = self.asString else { return "n/a" }
return "\(strVal)"
- Read upRead up
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 peripheral
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
func peripheral(_ peripheral: CBPeripheral, didUpdateNotificationStateFor characteristic: CBCharacteristic, error: Error?) {
operationsQueue.async {
guard self.status != .disconnected || self.status != .timedOut else { return }
guard error == nil else {
- Read upRead up
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 display
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
func display(for serviceCharacteristic: XYServiceCharacteristic) -> String? {
switch serviceCharacteristic.characteristicType {
case .string:
guard let strVal = self.asString else { return "n/a" }
return "\(strVal)"
- Read upRead up
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 get
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
func get(from device: XYBluetoothDevice) -> Promise<Data?> {
var operationPromise = Promise<Data?>.pending()
guard let peripheral = device.peripheral, peripheral.state == .connected else {
operationPromise.reject(XYBluetoothError.notConnected)
return operationPromise
- Read upRead up
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 fromSignalStrength
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static func fromSignalStrength(_ strength: Int) -> XYDeviceProximity {
if strength == -999 { return XYDeviceProximity.none }
if strength >= -40 { return XYDeviceProximity.touching }
if strength >= -60 { return XYDeviceProximity.veryNear }
if strength >= -70 { return XYDeviceProximity.near }
- Read upRead up
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 unsubscribe
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static func unsubscribe(to events: [XYFinderEvent], referenceKey: UUID?) {
managerQueue.async {
guard let key = referenceKey else { return }
for event in events {
guard let eventsInRegistry = handlerRegistry[event] else { continue }
- Read upRead up
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 updateStatus
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public func updateStatus() {
#if os(iOS)
var newStatus = XYSmartScanStatus.enabled
let central = XYCentral.instance
if !XYLocation.instance.locationServicesEnabled {
- Read upRead up
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 set
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
func set(to device: XYBluetoothDevice, valueObj: XYBluetoothResult, withResponse: Bool = true) -> Promise<Void> {
var operationPromise = Promise<Void>.pending()
guard let peripheral = device.peripheral, peripheral.state == .connected else {
operationPromise.reject(XYBluetoothError.notConnected)
return operationPromise
- Read upRead up
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 connect
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
@discardableResult func connect(_ timeout: DispatchTimeInterval? = nil) -> Promise<Void> {
guard self.device.peripheral?.state != .connected && self.device.peripheral?.state != .connecting else {
return Promise(())
}
- Read upRead up
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 get
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
func get(from device: XYBluetoothDevice) -> Promise<Data?> {
var operationPromise = Promise<Data?>.pending()
guard let peripheral = device.peripheral, peripheral.state == .connected else {
operationPromise.reject(XYBluetoothError.notConnected)
return operationPromise
- Read upRead up
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 checkExits
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
fileprivate func checkExits() {
XYSmartScan.queue.asyncAfter(deadline: DispatchTime.now() + TimeInterval(XYConstants.DEVICE_TUNING_SECONDS_EXIT_CHECK_INTERVAL)) {
guard self.isCheckingExits else {
return
}
- Read upRead up
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"