JohnCoates/Aerial

View on GitHub

Showing 341 of 829 total issues

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

import Foundation
import ScreenSaver
import GameplayKit
import AVFoundation

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

    File PrefsInfo.swift has 505 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 495 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import Cocoa
      import AVKit
      
      // swiftlint:disable:next type_body_length
      class VideosViewController: NSViewController {
      Severity: Minor
      Found in Resources/MainUI/VideosViewController.swift - About 7 hrs to fix

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

        import Foundation
        import ScreenSaver
        import AVFoundation
        import AVKit
        
        
        Severity: Minor
        Found in Aerial/Source/Views/AerialView.swift - About 7 hrs to fix

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

          import Cocoa
          import CoreWLAN
          import AVKit
          
          /**
          Severity: Minor
          Found in Aerial/Source/Models/Cache/Cache.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 CustomVideoController.swift has 437 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

              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 ForecastLayer.swift has 380 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

                Function outlineView has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                Open

                    func outlineView(outlineView: NSOutlineView, menuForItem item: Any) -> NSMenu? {
                        // Make sure we're right clicking a menu entry
                        if let entry = item as? Sidebar.MenuEntry {
                            if entry.path.starts(with: "videos:") {
                                let idx = entry.path.firstIndex(of: ":")
                Severity: Minor
                Found in Resources/MainUI/SidebarViewController.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 iconFor has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                Open

                    static func iconFor(_ path: String, name: String) -> NSImage? {
                        if path.starts(with: "videos:location") {
                            return Aerial.getAccentedSymbol("mappin.and.ellipse")
                        } else if path.starts(with: "videos:cache") && name == VideoList.instance.cacheDownloaded {
                            return Aerial.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

                File SourceList.swift has 361 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 4 hrs to fix

                  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 fetch has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                    Open

                        static func fetch(completion: @escaping(Result<OCOneCall, NetworkError>) -> Void) {
                            guard testJson == "" else {
                                let jsonData = testJson.data(using: .utf8)!
                    
                                do {
                    Severity: Minor
                    Found in Aerial/Source/Models/API/OneCall.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

                    File DisplayDetection.swift has 356 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 4 hrs to fix

                      File VideoList.swift has 352 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 4 hrs to fix

                        File SidebarViewController.swift has 347 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import Cocoa
                        
                        enum SidebarMenus {
                            case videos, settings, infos
                        }
                        Severity: Minor
                        Found in Resources/MainUI/SidebarViewController.swift - About 4 hrs to fix

                          Function setupForVideo has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                          Open

                              override func setupForVideo(video: AerialVideo, player: AVPlayer) {
                                  // Only run this once
                                  if !wasSetup {
                                      wasSetup = true
                                      frame.size = CGSize(width: 100, height: 1)
                          Severity: Minor
                          Found in Aerial/Source/Views/Layers/Weather/WeatherLayer.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

                          File Source.swift has 340 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 4 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language