JohnCoates/Aerial

View on GitHub

Showing 376 of 1,136 total issues

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

    Function addWindAndHumidity has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        func addWindAndHumidity(x: CGFloat, y: CGFloat) -> CGFloat {
            // We need to make sure we have the data, and the options are selected
            var addWind = false, addHumidity = false
    
            let wind = condition?.wind
    Severity: Minor
    Found in Aerial/Source/Views/Layers/Weather/ConditionLayer.swift - About 1 hr to fix

      Function parseOldVideoManifest has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          func parseOldVideoManifest(_ data: Data) -> [AerialVideo] {
              do {
                  let oldVideoManifest = try newJSONDecoder().decode(OldVideoManifest.self, from: data)
                  var processedVideos: [AerialVideo] = []
      
      
      Severity: Minor
      Found in Aerial/Source/Models/Sources/Source.swift - About 1 hr to fix

        Function loadManifestsFromLoadedFiles has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            func loadManifestsFromLoadedFiles() {
                // Reset our array
                processedVideos = []
        
                if manifestTvOS13 != nil {
        Severity: Minor
        Found in Aerial/Source/Models/ManifestLoader.swift - About 1 hr to fix

          Function updateVideoView has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              func updateVideoView() {
                  if let video = getSelectedVideo() {
                      debugLog("\"\(video.id)\": \"sunrise\", // \(video.name) - \(video.secondaryName)")
                      debugLog("\"\(video.id)\": \"sunset\", // \(video.name) - \(video.secondaryName)")
                      debugLog("\"\(video.id)\": \"night\", // \(video.name) - \(video.secondaryName)")
          Severity: Minor
          Found in Resources/MainUI/VideosViewController.swift - About 1 hr to fix

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

                override func viewDidLoad() {
                    super.viewDidLoad()
            
                    DispatchQueue.main.async {
                        self.scrollView.contentView.scroll(NSMakePoint(0,0))
            Severity: Minor
            Found in Resources/MainUI/Settings panels/AdvancedViewController.swift - About 1 hr to fix

              Function tableView has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
                      guard let path = path else {
                          return nil
                      }
              
              
              Severity: Minor
              Found in Resources/MainUI/VideosViewController.swift - About 1 hr to fix

                Function downloadManifestsIfNeeded has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private func downloadManifestsIfNeeded() {
                        let downloadManager = DownloadManager()
                
                        var sourceQueue: [Source] = []
                
                
                Severity: Minor
                Found in Aerial/Source/Models/Sources/VideoList.swift - About 1 hr to fix

                  Function getTimeSlice has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public func getTimeSlice() -> String {
                          guard
                              let _ = sunrise,
                              let _ = sunset
                              else {
                  Severity: Minor
                  Found in Aerial/Source/Models/Time/Solar.swift - About 1 hr to fix

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

                      Function updateStatusBar has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          func updateStatusBar() {
                              if PrefsCache.enableManagement {
                                  // We are in managed mode
                                  if PrefsCache.cacheLimit >= 101 {
                                      statusDriveImageView.image = Aerial.helper.getAccentedSymbol("externaldrive.badge.checkmark")
                      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 loadBundle has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private func loadBundle() {
                              // Idle string bundle
                              var bundlePath = Cache.supportPath.appending("/macOS 14")
                      
                              if PrefsAdvanced.ciOverrideLanguage == "" {
                      Severity: Minor
                      Found in Aerial/Source/Models/Cache/PoiStringProvider.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 setNotifications has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          static func setNotifications() {
                              debugLog("🌉 seting up CompanionBridge")
                      
                              // Get nightshift
                              DistributedNotificationCenter.default().addObserver(forName: NSNotification.Name("com.glouel.aerial.nightshift"), object: nil, queue: nil) { notification in
                      Severity: Minor
                      Found in Aerial/Source/Models/CompanionBridge.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 getTimeSlice has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public func getTimeSlice() -> String {
                              guard
                                  let _ = sunrise,
                                  let _ = sunset
                                  else {
                      Severity: Minor
                      Found in Aerial/Source/Models/Time/Solar.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 loadManifestsFromLoadedFiles has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          func loadManifestsFromLoadedFiles() {
                              // Reset our array
                              processedVideos = []
                      
                              if manifestTvOS13 != 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 findBestEffortVideo has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          func findBestEffortVideo() -> AerialVideo? {
                              // So this is embarassing. This can happen if :
                              // - No video checked
                              // - No video for current conditions (only day video checked, and looking for night)
                              // - We don't want to stream but don't have any video
                      Severity: Minor
                      Found in Aerial/Source/Models/Sources/VideoList.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 logToDisk has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      func logToDisk(_ message: String) {
                          DispatchQueue.main.async {
                              // Prefix message with date
                              let dateFormatter = DateFormatter()
                              dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss.SSS"
                      Severity: Minor
                      Found in Aerial/Source/Models/ErrorLog.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 getCurrentSleepTime has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          func getCurrentSleepTime() -> Int {
                              // pmset -g | grep "^[ ]*sleep" | awk '{ print $2 }'
                      
                              let pipe1 = Pipe()
                              let pmset = Process()
                      Severity: Minor
                      Found in Aerial/Source/Models/Time/TimeManagement.swift - About 1 hr to fix

                        Function generatePlaylist has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            func generatePlaylist(isRestricted: Bool, restrictedTo: String, isVertical: Bool) {
                                debugLog("generate playlist (isVertical: \(isVertical)")
                                // Start fresh
                                playlist = [AerialVideo]()
                                playlistIsRestricted = isRestricted
                        Severity: Minor
                        Found in Aerial/Source/Models/Sources/VideoList.swift - About 1 hr to fix

                          Function setNotifications has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              static func setNotifications() {
                                  debugLog("🌉 seting up CompanionBridge")
                          
                                  // Get nightshift
                                  DistributedNotificationCenter.default().addObserver(forName: NSNotification.Name("com.glouel.aerial.nightshift"), object: nil, queue: nil) { notification in
                          Severity: Minor
                          Found in Aerial/Source/Models/CompanionBridge.swift - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language