Showing 376 of 1,136 total issues
Function getTimeString
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
func getTimeString() -> String {
if #available(OSX 10.12, *) {
// Handle locale
var locale = Locale(identifier: Locale.preferredLanguages[0])
if PrefsAdvanced.ciOverrideLanguage != "" {
- 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 addWindAndHumidity
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
func addWindAndHumidity(x: CGFloat, y: CGFloat) -> CGFloat {
// We need to make sure we have the data, and the options are selected
var addWind = false, addHumidity = false
let wind = condition?.wind
- 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 tableView
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
if tableColumn == tableView.tableColumns[0] {
let cid = NSUserInterfaceItemIdentifier(rawValue: "InfoSourceCellID")
if let cell = tableView.makeView(withIdentifier: cid, owner: self) as? NSTableCellView {
- 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 viewDidLoad
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
override func viewDidLoad() {
super.viewDidLoad()
DispatchQueue.main.async {
self.makeTimeMachineIgnore.state = TimeMachine.isExcluded() ? .on : .off
- 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 calculateAnimationDuration
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
func calculateAnimationDuration(times: [CMTime], current: CMTime, video: AerialVideo) -> Double {
// We may only show for 10s
if PrefsInfo.location.time == .tenSeconds {
return 10
} 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 updateNetworkStatus
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
func updateNetworkStatus() {
if PrefsCache.restrictOnWiFi {
connectedIcon.isHidden = false
connectedLabel.isHidden = false
addCurrentNetworkButton.isHidden = false
- 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 dayNightCheck
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private func dayNightCheck(sunrise: Date, sunset: Date) -> String {
var nsunrise = sunrise
var nsunset = sunset
let now = Date()
// When used with manual mode, sunrise and sunset will always be set to 2000-01-01
- 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 updateRuntimeLabel
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
func updateRuntimeLabel() {
guard let path = self.path else {
videoListRuntimeLabel.stringValue = ""
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 shellScriptTestClick
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
@IBAction func shellScriptTestClick(_ sender: Any) {
PrefsInfo.message.shellScript = shellScript.stringValue
if PrefsInfo.message.shellScript != "" {
if FileManager.default.fileExists(atPath: PrefsInfo.message.shellScript) {
- 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 getClosestAvailable
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private func getClosestAvailable(wanted: VideoFormat) -> URL {
if urls[wanted] != "" && urls[wanted] != nil {
return getURL(string: urls[wanted]!)
} else {
// Fallback
- 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 modeFromPath
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
func modeFromPath(_ path: String) -> FilterMode? {
if path.starts(with: "location") {
return .location
} else if path.starts(with: "cache") {
return .cache
- 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 clearNonCacheableSources
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
static func clearNonCacheableSources() {
// Then we need to look at individual online sources
// let onlineVideos = VideoList.instance.videos.filter({ !$0.source.isCachable })
for source in SourceList.foundSources.filter({!$0.isCachable}) {
- 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 getVideos
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
func getVideos() -> [AerialVideo] {
if isCached() {
do {
let cacheFileUrl = URL(fileURLWithPath: Cache.supportPath.appending("/" + name + "/entries.json"))
let jsondata = try Data(contentsOf: cacheFileUrl)
- 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 getIntermediateAdvancedScreenRect
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
func getIntermediateAdvancedScreenRect() -> CGRect {
// At this point, this is non zeroed
var minX: CGFloat = 0.0, minY: CGFloat = 0.0, maxX: CGFloat = 0.0, maxY: CGFloat = 0.0
for screen in screens {
if screen.zeroedOrigin.x < minX {
- 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 isHEVCMain10HWDecodingAvailable
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
func isHEVCMain10HWDecodingAvailable() -> HEVCMain10Support {
let macModel = getMacModel()
// Apple silicon supports everything!
if isAppleSilicon() {
- 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 day.frame.height > height {
height = day.frame.height
}
Function getTimeString
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
func getTimeString() -> String {
var locale = Locale.current
if PrefsAdvanced.ciOverrideLanguage != "" {
locale = Locale(identifier: PrefsAdvanced.ciOverrideLanguage)
}
- 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 PrefsDisplays.viewingMode == .mirrored && shouldFlip {
image = image?.flipped(flipHorizontally: true, flipVertically: false)
}
Function outlineView
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
func outlineView(_ outlineView: NSOutlineView, viewFor tableColumn: NSTableColumn?, item: Any) -> NSView? {
var view: NSTableCellView?
if let header = item as? Sidebar.Header {
view = outlineView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "HeaderCell"), owner: self) as? NSTableCellView
- 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 willStop
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@objc func willStop(_ aNotification: Notification) {
DisplayDetection.sharedInstance.resetUnusedScreens()
/* if #available(macOS 14.0, *) {
debugLog("🖼️ 📢📢📢 🖼️ 📢📢📢 ☢️sonoma☢️ workaround IGNORING willStop")
- 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"