JohnCoates/Aerial

View on GitHub

Showing 376 of 1,136 total issues

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

    func getSuggestedFormat() -> VideoFormat {
        switch isHEVCMain10HWDecodingAvailable() {
        case .supported:
            if #available(OSX 10.15, *) {
                return .v4KHDR
Severity: Minor
Found in Aerial/Source/Models/Hardware/HardwareDetection.swift - About 1 hr to fix

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

      Function addLayerForType has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private func addLayerForType(_ layerType: InfoType, layer: CALayer) {
              var newLayer: AnimatableLayer?
      
              if PrefsInfo.ofType(layerType).isEnabled && shouldEnableOnScreen(PrefsInfo.ofType(layerType).displays) {
                  switch layerType {
      Severity: Minor
      Found in Aerial/Source/Views/Layers/LayerManager.swift - About 1 hr to fix

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

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

            Function reframe has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                func reframe() {
                    // ReRect the name & artist
                    let rect = nameLayer.calculateRect(string: nameLayer.string as! String,
                                    font: nameLayer.font as! NSFont,
                                    maxWidth: Double(layerManager.frame!.size.width))
            Severity: Minor
            Found in Aerial/Source/Views/Layers/Music/MusicLayer.swift - About 1 hr to fix

              Function randomVideo has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  func randomVideo(excluding: [AerialVideo], isVertical: Bool) -> (AerialVideo?, Bool) {
                      var shouldLoop = false
                      let timeManagement = TimeManagement.sharedInstance
              
                      let (shouldRestrictByDayNight, restrictTo) = timeManagement.shouldRestrictPlaybackToDayNightVideo()
              Severity: Minor
              Found in Aerial/Source/Models/Sources/VideoList.swift - About 1 hr to fix

                Function viewDidLoad has a Cognitive Complexity of 11 (exceeds 5 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

                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 runShell has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    func runShell() -> String? {
                        guard let config = config else {
                            return nil
                        }
                
                
                Severity: Minor
                Found in Aerial/Source/Views/Layers/MessageLayer.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 mouseDown has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    override func mouseDown(with event: NSEvent) {
                        let displayDetection = DisplayDetection.sharedInstance
                
                        // Grab relative location of the click in view
                        let point = convert(event.locationInWindow, from: nil)
                Severity: Minor
                Found in Aerial/Source/Views/PrefPanel/DisplayView.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 makeLegendBlock has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    func makeLegendBlock(size: Double) -> CALayer {
                        let mainLayer = CALayer()
                
                        // Make a vertically centered layer for t°
                        let windLayer = CAVCTextLayer()
                Severity: Minor
                Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.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 moveOldManifests has a Cognitive Complexity of 11 (exceeds 5 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

                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 consolidateLoadedRanges has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    func consolidateLoadedRanges() {
                        var consolidatedRanges: [NSRange] = []
                
                        let sortedRanges = loadedRanges.sorted { $0.location < $1.location }
                
                
                Severity: Minor
                Found in Aerial/Source/Models/Cache/VideoCache.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 ensureDownload has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    static func ensureDownload(action: @escaping () -> Void) {
                        // Do we manage the cache or not ?
                        if PrefsCache.enableManagement {
                            // Check network first
                            if !canNetwork() {
                Severity: Minor
                Found in Aerial/Source/Models/Cache/Cache.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 getRemainingPercent has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    static func getRemainingPercent() -> Int {
                        // Take a snapshot of all the power source info
                        guard let snapshot = IOPSCopyPowerSourcesInfo()?.takeRetainedValue()
                            else { return 0 }
                
                
                Severity: Minor
                Found in Aerial/Source/Models/Hardware/Battery.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 updateStatusBar has 31 lines of code (exceeds 25 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

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

                    Function updateTimeView has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        func updateTimeView() {
                            switch PrefsTime.timeMode {
                            case .disabled:
                                timeBarView.isHidden = true
                                return
                    Severity: Minor
                    Found in Resources/MainUI/Settings panels/TimeViewController.swift - About 1 hr to fix

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

                        Function checkIfShouldRedownloadFiles has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            func checkIfShouldRedownloadFiles() {
                                let dateFormatter = DateFormatter()
                                dateFormatter.dateFormat = "yyyy-MM-dd"
                                dateFormatter.locale = Locale.init(identifier: "en_GB")
                                let dateObj = dateFormatter.date(from: PrefsVideos.lastVideoCheck)
                        Severity: Minor
                        Found in Aerial/Source/Models/ManifestLoader.swift - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language