JohnCoates/Aerial

View on GitHub

Showing 376 of 1,136 total issues

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

    func updateCacheBox() {
        let usedCache = Cache.size()
        let packsSize = Cache.packsSize()

        //print("pack size : \(packsSize)")
Severity: Minor
Found in Resources/MainUI/Settings panels/CacheViewController.swift - About 1 hr to fix

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

        private func getCommunityPathForLocale() -> String {
            let locale: NSLocale = NSLocale(localeIdentifier: Locale.preferredLanguages[0])
    
            // Do we have a language override ?
            if PrefsAdvanced.ciOverrideLanguage != "" {
    Severity: Minor
    Found in Aerial/Source/Models/Cache/PoiStringProvider.swift - About 1 hr to fix

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

          static func updateLocalSource(source: Source, reload: Bool) {
              // We need the raw manifest to find the path inside
              let videos = source.getUnprocessedVideos()
              let originalAssets = source.getUnprocessedAssets()
      
      
      Severity: Minor
      Found in Aerial/Source/Models/Sources/SourceList.swift - About 1 hr to fix

        Function getTrimmedRect has 44 lines of code (exceeds 25 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 1 hr to fix

          Function findDuplicate has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              func findDuplicate(id: String, url1080pH264: String) -> (Bool, AerialVideo?) {
                  // We blacklist some duplicates
                  if url1080pH264 != "" {
                      if blacklist.contains((URL(string: url1080pH264)?.lastPathComponent)!) {
                          return (true, nil)
          Severity: Minor
          Found in Aerial/Source/Models/ManifestLoader.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 categorizedSourceList has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              static func categorizedSourceList() -> [SourceHeader] {
                  var communities: [Source] = []
                  var online: [Source] = []
                  var local: [Source] = []
                  var apple: [Source] = []
          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 findDuplicate has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              static func findDuplicate(id: String, url1080pH264: String) -> (Bool, AerialVideo?) {
                  // We blacklist some duplicates
                  if url1080pH264 != "" {
                      if blacklist.contains((URL(string: url1080pH264)?.lastPathComponent)!) {
                          return (true, nil)
          Severity: Minor
          Found in Aerial/Source/Models/Sources/SourceInfo.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 generatePlaylist has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              func generatePlaylist(isRestricted: Bool, restrictedTo: String) {
                  // Start fresh
                  playlist = [AerialVideo]()
                  playlistIsRestricted = isRestricted
                  playlistRestrictedTo = restrictedTo
          Severity: Minor
          Found in Aerial/Source/Models/ManifestLoader.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 connection has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              func connection(_ connection: NSURLConnection, didReceive data: Data) {
          
                  queue.async { () -> Void in
                      self.fillInContentInformation(self.loadingRequest)
          
          
          Severity: Minor
          Found in Aerial/Source/Models/Cache/VideoLoader.swift - About 1 hr to fix

            Function getLanguageStringFromPosition has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                func getLanguageStringFromPosition(pos: Int) -> String {
                    switch pos {
                    case 1:
                        return "ar"
                    case 2:
            Severity: Minor
            Found in Aerial/Source/Models/Cache/PoiStringProvider.swift - About 1 hr to fix

              Function filteredVideosFor has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private func filteredVideosFor(_ mode: FilterMode, section: Int) -> [AerialVideo] {
                      switch mode {
                      case .location:
                          let filter = sourcesFor(mode)[section].lowercased()
                          return videos
              Severity: Minor
              Found in Aerial/Source/Models/Sources/VideoList.swift - About 1 hr to fix

                Function getLanguagePosition has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    func getLanguagePosition() -> Int {
                        // The list is alphabetized based on their english name in the UI
                        switch PrefsAdvanced.ciOverrideLanguage {
                        case "ar":  // Arabic
                            return 1
                Severity: Minor
                Found in Aerial/Source/Models/Cache/PoiStringProvider.swift - About 1 hr to fix

                  Function detectDisplays has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      func detectDisplays() {
                          // Display detection is done in two passes :
                          // - Through CGDisplay, we grab all online screens (connected, but
                          //   may or may not be powered on !) and get most information needed
                          // - Through NSScreen to get the backingScaleFactor (retinaness of a screen)
                  Severity: Minor
                  Found in Aerial/Source/Models/Hardware/DisplayDetection.swift - About 1 hr to fix

                    Function getCoordinates has 40 lines of code (exceeds 25 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

                      Function collectionView has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                          func collectionView(_ itemForRepresentedObjectAtcollectionView: NSCollectionView,
                                              itemForRepresentedObjectAt indexPath: IndexPath) -> NSCollectionViewItem {
                      
                              let item = playingCollectionView.makeItem(withIdentifier:
                                              NSUserInterfaceItemIdentifier(rawValue: "PlayingCollectionViewItem"), for: indexPath)
                      Severity: Minor
                      Found in Resources/MainUI/Settings panels/NowPlayingViewController.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 updateCacheBox has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                          func updateCacheBox() {
                              let usedCache = Cache.size()
                              let packsSize = Cache.packsSize()
                      
                              //print("pack size : \(packsSize)")
                      Severity: Minor
                      Found in Resources/MainUI/Settings panels/CacheViewController.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 loadCachedManifests has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                          func loadCachedManifests() {
                              if let cacheDirectory = VideoCache.appSupportDirectory {
                                  // tvOS13
                                  var cacheFileUrl = URL(fileURLWithPath: cacheDirectory as String)
                                  cacheFileUrl.appendPathComponent("tvos13.json")
                      Severity: Minor
                      Found in Aerial/Source/Models/ManifestLoader.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 setup has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          func setup() {
                              let imagePath = Bundle(for: PanelWindowController.self).path(
                                  forResource: "battery.0",
                                  ofType: "pdf")
                      
                      
                      Severity: Minor
                      Found in Aerial/Source/Views/Layers/BatteryIconLayer.swift - About 1 hr to fix

                        Function getOldFilesEstimation has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            func getOldFilesEstimation() -> (String, Int) {
                                // loadedManifests contains the full deduplicated list of videos
                                debugLog("Looking for outdated files")
                        
                                if loadedManifest.isEmpty {
                        Severity: Minor
                        Found in Aerial/Source/Models/ManifestLoader.swift - About 1 hr to fix

                          Function parseVideoManifest has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              func parseVideoManifest(_ data: Data) -> [AerialVideo] {
                                  if let videoManifest = try? newJSONDecoder().decode(VideoManifest.self, from: data) {
                                      var processedVideos: [AerialVideo] = []
                          
                                      for asset in videoManifest.assets {
                          Severity: Minor
                          Found in Aerial/Source/Models/Sources/Source.swift - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language