JohnCoates/Aerial

View on GitHub

Showing 376 of 1,136 total issues

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

    Function getTimeString has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        func getTimeString() -> String {
            // Handle locale
            var locale = Locale(identifier: Locale.preferredLanguages[0])
            if PrefsAdvanced.ciOverrideLanguage != "" {
                locale = Locale(identifier: PrefsAdvanced.ciOverrideLanguage)
    Severity: Minor
    Found in Aerial/Source/Views/Layers/DateLayer.swift - About 1 hr to fix

      Function setupRefresh has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          func setupRefresh() {
              debugLog("setting up refresh")
              guard let config = config else {
                  return
              }
      Severity: Minor
      Found in Aerial/Source/Views/Layers/MessageLayer.swift - About 1 hr to fix

        Function isDaytime has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Function removeCruft has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              static func removeCruft() {
                  // TODO: kind of a temporary safety
                  if VideoList.instance.videos.count > 90 {
                      // First let's look at the cache
          
          
          Severity: Minor
          Found in Aerial/Source/Models/Cache/Cache.swift - About 1 hr to fix

            Function observeValue has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                internal override func observeValue(forKeyPath keyPath: String?,
                                                    of object: Any?, change: [NSKeyValueChangeKey: Any]?,
                                                    context: UnsafeMutableRawPointer?) {
                    debugLog("🖼️ \(description) observeValue \(String(describing: keyPath)) \(playerLayer.isReadyForDisplay)")
            
            
            Severity: Minor
            Found in Aerial/Source/Views/AerialView.swift - About 1 hr to fix

              Function makeWindBlock has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  func makeWindBlock(wind: OWWind) -> CALayer {
                      let windBlock = CALayer()
              
                      // Make a vertically centered layer for t°
                      let textWind = CAVCTextLayer()
              Severity: Minor
              Found in Aerial/Source/Views/Layers/Weather/ConditionLayer.swift - About 1 hr to fix

                Function getTimeString has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    func getTimeString() -> String {
                        if #available(OSX 10.12, *) {
                            // Handle locale
                            var locale = Locale(identifier: Locale.preferredLanguages[0])
                            if PrefsAdvanced.ciOverrideLanguage != "" {
                Severity: Minor
                Found in Aerial/Source/Views/Layers/TimerLayer.swift - About 1 hr to fix

                  Function getSunriseSunset has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public func getSunriseSunset() -> (Date?, Date?) {
                          switch PrefsTime.timeMode {
                          case .disabled:
                              return (nil, nil)
                          case .nightShift:
                  Severity: Minor
                  Found in Aerial/Source/Models/Time/TimeManagement.swift - About 1 hr to fix

                    Function updateRuntimeLabel has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        func updateRuntimeLabel() {
                            guard let path = self.path else {
                                videoListRuntimeLabel.stringValue = ""
                                return
                            }
                    Severity: Minor
                    Found in Resources/MainUI/VideosViewController.swift - About 1 hr to fix

                      Function reloadFiles has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          func reloadFiles() {
                              moveOldManifests()
                      
                              // Ok then, we fetch them...
                              debugLog("Fetching missing manifests online")
                      Severity: Minor
                      Found in Aerial/Source/Models/ManifestLoader.swift - About 1 hr to fix

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

                          Function setType has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              func setType(_ forType: InfoType, controller: OverlaysViewController) {
                                  // We need the controller for callbacks, when we update the isEnabled state,
                                  // we need to update the list view on the left too
                                  self.controller = controller
                                  
                          Severity: Minor
                          Found in Aerial/Source/Views/PrefPanel/InfoCommonView.swift - About 1 hr to fix

                            Function isCornerAcceptable has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                func isCornerAcceptable(corner: Int) -> Bool {
                                    // Not the prettiest helper, this is a bit of a hack
                            
                                    // If we have something in both topCenter and bottomCenter, we could infinite loop
                                    // So as a precaution we allow whatever was picked
                            Severity: Minor
                            Found in Aerial/Source/Views/Layers/LayerManager.swift - About 1 hr to fix

                              Function moveOldManifests has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  func moveOldManifests() {
                                      debugLog("move")
                                      let cacheDirectory = VideoCache.appSupportDirectory!
                                      var cacheResourcesString = cacheDirectory
                              
                              
                              Severity: Minor
                              Found in Aerial/Source/Models/ManifestLoader.swift - About 1 hr to fix

                                Function setupPopover has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    func setupPopover() {
                                        // Help popover, GVA detection requires 10.13
                                        if #available(OSX 10.13, *) {
                                            if !VTIsHardwareDecodeSupported(kCMVideoCodecType_H264) {
                                                popoverH264Label.stringValue = "H264 acceleration not supported"
                                Severity: Minor
                                Found in Resources/MainUI/Settings panels/AdvancedViewController.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 getTimeString has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    func getTimeString() -> String {
                                        // Handle locale
                                        var locale = Locale(identifier: Locale.preferredLanguages[0])
                                        if PrefsAdvanced.ciOverrideLanguage != "" {
                                            locale = Locale(identifier: PrefsAdvanced.ciOverrideLanguage)
                                Severity: Minor
                                Found in Aerial/Source/Views/Layers/DateLayer.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 screenIsUnlocked has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    @objc func screenIsUnlocked(_ aNotification: Notification) {
                                        if #available(macOS 14.0, *) {
                                            debugLog("🖼️ 📢📢📢 ☢️sonoma☢️ workaround screenIsUnlocked")
                                            if !Aerial.helper.underCompanion {
                                                if let player = player {
                                Severity: Minor
                                Found in Aerial/Source/Views/AerialView.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 pickFolderButton has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    @IBAction func pickFolderButton(_ sender: Any) {
                                        let openPanel = NSOpenPanel()
                                
                                        openPanel.canChooseDirectories = true
                                        openPanel.canChooseFiles = false
                                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 checkIfShouldSetBrightness has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    func checkIfShouldSetBrightness() {
                                        
                                        let timeManagement = TimeManagement.sharedInstance
                                
                                        if PrefsDisplays.dimBrightness && !isPreview && brightnessToRestore == nil {
                                Severity: Minor
                                Found in Aerial/Source/Views/AerialView+Brightness.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

                                Severity
                                Category
                                Status
                                Source
                                Language