JohnCoates/Aerial

View on GitHub

Showing 376 of 1,136 total issues

Function move has a Cognitive Complexity of 10 (exceeds 5 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: Minor
Found in Aerial/Source/Views/Layers/AnimatableLayer.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 calculate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    fileprivate func calculate(_ sunriseSunset: SunriseSunset, for date: Date, and zenith: Zenith) -> Date? {
        guard let utcTimezone = TimeZone(identifier: "UTC") else { return nil }

        // Get the day of the year
        var calendar = Calendar(identifier: .gregorian)
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 calculate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public mutating func calculate() {
        strictSunrise = calculate(.sunrise, for: date, and: .strict)
        strictSunset = calculate(.sunset, for: date, and: .strict)
        sunrise = calculate(.sunrise, for: date, and: .official)
        sunset = calculate(.sunset, for: date, and: .official)
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 getSubcategoryFor has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    func getSubcategoryFor(_ asset: MacAsset, manifest: MacManifest) -> String {
        for category in manifest.categories {
            if category.subcategories != nil {
                for subcategory in category.subcategories! {
                    if subcategory.id == asset.subcategories.first {
Severity: Minor
Found in Aerial/Source/Models/Sources/Source.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 mediaRemoteAppStateChange has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    @objc func mediaRemoteAppStateChange(_ aNotification: Notification) {
        debugLog("🎧 app state change")
        
        if let userInfo = aNotification.userInfo {
            if let rate = userInfo["kMRMediaRemoteNowPlayingApplicationIsPlayingUserInfoKey"] as? Double {
Severity: Minor
Found in Aerial/Source/Models/Music/Music.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 detectDisplays has a Cognitive Complexity of 10 (exceeds 5 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

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

    @IBAction func menuRemoveVideoClick(_ sender: NSMenuItem) {
        if let asset = sender.representedObject as? Asset {
            let manifestInstance = ManifestLoader.instance

            if let cvf = manifestInstance.customVideoFolders {
Severity: Minor
Found in Aerial/Source/Controllers/CustomVideoController.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 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    func setNotifications(_ currentItem: AVPlayerItem) {
        let notificationCenter = NotificationCenter.default

        notificationCenter.addObserver(self,
                                       selector: #selector(AerialView.playerItemDidReachEnd(_:)),
Severity: Minor
Found in Aerial/Source/Views/AerialView.swift - About 1 hr to fix

    Function redrawVC has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        func redrawVC() {
            splitVC.removeChild(at: 1)
            splitVC.removeChild(at: 0)
    
            switch currentStep {
    Severity: Minor
    Found in Resources/MainUI/First time setup/FirstSetupWindowController.swift - About 1 hr to fix

      Function resetAllSettings has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @IBAction func resetAllSettings(_ sender: NSButton) {
              if Aerial.helper.showAlert(
                  question: "Reset all settings?",
                  text: "This will reset all your settings. After they are reset, Aerial will close System Preferences, you will have to reload it to access settings again.\n\nAre you sure you want to reset your settings?",
                  button1: "Reset my settings",
      Severity: Minor
      Found in Resources/MainUI/Settings panels/AdvancedViewController.swift - About 1 hr to fix

        Function updateDuration has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            func updateDuration() {
                // We need to retrieve video duration from the cached files.
                // This is a workaround as currently, the VideoCache infrastructure
                // relies on AVAsset with an external URL all the time, even when
                // working on a cached copy which makes the native duration retrieval fail
        Severity: Minor
        Found in Aerial/Source/Models/AerialVideo.swift - About 1 hr to fix

          Function isScreenActive has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              func isScreenActive(id: CGDirectDisplayID) -> Bool {
                  let screen = findScreenWith(id: id)
                  debugLog("ISA : \(screen)")
                  
                  switch PrefsDisplays.displayMode {
          Severity: Minor
          Found in Aerial/Source/Models/Hardware/DisplayDetection.swift - About 1 hr to fix

            Function updateNetworkStatus has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                func updateNetworkStatus() {
                    if PrefsCache.restrictOnWiFi {
                        connectedIcon.isHidden = false
                        connectedLabel.isHidden = false
                        addCurrentNetworkButton.isHidden = false
            Severity: Minor
            Found in Resources/MainUI/Settings panels/CacheViewController.swift - About 1 hr to fix

              Function rotationPopupChange has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  @IBAction func rotationPopupChange(_ sender: NSPopUpButton) {
              
                      switch sender.indexOfSelectedItem {
                      case 0:
                          mode = "all"
              Severity: Minor
              Found in Resources/MainUI/VideosViewController.swift - About 1 hr to fix

                Function showImage has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    func showImage(_ video: AerialVideo) {
                        heroPlayerView.isHidden = true
                        heroImageView.isHidden = false
                        isCachedImageView.isHidden = true
                
                
                Severity: Minor
                Found in Resources/MainUI/VideosViewController.swift - About 1 hr to fix

                  Function setupForVideo has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      override func setupForVideo(video: AerialVideo, player: AVPlayer) {
                          guard let config = config else {
                              return
                          }
                  
                  
                  Severity: Minor
                  Found in Aerial/Source/Views/Layers/MessageLayer.swift - About 1 hr to fix

                    Function setDimTimers has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        func setDimTimers() {
                            if #available(OSX 10.12, *) {
                                let timeManagement = TimeManagement.sharedInstance
                                let startValue = min(PrefsDisplays.startDim, Double(brightnessToRestore!))
                    
                    
                    Severity: Minor
                    Found in Aerial/Source/Views/AerialView+Brightness.swift - About 1 hr to fix

                      Function finishedDownload has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          func finishedDownload() {
                              var tentativeCachePath: String?
                      
                              if video.source.isCachable {
                                  tentativeCachePath = VideoCache.cachePath(forVideo: video)
                      Severity: Minor
                      Found in Aerial/Source/Models/Cache/VideoDownload.swift - About 1 hr to fix

                        Function removeUncachedCruft has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            static func removeUncachedCruft() {
                                for source in SourceList.foundSources where !source.isCachable && source.type != .local {
                                    debugLog("Checking cruft in \(source.name)")
                        
                                    let pathURL = URL(fileURLWithPath: supportPath.appending("/" + source.name))
                        Severity: Minor
                        Found in Aerial/Source/Models/Cache/Cache.swift - About 1 hr to fix

                          Function getMarginsJSON has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              func getMarginsJSON() -> String {
                                  var adv: AdvancedMargin
                          
                                  if !advancedMargins.displays.isEmpty {
                                      // If we have something already in preferences, return that
                          Severity: Minor
                          Found in Aerial/Source/Models/Hardware/DisplayDetection.swift - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language