Showing 70 of 607 total issues
Avoid too many return
statements within this function. Open
return packet
Avoid too many return
statements within this function. Open
return nil
Function addAndScan
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
open func addAndScan(_ data: Data) -> (Data?, Data)? {
guard finished == false 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 matchDNS
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
override open func matchDNS(_ session: DNSSession, type: DNSSessionMatchType) -> DNSSessionMatchResult {
guard type == .ip else {
return .unknown
}
- 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 didRead
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public func didRead(data: Data, from socket: SocketProtocol) {
if let socket = socket as? ProxySocket {
observer?.signal(.proxySocketReadData(data, from: socket, on: self))
guard !isCancelled 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 _quotientAndRemainderFullWidth
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
internal func _quotientAndRemainderFullWidth(dividingBy dividend: (high: UInt128, low: UInt128)) -> (quotient: UInt128, remainder: UInt128) {
let divisor = self
let numeratorBitsToWalk: UInt128
if dividend.high > 0 {
- 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 spec
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
override func spec() {
let testCases: [(String, Bool, String?, String?, Int?, String)] = [
("http://google.com/ncr", true, "http", "google.com", nil, "ncr"),
("http://google.com/", true, "http", "google.com", nil, ""),
("http://google.com:8080/", true, "http", "google.com", 8080, ""),
- 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
open func update(_ data: inout Data) {
guard data.count > 0 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 parseAdapterFactoryManager
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static func parseAdapterFactoryManager(_ config: Yaml) throws -> AdapterFactoryManager {
var factoryDict: [String: AdapterFactory] = [:]
factoryDict["direct"] = DirectAdapterFactory()
guard let adapterConfigs = config.array else {
throw ConfigurationParserError.noAdapterDefined
- 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 didWrite
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public func didWrite(data: Data?, by socket: SocketProtocol) {
if let socket = socket as? ProxySocket {
observer?.signal(.proxySocketWroteData(data, by: socket, on: self))
guard !isCancelled 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"