Showing 376 of 1,136 total issues
Function downloadManifestsIfNeeded
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private func downloadManifestsIfNeeded() {
let downloadManager = DownloadManager()
var sourceQueue: [Source] = []
- 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 removeUncachedCruft
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
static func removeUncachedCruft() {
for source in SourceList.foundSources where !source.isCachable && source.type != .local {
debugLog("Checking cruft in \(source.name)")
let pathURL = URL(fileURLWithPath: supportPath.appending("/" + source.name))
- 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 outlineView
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
func outlineView(_ outlineView: NSOutlineView, acceptDrop info: NSDraggingInfo, item: Any?, childIndex index: Int) -> Bool {
if let items = info.draggingPasteboard.pasteboardItems {
for item in items {
if #available(OSX 10.13, *) {
- 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 testLocationButtonClick
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
@IBAction func testLocationButtonClick(_ sender: NSButton) {
// Clear out weather from existing location
let cachedWeatherURL = URL(fileURLWithPath: Cache.supportPath, isDirectory: true).appendingPathComponent("Weather.json")
let cachedWeatherForecastURL = URL(fileURLWithPath: Cache.supportPath, isDirectory: true).appendingPathComponent("Forecast.json")
let fm = FileManager.default
Function calculate
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
fileprivate func calculate(_ sunriseSunset: SunriseSunset, for date: Date, and zenith: Zenith) -> Date? {
guard let utcTimezone = TimeZone(identifier: "UTC") else { return nil }
// Get the day of the year
var calendar = Calendar(identifier: .gregorian)
File TimeManagement.swift
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Foundation
import Cocoa
import CoreLocation
import IOKit.ps
Function shouldRestrictPlaybackToDayNightVideo
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
func shouldRestrictPlaybackToDayNightVideo() -> (Bool, String) {
debugLog("PrefsTime : \(PrefsTime.timeMode)")
// We override everything on dark mode if we need to
if PrefsTime.darkModeNightOverride && DarkMode.isEnabled() {
debugLog("Dark Mode override")
Function generate
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
static func generate(forVideo video: AerialVideo) {
do {
var asset: AVURLAsset
if video.isAvailableOffline {
// If a video is already cached, we may still need to use an online fetch as there's a bug
Function getTimeString
has a Cognitive Complexity of 15 (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 getCoordinates
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
func getCoordinates(failure: @escaping (_ error: String) -> Void,
success: @escaping (_ response: CLLocationCoordinate2D) -> Void) {
// Sonoma workaround via CompanionBridge
if !Aerial.helper.underCompanion {
if #available(macOS 14.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 updateDuration
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
func updateDuration() {
// We need to retrieve video duration from the cached files.
// This is a workaround as currently, the VideoCache infrastructure
// relies on AVAsset with an external URL all the time, even when
// working on a cached copy which makes the native duration retrieval fail
- 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 fetchOnlineManifest
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
static func fetchOnlineManifest(url: URL) {
if let source = loadManifest(url: url) {
debugLog("Source loaded")
// Then save !
let downloadManager = DownloadManager()
- 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 drawInfoPanel
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
func drawInfoPanel(forType: InfoType) {
resetInfoPanel()
// Add the common block of features (enabled, font, position, screen)
infoScrollableView.addSubview(infoCommonView)
Function processPathForVideos
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
func processPathForVideos(url: URL) {
debugLog("processing url for videos : \(url) ")
let folderName = url.lastPathComponent
// let manifestInstance = ManifestLoader.instance
Function setupForVideo
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
override func setupForVideo(video: AerialVideo, player: AVPlayer) {
let poiStringProvider = PoiStringProvider.sharedInstance
// We need to make sure we actually have descriptions to show.
// Custom videos, and earlier tvOS videos may not
if poiStringProvider.hasPoiKeys(video: video) {
Function windowDidLoad
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
override func windowDidLoad() {
// debugLog("PWC2 wdl: Aerial version \(Aerial.version)")
super.windowDidLoad()
currentPath = "location:all"
Function processPathForVideos
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
static func processPathForVideos(url: URL) {
debugLog("processing url for videos : \(url) ")
let folderName = url.lastPathComponent
do {
Function getInformation
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
static func getInformation() -> (Bool, sunrise: Date?, sunset: Date?, error: String?) {
// Sonoma workaround
if !Aerial.helper.underCompanion {
if #available(macOS 14.0, *) {
if CompanionBridge.nightShiftSunrise != nil {
Function outlineView
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
func outlineView(_ outlineView: NSOutlineView, shouldSelectItem item: Any) -> Bool {
debugLog("selected \(item)")
if let source = item as? Source {
topPathControl.isHidden = false
Function viewDidLoad
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
override func viewDidLoad() {
super.viewDidLoad()
setupDarkMode()
DispatchQueue.main.async {