JohnCoates/Aerial

View on GitHub

Showing 376 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

Severity: Major
Found in Aerial/Source/Views/AerialView.swift - About 1 day to fix

    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 }
    Severity: Major
    Found in Aerial/Source/Models/Prefs/PrefsInfo.swift - About 1 day to fix

      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 {
      Severity: Major
      Found in Resources/MainUI/VideosViewController.swift - About 1 day to fix

        File Cache.swift has 519 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import Cocoa
        import CoreWLAN
        import AVKit
        
        /**
        Severity: Major
        Found in Aerial/Source/Models/Cache/Cache.swift - About 1 day to fix

          File ManifestLoader.swift has 495 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import Foundation
          import ScreenSaver
          import GameplayKit
          import AVFoundation
          
          
          Severity: Minor
          Found in Aerial/Source/Models/ManifestLoader.swift - About 7 hrs to fix

            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)
            Severity: Minor
            Found in Aerial/Source/Views/PrefPanel/DisplayView.swift - About 7 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

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

              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
              Severity: Minor
              Found in Aerial/Source/Views/AerialView.swift - About 7 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

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

                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
                Severity: Minor
                Found in Aerial/Source/Models/Sources/VideoList.swift - About 6 hrs to fix

                  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
                  
                  
                  Severity: Minor
                  Found in Aerial/Source/Models/Extensions/NSImage+trim.swift - About 6 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 freeCache has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
                  Open

                      static func freeCache() {
                          guard PrefsCache.enableManagement else {
                              return
                          }
                  
                  
                  Severity: Minor
                  Found in Aerial/Source/Models/Cache/Cache.swift - About 5 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

                  File SourceList.swift has 379 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import Foundation
                  
                  struct SourceHeader {
                      let name: String
                      let sources: [Source]
                  Severity: Minor
                  Found in Aerial/Source/Models/Sources/SourceList.swift - About 5 hrs to fix

                    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?
                    Severity: Minor
                    Found in Aerial/Source/Models/Music/Music.swift - About 5 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

                    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 {
                    Severity: Minor
                    Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift - About 5 hrs to fix

                      File DisplayDetection.swift has 376 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import Foundation
                      import Cocoa
                      
                      class Screen: NSObject {
                          var id: CGDirectDisplayID
                      Severity: Minor
                      Found in Aerial/Source/Models/Hardware/DisplayDetection.swift - About 5 hrs to fix

                        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")
                        Severity: Minor
                        Found in Aerial/Source/Models/Sources/Sidebar.swift - About 4 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 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
                        Severity: Minor
                        Found in Aerial/Source/Views/PrefPanel/InfoWeatherView.swift - About 4 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 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)
                        Severity: Major
                        Found in Aerial/Source/Views/PrefPanel/DisplayView.swift - About 4 hrs to fix

                          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
                          Severity: Major
                          Found in Aerial/Source/Views/AerialView.swift - About 4 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language