Showing 189 of 674 total issues
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"
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 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 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 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 enableHeursitics
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
func enableHeursitics(heuristics: [XyoHeuristicEnum], enabled: Bool) {
for heuristic in heuristics {
let heuristicName = heuristic.rawValue + String(describing: self)
if enabled {
switch heuristic {
- 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 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
Avoid too many return
statements within this function. Open
if strength >= -90 { return XYDeviceProximity.far }
Avoid too many return
statements within this function. Open
return
Avoid too many return
statements within this function. Open
if strength >= -80 { return XYDeviceProximity.medium }
Avoid too many return
statements within this function. Open
return
Avoid too many return
statements within this function. Open
guard let byteVal = self.asByteArray else { return "n/a" }
Avoid too many return
statements within this function. Open
return byteVal.hexa
Avoid too many return
statements within this function. Open
return false
Avoid too many return
statements within this function. Open
return nil
Avoid too many return
statements within this function. Open
return
Avoid too many return
statements within this function. Open
return XYIBeaconDefinition(uuid: uuid, major: major, minor: minor)
Avoid too many return
statements within this function. Open
return "\(latNumData), \(lngNumData)"