JohnCoates/Aerial

View on GitHub

Showing 376 of 1,136 total issues

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

    override func setupForVideo(video: AerialVideo, player: AVPlayer) {
        guard let config = config else {
            return
        }

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

Avoid deeply nested control flow statements.
Open

                        if idx < 2 {
                            idx += 1
                        } else {
                            idx = 0
                        }
Severity: Major
Found in Aerial/Source/Views/PrefPanel/DisplayView.swift - About 45 mins to fix

    Function closeButton has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        @IBAction func closeButton(_ sender: Any) {
            windowController!.stopVideo()
    
            if !downloadIndicator.isHidden {
                // swiftlint:disable:next line_length
    Severity: Minor
    Found in Resources/MainUI/SidebarViewController.swift - About 45 mins 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 8 (exceeds 5 allowed). Consider refactoring.
    Open

        func outlineView(_ outlineView: NSOutlineView, viewFor tableColumn: NSTableColumn?, item: Any) -> NSView? {
            var view: NSTableCellView?
    
            if let header = item as? Sidebar.Header {
                view = outlineView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "HeaderCell"), owner: self) as? NSTableCellView
    Severity: Minor
    Found in Resources/MainUI/SidebarViewController.swift - About 45 mins 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

    Avoid deeply nested control flow statements.
    Open

                            for view in AerialView.sharedViews where AerialView.sharedViews.first != view {
                                view.fastFadeOut(andPlayNext: false)
                            }
    Severity: Major
    Found in Aerial/Source/Views/AerialView.swift - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if day.frame.height > height {
                                  height = day.frame.height
                              }
      Severity: Major
      Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if PrefsDisplays.viewingMode == .mirrored && shouldFlip {
                                    image = image?.flipped(flipHorizontally: true, flipVertically: false)
                                }
        Severity: Major
        Found in Aerial/Source/Views/PrefPanel/DisplayView.swift - About 45 mins to fix

          Function showImage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              func showImage(_ video: AerialVideo) {
                  heroPlayerView.isHidden = true
                  heroImageView.isHidden = false
                  isCachedImageView.isHidden = true
          
          
          Severity: Minor
          Found in Resources/MainUI/VideosViewController.swift - About 45 mins 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

          Avoid deeply nested control flow statements.
          Open

                                  if dayidx == 0 {
                                      day = makeDayBlock(slice: flist[0..<breakIndex], size: size*2)
          
                                  } else {
                                      day = makeDayBlock(slice: flist[start..<(start+8)], size: size*2)
          Severity: Major
          Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift - About 45 mins to fix

            Function willStop has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                @objc func willStop(_ aNotification: Notification) {
                    DisplayDetection.sharedInstance.resetUnusedScreens()
            
            /*        if #available(macOS 14.0, *) {
                        debugLog("🖼️ 📢📢📢 🖼️ 📢📢📢 ☢️sonoma☢️ workaround IGNORING willStop")
            Severity: Minor
            Found in Aerial/Source/Views/AerialView.swift - About 45 mins 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 migrateOldCache has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                static private func migrateOldCache() {
                    if let formerCachePath = formerCachePath {
                        do {
                            let formerCacheURL = URL(fileURLWithPath: formerCachePath as String)
            
            
            Severity: Minor
            Found in Aerial/Source/Models/Cache/Cache.swift - About 45 mins 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 Log has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            func Log(level: ErrorLevel, message: String) {
                #if DEBUG
                print("\(message)\n")
                #endif
            
            
            Severity: Minor
            Found in Aerial/Source/Models/ErrorLog.swift - About 45 mins 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 resourceLoader has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                func resourceLoader(_ resourceLoader: AVAssetResourceLoader,
                                    didCancel loadingRequest: AVAssetResourceLoadingRequest) {
            //        debugLog("cancelled load request: \(loadingRequest)")
            
                    var remove: VideoLoader?
            Severity: Minor
            Found in Aerial/Source/Models/Cache/AssetLoaderDelegate.swift - About 45 mins 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 lastUpdated has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                func lastUpdated() -> String {
                    if isCached() {
                        var date: Date?
                        if !isCachable && type == .local {
                            date = (try? FileManager.default.attributesOfItem(atPath:
            Severity: Minor
            Found in Aerial/Source/Models/Sources/Source.swift - About 45 mins 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

            Avoid deeply nested control flow statements.
            Open

                                        if dupe.urls[.v1080pH264] == "" {
                                            dupe.urls[.v1080pH264] = asset.url
                                        }
            Severity: Major
            Found in Aerial/Source/Models/Sources/Source.swift - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                          if foundDupe?.urls[.v1080pH264] == "" {
                                              foundDupe?.urls[.v1080pH264] = url
                                          }
              Severity: Major
              Found in Aerial/Source/Models/Sources/Source.swift - About 45 mins to fix

                Function isAvailableOffline has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    static func isAvailableOffline(video: AerialVideo) -> Bool {
                        let fileManager = FileManager.default
                
                        if video.url.absoluteString.starts(with: "file") {
                            return fileManager.fileExists(atPath: video.url.path)
                Severity: Minor
                Found in Aerial/Source/Models/Cache/VideoCache.swift - About 45 mins 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 finishedDownload has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    func finishedDownload(id: String, success: Bool) {
                        // Manage our queuedVideo index
                        if let index = queuedVideos.firstIndex(of: id) {
                            queuedVideos.remove(at: index)
                        }
                Severity: Minor
                Found in Aerial/Source/Models/Cache/VideoManager.swift - About 45 mins 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 8 (exceeds 5 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 45 mins 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

                Avoid deeply nested control flow statements.
                Open

                                        if surl.isDirectory {
                                            debugLog("processing dir")
                                            self.processPathForVideos(url: surl)
                                        }
                Severity: Major
                Found in Aerial/Source/Controllers/CustomVideoController.swift - About 45 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language