Showing 376 of 1,136 total issues
Function loadCachedManifests
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
func loadCachedManifests() {
if let cacheDirectory = VideoCache.appSupportDirectory {
// tvOS13
var cacheFileUrl = URL(fileURLWithPath: cacheDirectory as String)
cacheFileUrl.appendPathComponent("tvos13.json")
Function addWindAndHumidity
has 38 lines of code (exceeds 25 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
Function parseOldVideoManifest
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
func parseOldVideoManifest(_ data: Data) -> [AerialVideo] {
do {
let oldVideoManifest = try newJSONDecoder().decode(OldVideoManifest.self, from: data)
var processedVideos: [AerialVideo] = []
Function loadManifestsFromLoadedFiles
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
func loadManifestsFromLoadedFiles() {
// Reset our array
processedVideos = []
if manifestTvOS13 != nil {
Function updateVideoView
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
func updateVideoView() {
if let video = getSelectedVideo() {
debugLog("\"\(video.id)\": \"sunrise\", // \(video.name) - \(video.secondaryName)")
debugLog("\"\(video.id)\": \"sunset\", // \(video.name) - \(video.secondaryName)")
debugLog("\"\(video.id)\": \"night\", // \(video.name) - \(video.secondaryName)")
Function viewDidLoad
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
override func viewDidLoad() {
super.viewDidLoad()
DispatchQueue.main.async {
self.scrollView.contentView.scroll(NSMakePoint(0,0))
Function tableView
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
guard let path = path else {
return nil
}
Function downloadManifestsIfNeeded
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private func downloadManifestsIfNeeded() {
let downloadManager = DownloadManager()
var sourceQueue: [Source] = []
Function getTimeSlice
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public func getTimeSlice() -> String {
guard
let _ = sunrise,
let _ = sunset
else {
Function mediaRemoteCallback
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
@objc func mediaRemoteCallback(_ aNotification: Notification?) {
var album = ""
var name = ""
var artist = ""
var artwork: NSImage?
Function updateStatusBar
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
func updateStatusBar() {
if PrefsCache.enableManagement {
// We are in managed mode
if PrefsCache.cacheLimit >= 101 {
statusDriveImageView.image = Aerial.helper.getAccentedSymbol("externaldrive.badge.checkmark")
- 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 loadBundle
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private func loadBundle() {
// Idle string bundle
var bundlePath = Cache.supportPath.appending("/macOS 14")
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 setNotifications
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
static func setNotifications() {
debugLog("🌉 seting up CompanionBridge")
// Get nightshift
DistributedNotificationCenter.default().addObserver(forName: NSNotification.Name("com.glouel.aerial.nightshift"), object: nil, queue: nil) { notification in
- 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 getTimeSlice
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public func getTimeSlice() -> String {
guard
let _ = sunrise,
let _ = sunset
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 loadManifestsFromLoadedFiles
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
func loadManifestsFromLoadedFiles() {
// Reset our array
processedVideos = []
if manifestTvOS13 != nil {
- 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 findBestEffortVideo
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
func findBestEffortVideo() -> AerialVideo? {
// So this is embarassing. This can happen if :
// - No video checked
// - No video for current conditions (only day video checked, and looking for night)
// - We don't want to stream but don't have any video
- 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 logToDisk
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
func logToDisk(_ message: String) {
DispatchQueue.main.async {
// Prefix message with date
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss.SSS"
- 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 getCurrentSleepTime
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
func getCurrentSleepTime() -> Int {
// pmset -g | grep "^[ ]*sleep" | awk '{ print $2 }'
let pipe1 = Pipe()
let pmset = Process()
Function generatePlaylist
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
func generatePlaylist(isRestricted: Bool, restrictedTo: String, isVertical: Bool) {
debugLog("generate playlist (isVertical: \(isVertical)")
// Start fresh
playlist = [AerialVideo]()
playlistIsRestricted = isRestricted
Function setNotifications
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
static func setNotifications() {
debugLog("🌉 seting up CompanionBridge")
// Get nightshift
DistributedNotificationCenter.default().addObserver(forName: NSNotification.Name("com.glouel.aerial.nightshift"), object: nil, queue: nil) { notification in