JohnCoates/Aerial

View on GitHub

Showing 376 of 1,136 total issues

Function getTimeString has a Cognitive Complexity of 9 (exceeds 5 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/CountdownLayer.swift - About 55 mins 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 addWindAndHumidity has a Cognitive Complexity of 9 (exceeds 5 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 55 mins 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 tableView has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
        if tableColumn == tableView.tableColumns[0] {
            let cid = NSUserInterfaceItemIdentifier(rawValue: "InfoSourceCellID")

            if let cell = tableView.makeView(withIdentifier: cid, owner: self) as? NSTableCellView {
Severity: Minor
Found in Aerial/Source/Views/PrefPanel/InfoTableSource.swift - About 55 mins 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 viewDidLoad has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    override func viewDidLoad() {
        super.viewDidLoad()

        DispatchQueue.main.async {
            self.makeTimeMachineIgnore.state = TimeMachine.isExcluded() ? .on : .off
Severity: Minor
Found in Resources/MainUI/Settings panels/CacheViewController.swift - About 55 mins 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 calculateAnimationDuration has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

     func calculateAnimationDuration(times: [CMTime], current: CMTime, video: AerialVideo) -> Double {
         // We may only show for 10s
         if PrefsInfo.location.time == .tenSeconds {
             return 10
         } else {
Severity: Minor
Found in Aerial/Source/Views/Layers/LocationLayer.swift - About 55 mins 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 updateNetworkStatus has a Cognitive Complexity of 9 (exceeds 5 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 55 mins 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 dayNightCheck has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private func dayNightCheck(sunrise: Date, sunset: Date) -> String {
        var nsunrise = sunrise
        var nsunset = sunset
        let now = Date()
        // When used with manual mode, sunrise and sunset will always be set to 2000-01-01
Severity: Minor
Found in Aerial/Source/Models/Time/TimeManagement.swift - About 55 mins 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 updateRuntimeLabel has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    func updateRuntimeLabel() {
        guard let path = self.path else {
            videoListRuntimeLabel.stringValue = ""
            return
        }
Severity: Minor
Found in Resources/MainUI/VideosViewController.swift - About 55 mins 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 shellScriptTestClick has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    @IBAction func shellScriptTestClick(_ sender: Any) {
        PrefsInfo.message.shellScript = shellScript.stringValue

        if PrefsInfo.message.shellScript != "" {
            if FileManager.default.fileExists(atPath: PrefsInfo.message.shellScript) {
Severity: Minor
Found in Aerial/Source/Views/PrefPanel/InfoMessageView.swift - About 55 mins 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 getClosestAvailable has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private func getClosestAvailable(wanted: VideoFormat) -> URL {
        if urls[wanted] != "" && urls[wanted] != nil {
            return getURL(string: urls[wanted]!)
        } else {
            // Fallback
Severity: Minor
Found in Aerial/Source/Models/AerialVideo.swift - About 55 mins 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 modeFromPath has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    func modeFromPath(_ path: String) -> FilterMode? {
        if path.starts(with: "location") {
            return .location
        } else if path.starts(with: "cache") {
            return .cache
Severity: Minor
Found in Aerial/Source/Models/Sources/VideoList.swift - About 55 mins 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 clearNonCacheableSources has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    static func clearNonCacheableSources() {
        // Then we need to look at individual online sources
        // let onlineVideos = VideoList.instance.videos.filter({ !$0.source.isCachable })

        for source in SourceList.foundSources.filter({!$0.isCachable}) {
Severity: Minor
Found in Aerial/Source/Models/Cache/Cache.swift - About 55 mins 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 getVideos has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    func getVideos() -> [AerialVideo] {
        if isCached() {
            do {
                let cacheFileUrl = URL(fileURLWithPath: Cache.supportPath.appending("/" + name + "/entries.json"))
                let jsondata = try Data(contentsOf: cacheFileUrl)
Severity: Minor
Found in Aerial/Source/Models/Sources/Source.swift - About 55 mins 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 getIntermediateAdvancedScreenRect has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    func getIntermediateAdvancedScreenRect() -> CGRect {
        // At this point, this is non zeroed
        var minX: CGFloat = 0.0, minY: CGFloat = 0.0, maxX: CGFloat = 0.0, maxY: CGFloat = 0.0
        for screen in screens {
            if screen.zeroedOrigin.x < minX {
Severity: Minor
Found in Aerial/Source/Models/Hardware/DisplayDetection.swift - About 55 mins 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 isHEVCMain10HWDecodingAvailable has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    func isHEVCMain10HWDecodingAvailable() -> HEVCMain10Support {
        let macModel = getMacModel()

        // Apple silicon supports everything!
        if isAppleSilicon() {
Severity: Minor
Found in Aerial/Source/Models/Hardware/HardwareDetection.swift - About 55 mins 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

Avoid deeply nested control flow statements.
Open

                        if day.frame.height > height {
                            height = day.frame.height
                        }
Severity: Major
Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift - About 45 mins to fix

    Function getTimeString has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        func getTimeString() -> String {
            var locale = Locale.current
            if PrefsAdvanced.ciOverrideLanguage != "" {
                locale = Locale(identifier: PrefsAdvanced.ciOverrideLanguage)
            }
    Severity: Minor
    Found in Aerial/Source/Views/Layers/ClockLayer.swift - About 45 mins 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

    Avoid deeply nested control flow statements.
    Open

                            if PrefsDisplays.viewingMode == .mirrored && shouldFlip {
                                image = image?.flipped(flipHorizontally: true, flipVertically: false)
                            }
    Severity: Major
    Found in Aerial/Source/Views/PrefPanel/DisplayView.swift - About 45 mins to fix

      Function outlineView has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          func outlineView(_ outlineView: NSOutlineView, viewFor tableColumn: NSTableColumn?, item: Any) -> NSView? {
              var view: NSTableCellView?
      
              if let header = item as? Sidebar.Header {
                  view = outlineView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "HeaderCell"), owner: self) as? NSTableCellView
      Severity: Minor
      Found in Resources/MainUI/SidebarViewController.swift - About 45 mins 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 willStop has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          @objc func willStop(_ aNotification: Notification) {
              DisplayDetection.sharedInstance.resetUnusedScreens()
      
      /*        if #available(macOS 14.0, *) {
                  debugLog("🖼️ 📢📢📢 🖼️ 📢📢📢 ☢️sonoma☢️ workaround IGNORING willStop")
      Severity: Minor
      Found in Aerial/Source/Views/AerialView.swift - About 45 mins 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