Showing 376 of 1,136 total issues
Function setupForVideo
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
override func setupForVideo(video: AerialVideo, player: AVPlayer) {
let poiStringProvider = PoiStringProvider.sharedInstance
// We need to make sure we actually have descriptions to show.
// Custom videos, and earlier tvOS videos may not
if poiStringProvider.hasPoiKeys(video: video) {
- 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 makeDayBlock
has a Cognitive Complexity of 17 (exceeds 5 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?
- 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 connection
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
func connection(_ connection: NSURLConnection, didReceive data: Data) {
queue.async { () -> Void in
self.fillInContentInformation(self.loadingRequest)
- 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 filteredVideosFor
has a Cognitive Complexity of 17 (exceeds 5 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] = []
- 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 updateLocalSource
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
static func updateLocalSource(source: Source, reload: Bool) {
// We need the raw manifest to find the path inside
let videos = source.getUnprocessedVideos()
let originalAssets = source.getUnprocessedAssets()
- 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 generatePlaylist
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
func generatePlaylist(isRestricted: Bool, restrictedTo: String, isVertical: Bool) {
debugLog("generate playlist (isVertical: \(isVertical)")
// Start fresh
playlist = [AerialVideo]()
playlistIsRestricted = isRestricted
- 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 removeCruft
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
static func removeCruft() {
// TODO: kind of a temporary safety
if VideoList.instance.videos.count > 90 {
// First let's look at the cache
- 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 randomVideo
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
func randomVideo(excluding: [AerialVideo], isVertical: Bool) -> (AerialVideo?, Bool) {
var shouldLoop = false
let timeManagement = TimeManagement.sharedInstance
let (shouldRestrictByDayNight, restrictTo) = timeManagement.shouldRestrictPlaybackToDayNightVideo()
- 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 isScreenActive
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
func isScreenActive(id: CGDirectDisplayID) -> Bool {
let screen = findScreenWith(id: id)
debugLog("ISA : \(screen)")
switch PrefsDisplays.displayMode {
- 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 getZeroedActiveSpannedRect
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
func getZeroedActiveSpannedRect() -> CGRect {
if PrefsDisplays.displayMarginsAdvanced && !advancedMargins.displays.isEmpty, let advz = advancedZeroedScreenRect {
// Now this is awkward... we precalculated this at detectdisplays->advancedZeroedOrigins
return advz
} 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 getSuggestedFormat
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
func getSuggestedFormat() -> VideoFormat {
switch isHEVCMain10HWDecodingAvailable() {
case .supported:
if #available(OSX 10.15, *) {
return .v4KHDR
- 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 getGlobalScreenRect
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
func getGlobalScreenRect() -> CGRect {
if PrefsDisplays.displayMarginsAdvanced && !advancedMargins.displays.isEmpty, let adv = advancedScreenRect {
// Now this is awkward... we precalculated this at detectdisplays->advancedZeroedOrigins
return adv
} 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 fetch
has 55 lines of code (exceeds 25 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) {
Function showVideo
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
func showVideo(_ video: AerialVideo) {
playbackSpeedLabel.isHidden = false
playbackSpeedSlider.isHidden = false
Function fetch
has 54 lines of code (exceeds 25 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) {
Function fetchOnlineManifest
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
static func fetchOnlineManifest(url: URL) {
if let source = loadManifest(url: url) {
debugLog("Source loaded")
// Then save !
let downloadManager = DownloadManager()
Function isCornerAcceptable
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
func isCornerAcceptable(corner: Int) -> Bool {
// Not the prettiest helper, this is a bit of a hack
// If we have something in both topCenter and bottomCenter, we could infinite loop
// So as a precaution we allow whatever was picked
- 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 setDimTimers
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
func setDimTimers() {
if #available(OSX 10.12, *) {
let timeManagement = TimeManagement.sharedInstance
let startValue = min(PrefsDisplays.startDim, Double(brightnessToRestore!))
- 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 getSelectedVideo
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
func getSelectedVideo() -> AerialVideo? {
if let path = path {
if videoListTableView.selectedRow > -1 {
if let mode = VideoList.instance.modeFromPath(path) {
let index = Int(path.split(separator: ":")[1])!
- 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 getOldFilesEstimation
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
func getOldFilesEstimation() -> (String, Int) {
// loadedManifests contains the full deduplicated list of videos
debugLog("Looking for outdated files")
if loadedManifest.isEmpty {
- 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"