Showing 13 of 51 total issues
Function parse
has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring. Open
internal func parse(line: String) throws -> ContentType? {
var cache = ""
var state = State.Variable
let stack = Stack<State>()
- 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 parse
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
internal func parse(line: String) throws -> ContentType? {
var cache = ""
var state = State.Variable
let stack = Stack<State>()
Function buildMenu
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
func buildMenu(tunnels: Tunnels,
allTunnelDetails: Bool = false,
connectedTunnelDetails: Bool = true,
showInstallInstructions _: Bool = false) -> [NSMenuItem] {
guard !tunnels.isEmpty 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 buildMenu
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
func buildMenu(tunnels: Tunnels,
allTunnelDetails: Bool = false,
connectedTunnelDetails: Bool = true,
showInstallInstructions _: Bool = false) -> [NSMenuItem] {
guard !tunnels.isEmpty else {
Function addPathToQueue
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private func addPathToQueue(_ path: String, notifyingAbout notification: SKQueueNotification) -> SKQueuePath? {
var pathEntry = watchedPaths[path]
if pathEntry != nil {
if pathEntry!.notification.contains(notification) {
Function tunnelNames
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
func tunnelNames() -> [String] {
var tunnelNames = [String]()
// get names of all tunnel configurations
for configPath in configPaths {
- 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 installOrUpdateHelper
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
func installOrUpdateHelper(onFailure: @escaping (String?) -> Void, onSuccess: @escaping () -> Void) {
helperStatus { installed in
if !installed {
// Invalidate the connection to force a reconnect to the newly installed helper
self.xpcHelperConnection?.invalidate()
- 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 deeply nested control flow statements. Open
if var sec = _sections[currentTitle] {
sec[variable] = value
_sections[currentTitle] = sec
} else {
var sec: [String: String] = [:]
Function ev_create
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
func ev_create(ident: UInt, filter: Int16, flags: UInt16, fflags: UInt32, data: Int, udata: UnsafeMutableRawPointer) -> kevent {
Function toStrings
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public func toStrings() -> [SKQueueNotificationString] {
var s = [SKQueueNotificationString]()
if contains(.Rename) { s.append(.Rename) }
if contains(.Write) { s.append(.Write) }
if contains(.Delete) { s.append(.Delete) }
- 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 addPathToQueue
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private func addPathToQueue(_ path: String, notifyingAbout notification: SKQueueNotification) -> SKQueuePath? {
var pathEntry = watchedPaths[path]
if pathEntry != nil {
if pathEntry!.notification.contains(notification) {
- 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 registerWireGuardStateWatch
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
func registerWireGuardStateWatch() {
// register watchers to respond to changes in wireguard config/runtime state
// will trigger: receivedNotification
if queue == nil {
queue = SKQueue(delegate: self)!
- 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 listener
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func listener(_: NSXPCListener, shouldAcceptNewConnection connection: NSXPCConnection) -> Bool {
NSLog("Client connected")
onConnect()
// Set the protocol that the calling application conforms to.
- 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"