Showing 189 of 674 total issues
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
- 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 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)...")
- 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
File NativeSecp256k1.java
has 266 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright 2013 Google Inc.
* Copyright 2014-2016 the libsecp256k1 contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
Function smartScan
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
func smartScan(detected device: XYBluetoothDevice, rssi: Int, family: XYDeviceFamily) {
if (self.autoBoundWitness && self.semaphore) {
if let xyoDevice = device as? XyoBluetoothDevice {
if (Int(Date().timeIntervalSince(self.lastBoundWitnessTime)) > self.pollingInterval) {
- 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 smartScan
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
func smartScan(detected device: XYBluetoothDevice, rssi: Int, family: XYDeviceFamily) {
if (self.autoBoundWitness && self.semaphore) {
if let xyoDevice = device as? XyoBluetoothDevice {
if (Int(Date().timeIntervalSince(self.lastBoundWitnessTime)) > self.pollingInterval) {
- 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 update
has 44 lines of code (exceeds 25 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
Function update
has 44 lines of code (exceeds 25 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
Function inquire
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
@discardableResult public func inquire(for device: XYBluetoothDevice) -> Promise<GattDeviceDescriptor> {
let operationPromise = Promise<GattDeviceDescriptor>.pending()
guard
let peripheral = device.peripheral,
peripheral.state == .connected else {
Function inquire
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
@discardableResult public func inquire(for device: XYBluetoothDevice) -> Promise<GattDeviceDescriptor> {
let operationPromise = Promise<GattDeviceDescriptor>.pending()
guard
let peripheral = device.peripheral,
peripheral.state == .connected else {
Function connect
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
func connect(to device: XYBluetoothDevice) {
let deviceId = device.id
print("STEP 1: Trying to connect to \(deviceId.shortId)...")
Function connect
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
func connect(to device: XYBluetoothDevice) {
let deviceId = device.id
print("STEP 1: Trying to connect to \(deviceId.shortId)...")
Function doBoundWitnessWithPipe
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private func doBoundWitnessWithPipe (startingData : XyoIterableStructure?, handler : XyoNetworkHandler, choice : [UInt8], completion: @escaping (_: XyoBoundWitness?, _: XyoError?)->()) {
do {
let options = getBoundWitnessesOptionsForFlag(flag: choice)
let additional = try getAdditionalPayloads(flag: choice, pipe: handler.pipe)
Function doBoundWitnessWithPipe
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private func doBoundWitnessWithPipe (startingData : XyoIterableStructure?, handler : XyoNetworkHandler, choice : [UInt8], completion: @escaping (_: XyoBoundWitness?, _: XyoError?)->()) {
do {
let options = getBoundWitnessesOptionsForFlag(flag: choice)
let additional = try getAdditionalPayloads(flag: choice, pipe: handler.pipe)
Function doBoundWitnessWithPipe
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private func doBoundWitnessWithPipe (startingData : XyoIterableStructure?, handler : XyoNetworkHandler, choice : [UInt8], completion: @escaping (_: XyoBoundWitness?, _: XyoError?)->()) {
do {
let options = getBoundWitnessesOptionsForFlag(flag: choice)
let additional = try getAdditionalPayloads(flag: choice, pipe: handler.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 doBoundWitnessWithPipe
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private func doBoundWitnessWithPipe (startingData : XyoIterableStructure?, handler : XyoNetworkHandler, choice : [UInt8], completion: @escaping (_: XyoBoundWitness?, _: XyoError?)->()) {
do {
let options = getBoundWitnessesOptionsForFlag(flag: choice)
let additional = try getAdditionalPayloads(flag: choice, pipe: handler.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 wait
has 39 lines of code (exceeds 25 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
Function handleResponse
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
@discardableResult func handleResponse(for responseValue: Int) -> String {
var message: String
guard let errorEnum = XYFirmwareStatusValues(rawValue: responseValue) else {
return "Unhandled status code \(responseValue)"
Function build
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public func build() throws -> XyoNode {
if (XyoSdk.nodes.count > 0) {
throw XyoNodeBuilderError(kind: .alreadyNodes)
}
if (self.storage == nil) {
Function testPromiseAllHeterogeneous4
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
func testPromiseAllHeterogeneous4() {
// Arrange.
let expectedValues = (42, "hello world", Int?.none, 2.4)
let promise1 = Promise<Int> { fulfill, _ in
Test.delay(0.1) {
Function handleResponse
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
@discardableResult func handleResponse(for responseValue: Int) -> String {
var message: String
guard let errorEnum = XYFirmwareStatusValues(rawValue: responseValue) else {
return "Unhandled status code \(responseValue)"