JohnCoates/Aerial

View on GitHub

Showing 376 of 1,136 total issues

VideoList has 25 methods (exceeds 20 allowed). Consider refactoring.
Open

class VideoList {
    enum FilterMode {
        case location, cache, time, scene, source, rotation, favorite, hidden
    }

Severity: Minor
Found in Aerial/Source/Models/Sources/VideoList.swift - About 2 hrs to fix

    Function showVideo has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        func showVideo(_ video: AerialVideo) {
            playbackSpeedLabel.isHidden = false
            playbackSpeedSlider.isHidden = false
    
            
    Severity: Minor
    Found in Resources/MainUI/VideosViewController.swift - About 2 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 makeHourBlock has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        func makeHourBlock(hour: FList, size: Double) -> CALayer {
            let mainLayer = CALayer()
    
            let isNight = hour.sys!.pod! == "n" ? true : false
    
    
    Severity: Major
    Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift - About 2 hrs to fix

      Function makeLegendBlock has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          func makeLegendBlock(size: Double) -> CALayer {
              let mainLayer = CALayer()
      
              // Make a vertically centered layer for t°
              let windLayer = CAVCTextLayer()
      Severity: Major
      Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift - About 2 hrs to fix

        Source has 24 methods (exceeds 20 allowed). Consider refactoring.
        Open

        struct Source: Codable {
            var name: String
            var description: String
            var manifestUrl: String
            var type: SourceType
        Severity: Minor
        Found in Aerial/Source/Models/Sources/Source.swift - About 2 hrs to fix

          Function move has 66 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              func move(toCorner: InfoCorner, fullRedraw: Bool) {
                  if let currCorner = currentCorner, !fullRedraw {
                      // Are we on the same corner ?
                      if currCorner == toCorner {
                          // And same height ?
          Severity: Major
          Found in Aerial/Source/Views/Layers/AnimatableLayer.swift - About 2 hrs to fix

            Function setupPlayerLayer has 65 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                func setupPlayerLayer(withPlayer player: AVPlayer) {
                    let displayDetection = DisplayDetection.sharedInstance
            
                    self.layer = CALayer()
                    guard let layer = self.layer else {
            Severity: Major
            Found in Aerial/Source/Views/AerialView+Player.swift - About 2 hrs to fix

              Function iconFor has 65 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  static func iconFor(_ path: String, name: String) -> NSImage? {
                      if path.starts(with: "videos:location") {
                          return Aerial.helper.getAccentedSymbol("mappin.and.ellipse")
                      } else if path.starts(with: "videos:cache") && name == VideoList.instance.cacheDownloaded {
                          return Aerial.helper.getAccentedSymbol("internaldrive")
              Severity: Major
              Found in Aerial/Source/Models/Sources/Sidebar.swift - About 2 hrs to fix

                Function tableView has a Cognitive Complexity of 19 (exceeds 5 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 2 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 updateVideoView has a Cognitive Complexity of 19 (exceeds 5 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 2 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 readOldJSONFromData has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    func readOldJSONFromData(_ data: Data) -> [AerialVideo] {
                        var processedVideos: [AerialVideo] = []
                
                        do {
                            let poiStringProvider = PoiStringProvider.sharedInstance
                Severity: Major
                Found in Aerial/Source/Models/Sources/Source.swift - About 2 hrs to fix

                  Function freeCache has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      static func freeCache() {
                          guard PrefsCache.enableManagement else {
                              return
                          }
                  
                  
                  Severity: Major
                  Found in Aerial/Source/Models/Cache/Cache.swift - About 2 hrs to fix

                    Function actionButton has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                    Open

                        @IBAction func actionButton(_ sender: NSButton) {
                            if let source = source {
                                if source.type == .local {
                                    NSWorkspace.shared.selectFile(nil, inFileViewerRootedAtPath: Cache.supportPath.appending("/"+source.name))
                                } else {
                    Severity: Minor
                    Found in Aerial/Source/Views/Sources/ActionCellView.swift - About 2 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 fetch has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                    Open

                        static func fetch(completion: @escaping(Result<GeoLocation, NetworkError>) -> Void) {
                            // Check if we already have a geocoded location for this ?
                            if PrefsTime.geocodedString == PrefsInfo.weather.locationString {
                                debugLog("returning cached location from previous geocoding")
                                let lat = String(format: "%.2f", PrefsTime.cachedLatitude)
                    Severity: Minor
                    Found in Aerial/Source/Models/API/GeoCoding.swift - About 2 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 getCommunityPathForLocale has a Cognitive Complexity of 18 (exceeds 5 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 2 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 filteredVideosFor has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private func filteredVideosFor(_ mode: FilterMode, filter: [String]) -> [AerialVideo] {
                            // Our preference filters contains ALL sorts of filters (location, time) that are
                            // saved for better user experience. So we need to filter the filters first !
                            var filters: [String] = []
                    
                    
                    Severity: Major
                    Found in Aerial/Source/Models/Sources/VideoList.swift - About 2 hrs to fix

                      File SourcesViewController.swift has 266 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import Cocoa
                      
                      class SourcesViewController: NSViewController {
                          var customVideoController: CustomVideoController?
                      
                      
                      Severity: Minor
                      Found in Resources/MainUI/Settings panels/SourcesViewController.swift - About 2 hrs to fix

                        DisplayDetection has 22 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        final class DisplayDetection: NSObject {
                            static let sharedInstance = DisplayDetection()
                        
                            var screens = [Screen]()
                            var unusedScreens = [Screen]()
                        Severity: Minor
                        Found in Aerial/Source/Models/Hardware/DisplayDetection.swift - About 2 hrs to fix

                          Function fetch has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              static func fetch(completion: @escaping(Result<OCOneCall, NetworkError>) -> Void) {
                                  guard testJson == "" else {
                                      let jsonData = testJson.data(using: .utf8)!
                          
                                      do {
                          Severity: Major
                          Found in Aerial/Source/Models/API/OneCall.swift - About 2 hrs to fix

                            File PoiStringProvider.swift has 262 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import Foundation
                            
                            final class CommunityStrings {
                                let id: String
                                let name: String
                            Severity: Minor
                            Found in Aerial/Source/Models/Cache/PoiStringProvider.swift - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language