Showing 376 of 1,136 total issues
Function move
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
func move(toCorner: InfoCorner, fullRedraw: Bool) {
if let currCorner = currentCorner, !fullRedraw {
// Are we on the same corner ?
if currCorner == toCorner {
// And same height ?
- 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 calculate
has a Cognitive Complexity of 10 (exceeds 5 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)
- 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 calculate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public mutating func calculate() {
strictSunrise = calculate(.sunrise, for: date, and: .strict)
strictSunset = calculate(.sunset, for: date, and: .strict)
sunrise = calculate(.sunrise, for: date, and: .official)
sunset = calculate(.sunset, for: date, and: .official)
- 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 getSubcategoryFor
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
func getSubcategoryFor(_ asset: MacAsset, manifest: MacManifest) -> String {
for category in manifest.categories {
if category.subcategories != nil {
for subcategory in category.subcategories! {
if subcategory.id == asset.subcategories.first {
- 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 mediaRemoteAppStateChange
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
@objc func mediaRemoteAppStateChange(_ aNotification: Notification) {
debugLog("🎧 app state change")
if let userInfo = aNotification.userInfo {
if let rate = userInfo["kMRMediaRemoteNowPlayingApplicationIsPlayingUserInfoKey"] as? Double {
- 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 detectDisplays
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
func detectDisplays() {
// Display detection is done in two passes :
// - Through CGDisplay, we grab all online screens (connected, but
// may or may not be powered on !) and get most information needed
// - Through NSScreen to get the backingScaleFactor (retinaness of a screen)
- 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 menuRemoveVideoClick
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
@IBAction func menuRemoveVideoClick(_ sender: NSMenuItem) {
if let asset = sender.representedObject as? Asset {
let manifestInstance = ManifestLoader.instance
if let cvf = manifestInstance.customVideoFolders {
- 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 setNotifications
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
func setNotifications(_ currentItem: AVPlayerItem) {
let notificationCenter = NotificationCenter.default
notificationCenter.addObserver(self,
selector: #selector(AerialView.playerItemDidReachEnd(_:)),
Function redrawVC
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
func redrawVC() {
splitVC.removeChild(at: 1)
splitVC.removeChild(at: 0)
switch currentStep {
Function resetAllSettings
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
@IBAction func resetAllSettings(_ sender: NSButton) {
if Aerial.helper.showAlert(
question: "Reset all settings?",
text: "This will reset all your settings. After they are reset, Aerial will close System Preferences, you will have to reload it to access settings again.\n\nAre you sure you want to reset your settings?",
button1: "Reset my settings",
Function updateDuration
has 27 lines of code (exceeds 25 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
Function isScreenActive
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
func isScreenActive(id: CGDirectDisplayID) -> Bool {
let screen = findScreenWith(id: id)
debugLog("ISA : \(screen)")
switch PrefsDisplays.displayMode {
Function updateNetworkStatus
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
func updateNetworkStatus() {
if PrefsCache.restrictOnWiFi {
connectedIcon.isHidden = false
connectedLabel.isHidden = false
addCurrentNetworkButton.isHidden = false
Function rotationPopupChange
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
@IBAction func rotationPopupChange(_ sender: NSPopUpButton) {
switch sender.indexOfSelectedItem {
case 0:
mode = "all"
Function showImage
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
func showImage(_ video: AerialVideo) {
heroPlayerView.isHidden = true
heroImageView.isHidden = false
isCachedImageView.isHidden = true
Function setupForVideo
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
override func setupForVideo(video: AerialVideo, player: AVPlayer) {
guard let config = config else {
return
}
Function setDimTimers
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
func setDimTimers() {
if #available(OSX 10.12, *) {
let timeManagement = TimeManagement.sharedInstance
let startValue = min(PrefsDisplays.startDim, Double(brightnessToRestore!))
Function finishedDownload
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
func finishedDownload() {
var tentativeCachePath: String?
if video.source.isCachable {
tentativeCachePath = VideoCache.cachePath(forVideo: video)
Function removeUncachedCruft
has 26 lines of code (exceeds 25 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))
Function getMarginsJSON
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
func getMarginsJSON() -> String {
var adv: AdvancedMargin
if !advancedMargins.displays.isEmpty {
// If we have something already in preferences, return that