Showing 1,136 of 1,136 total issues
File AerialView.swift
has 717 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Foundation
import ScreenSaver
import AVFoundation
import AVKit
File PrefsInfo.swift
has 588 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Foundation
import ScreenSaver
protocol CommonInfo {
var isEnabled: Bool { get set }
File VideosViewController.swift
has 551 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Cocoa
import AVKit
// swiftlint:disable:next type_body_length
class VideosViewController: NSViewController {
File Cache.swift
has 519 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Cocoa
import CoreWLAN
import AVKit
/**
File ManifestLoader.swift
has 495 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Foundation
import ScreenSaver
import GameplayKit
import AVFoundation
Function draw
has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring. Open
override func draw(_ dirtyRect: NSRect) {
super.draw(dirtyRect)
// We need to handle dark mode
var backgroundColor = NSColor.init(white: 0.9, alpha: 1.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
File Source.swift
has 477 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Foundation
// 10 has a different format
// 11 is similar to 12+, but does not include pointsOfInterests
// 12/13 share a same format, and we use that format for local videos too
Function setup
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
func setup() {
// Disable HDR only on macOS Ventura
if !Aerial.helper.canHDR() {
if isPreview && (PrefsVideos.videoFormat == .v4KHDR || PrefsVideos.videoFormat == .v1080pHDR) {
// This will lead to crashing in up to Ventura beta5 so disable
- 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
File CustomVideoController.swift
has 438 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Foundation
import AppKit
import AVKit
class CustomVideoController: NSWindowController, NSWindowDelegate, NSDraggingDestination {
File VideoList.swift
has 436 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Foundation
typealias VideoListRefreshCallback = () -> Void
extension RangeReplaceableCollection {
/// Returns a collection containing, in order, the first instances of
Function getTrimmedRect
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
private func getTrimmedRect() -> CGRect {
let bmp = self.representations[0] as! NSBitmapImageRep
let data: UnsafeMutablePointer<UInt8> = bmp.bitmapData!
var alpha: UInt8
- 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 freeCache
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
static func freeCache() {
guard PrefsCache.enableManagement 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
File SourceList.swift
has 379 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Foundation
struct SourceHeader {
let name: String
let sources: [Source]
Function mediaRemoteCallback
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
@objc func mediaRemoteCallback(_ aNotification: Notification?) {
var album = ""
var name = ""
var artist = ""
var artwork: NSImage?
- 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
File ForecastLayer.swift
has 378 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Foundation
import AVKit
// swiftlint:disable:next type_body_length
class ForecastLayer: CALayer {
File DisplayDetection.swift
has 376 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Foundation
import Cocoa
class Screen: NSObject {
var id: CGDirectDisplayID
Function iconFor
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
static func iconFor(_ path: String, name: String) -> NSImage? {
if path.starts(with: "videos:location") {
return Aerial.helper.getAccentedSymbol("mappin.and.ellipse")
} else if path.starts(with: "videos:cache") && name == VideoList.instance.cacheDownloaded {
return Aerial.helper.getAccentedSymbol("internaldrive")
- 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 a Cognitive Complexity of 32 (exceeds 5 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
- 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 draw
has 116 lines of code (exceeds 25 allowed). Consider refactoring. Open
override func draw(_ dirtyRect: NSRect) {
super.draw(dirtyRect)
// We need to handle dark mode
var backgroundColor = NSColor.init(white: 0.9, alpha: 1.0)
Function setup
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
func setup() {
// Disable HDR only on macOS Ventura
if !Aerial.helper.canHDR() {
if isPreview && (PrefsVideos.videoFormat == .v4KHDR || PrefsVideos.videoFormat == .v1080pHDR) {
// This will lead to crashing in up to Ventura beta5 so disable