JohnCoates/Aerial

View on GitHub

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] = []

Severity: Minor
Found in Aerial/Source/Models/Sources/VideoList.swift - About 2 hrs to fix

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))
Severity: Minor
Found in Aerial/Source/Models/Cache/Cache.swift - About 2 hrs to fix

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, *) {
Severity: Minor
Found in Aerial/Source/Controllers/CustomVideoController.swift - About 2 hrs to fix

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
Severity: Major
Found in Aerial/Source/Views/PrefPanel/InfoWeatherView.swift - About 2 hrs to fix

    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)
    Severity: Major
    Found in Aerial/Source/Models/Time/Solar.swift - About 2 hrs to fix

      File TimeManagement.swift has 252 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import Foundation
      import Cocoa
      import CoreLocation
      import IOKit.ps
      
      
      Severity: Minor
      Found in Aerial/Source/Models/Time/TimeManagement.swift - About 2 hrs to fix

        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")
        Severity: Major
        Found in Aerial/Source/Models/Time/TimeManagement.swift - About 2 hrs to fix

          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
          Severity: Minor
          Found in Aerial/Source/Models/Cache/Thumbnails.swift - About 2 hrs to fix

            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 != "" {
            Severity: Minor
            Found in Aerial/Source/Views/Layers/TimerLayer.swift - About 1 hr to fix

            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, *) {
            Severity: Minor
            Found in Aerial/Source/Models/Locations.swift - About 1 hr to fix

            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
            Severity: Minor
            Found in Aerial/Source/Models/AerialVideo.swift - About 1 hr to fix

            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()
            Severity: Minor
            Found in Aerial/Source/Models/Sources/SourceList.swift - About 1 hr to fix

            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)
            Severity: Minor
            Found in Resources/MainUI/Settings panels/OverlaysViewController.swift - About 1 hr to fix

              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
              
              
              Severity: Minor
              Found in Aerial/Source/Controllers/CustomVideoController.swift - About 1 hr to fix

                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) {
                Severity: Minor
                Found in Aerial/Source/Views/Layers/LocationLayer.swift - About 1 hr to fix

                  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"
                  
                  
                  Severity: Minor
                  Found in Resources/MainUI/PanelWindowController.swift - About 1 hr to fix

                    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 {
                    Severity: Minor
                    Found in Aerial/Source/Models/Sources/SourceList.swift - About 1 hr to fix

                      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 {
                      Severity: Minor
                      Found in Aerial/Source/Models/Hardware/NightShift.swift - About 1 hr to fix

                        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
                        Severity: Minor
                        Found in Aerial/Source/Controllers/CustomVideoController.swift - About 1 hr to fix

                          Function viewDidLoad has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              override func viewDidLoad() {
                                  super.viewDidLoad()
                          
                                  setupDarkMode()
                                  DispatchQueue.main.async {
                          Severity: Minor
                          Found in Resources/MainUI/Settings panels/TimeViewController.swift - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language