Showing 376 of 1,136 total issues
Function fetch
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
static func fetch(completion: @escaping(Result<OCOneCall, NetworkError>) -> Void) {
guard testJson == "" else {
let jsonData = testJson.data(using: .utf8)!
do {
- Read upRead up
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 28 (exceeds 5 allowed). Consider refactoring. Open
static func fetch(completion: @escaping(Result<ForecastElement, NetworkError>) -> Void) {
guard testJson == "" else {
let jsonData = testJson.data(using: .utf8)!
if let forecast = try? newJSONDecoder().decode(ForecastElement.self, from: jsonData) {
- Read upRead up
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 keyDown
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
override func keyDown(with event: NSEvent) {
debugLog("🖼️ keyDown")
if PrefsVideos.allowSkips {
if event.keyCode == 124 {
- Read upRead up
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 a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
func readOldJSONFromData(_ data: Data) -> [AerialVideo] {
var processedVideos: [AerialVideo] = []
do {
let poiStringProvider = PoiStringProvider.sharedInstance
- Read upRead up
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 parseVideoManifest
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
func parseVideoManifest(_ data: Data) -> [AerialVideo] {
if let videoManifest = try? newJSONDecoder().decode(VideoManifest.self, from: data) {
var processedVideos: [AerialVideo] = []
for asset in videoManifest.assets {
- Read upRead up
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 outlineView
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
func outlineView(_ outlineView: NSOutlineView, viewFor tableColumn: NSTableColumn?, item: Any) -> NSView? {
guard let columnIdentifier = tableColumn?.identifier.rawValue else {
return nil
}
Function makeDayBlock
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
func makeDayBlock(slice: ArraySlice<FList>, size: Double) -> CALayer {
// This is ugly but we try and do the best from the data we get...
var tmin, tmax: Double?
var day: Int?
Function outlineView
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
func outlineView(_ outlineView: NSOutlineView, viewFor tableColumn: NSTableColumn?, item: Any) -> NSView? {
guard let columnIdentifier = tableColumn?.identifier.rawValue else {
return nil
}
- Read upRead up
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 playNextVideo
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
func playNextVideo() {
debugLog("🖼️ \(self) pnv")
clearAllLayerAnimations()
- Read upRead up
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
AerialView
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
@objc(AerialView)
// swiftlint:disable:next type_body_length
final class AerialView: ScreenSaverView, CAAnimationDelegate {
var layerManager: LayerManager
var playerLayer: AVPlayerLayer!
Function fetch
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
static func fetch(completion: @escaping(Result<OWeather, NetworkError>) -> Void) {
guard testJson == "" else {
let jsonData = testJson.data(using: .utf8)!
if var openWeather = try? newJSONDecoder().decode(OWeather.self, from: jsonData) {
- Read upRead up
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
VideosViewController
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class VideosViewController: NSViewController {
// Top rotation view
@IBOutlet var rotationView: NSView!
@IBOutlet var rotationPopup: NSPopUpButton!
@IBOutlet var rotationImage: NSImageView!
Function shouldRestrictPlaybackToDayNightVideo
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
func shouldRestrictPlaybackToDayNightVideo() -> (Bool, String) {
debugLog("PrefsTime : \(PrefsTime.timeMode)")
// We override everything on dark mode if we need to
if PrefsTime.darkModeNightOverride && DarkMode.isEnabled() {
debugLog("Dark Mode override")
- Read upRead up
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 getInformation
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
static func getInformation() -> (Bool, sunrise: Date?, sunset: Date?, error: String?) {
// Sonoma workaround
if !Aerial.helper.underCompanion {
if #available(macOS 14.0, *) {
if CompanionBridge.nightShiftSunrise != nil {
- Read upRead up
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 playNextVideo
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
func playNextVideo() {
debugLog("🖼️ \(self) pnv")
clearAllLayerAnimations()
Function generate
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
static func generate(forVideo video: AerialVideo) {
do {
var asset: AVURLAsset
if video.isAvailableOffline {
// If a video is already cached, we may still need to use an online fetch as there's a bug
- Read upRead up
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 observeValue
has a Cognitive Complexity of 21 (exceeds 5 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)")
- Read upRead up
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 setupPlayerLayer
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
func setupPlayerLayer(withPlayer player: AVPlayer) {
let displayDetection = DisplayDetection.sharedInstance
self.layer = CALayer()
guard let layer = self.layer else {
- Read upRead up
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 parseOldVideoManifest
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
func parseOldVideoManifest(_ data: Data) -> [AerialVideo] {
do {
let oldVideoManifest = try newJSONDecoder().decode(OldVideoManifest.self, from: data)
var processedVideos: [AerialVideo] = []
- Read upRead up
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
File SourceInfo.swift
has 288 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Foundation
// swiftlint:disable:next type_body_length
struct SourceInfo {
// Those videos will be ignored