Showing 376 of 1,136 total issues
Avoid too many return
statements within this function. Open
return getHEVCMain10Support(macModel: macModel, macSubmodel: "MacBookAir", partial: 8.0, full: 8.0)
Function setupForVideo
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
override func setupForVideo(video: AerialVideo, player: AVPlayer) {
// Only run this once
if !wasSetup {
wasSetup = true
- 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 tableView
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func tableView(_ tableView: NSTableView, acceptDrop info: NSDraggingInfo, row: Int, dropOperation: NSTableView.DropOperation) -> Bool {
var oldIndexes = [Int]()
info.enumerateDraggingItems(options: [], for: tableView, classes: [NSPasteboardItem.self], searchOptions: [:]) { dragItem, _, _ in
if let str = (dragItem.item as! NSPasteboardItem).string(forType: self.dragDropType), let index = Int(str) {
- 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 cleanupSharedViews
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func cleanupSharedViews() {
if AerialView.singlePlayerAlreadySetup {
if let index = AerialView.sharedPlayerIndex {
if AerialView.instanciatedViews[index].wasStopped {
AerialView.singlePlayerAlreadySetup = false
- 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 getOppoMargin
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func getOppoMargin(corner: InfoCorner) -> CGFloat {
// Handle the special cases of having something in the center
if offsets.maxWidth[.topCenter]! > 0 && (corner == .topLeft || corner == .topRight) {
return (baseLayer.visibleRect.size.width + offsets.maxWidth[.topCenter]!) / 2
}
- 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 addPlayerFades
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func addPlayerFades(view: AerialView, player: AVPlayer, video: AerialVideo) {
if !Aerial.helper.underCompanion {
// We only fade in/out if we have duration
if video.duration > 0 && AerialView.shouldFade && !shouldLoop {
let playbackSpeed = Double(PlaybackSpeed.forVideo(video.id))
- 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 redrawCorner
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func redrawCorner(corner: InfoCorner) {
// first clear the offset on that corner
offsets.corner[corner] = 0
// Then move all our layers on that corner
- 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 imageButtonClick
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@IBAction func imageButtonClick(_ sender: NSButton) {
let path = hiddenPath.stringValue
if sender.state == .on {
sender.image = Aerial.helper.getSymbol("checkmark.circle.fill")
- 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 setStates
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func setStates() {
locationMode.selectItem(at: PrefsInfo.weather.locationMode.rawValue)
degreePopup.selectItem(at: PrefsInfo.weather.degree.rawValue)
iconsPopup.selectItem(at: PrefsInfo.weather.icons.rawValue)
weatherModePopup.selectItem(at: PrefsInfo.weather.mode.rawValue)
- 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 updateStatus
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func updateStatus() {
let percent = Battery.getRemainingPercent()
if PrefsInfo.battery.disableWhenFull {
if percent == 100 {
- 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 mainImageClick
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@IBAction func mainImageClick(_ sender: NSButton) {
let path = hiddenPath.stringValue
if checkImageButton.state == .on {
checkImageButton.state = .off
- 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 getSymbol
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func getSymbol(condition: Int, isNight: Bool) -> String {
if isNight && nightSymbols[condition] != nil {
return nightSymbols[condition]!
} else {
if mainSymbols[condition] != 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 reloadPath
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func reloadPath(path: String) {
if let foundMode = VideoList.instance.modeFromPath(path) {
switchMainTo(filter: foundMode)
rotationPopupChange(rotationPopup)
- 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 setupPlayer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func setupPlayer() {
if let player = previewView.player {
if let video = currentVideo {
player.pause()
- 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 test
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func test() {
nightSymbols.forEach { (key: Int, value: String) in
let imagePath = Bundle(for: PanelWindowController.self).path(
forResource: getSymbol(condition: key, isNight: true),
ofType: "pdf")
- 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 getCurrentSleepTime
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func getCurrentSleepTime() -> Int {
// pmset -g | grep "^[ ]*sleep" | awk '{ print $2 }'
let pipe1 = Pipe()
let pmset = Process()
- 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 parseMacManifest
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func parseMacManifest(_ data: Data) -> [AerialVideo] {
if let videoManifest = try? newJSONDecoder().decode(MacManifest.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 parseSourceFromManifest
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static private func parseSourceFromManifest(_ manifest: Manifest, url: URL?) -> Source {
var local = true
var mURL: String
if let isLocal = manifest.local {
local = isLocal
- 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 fetchData
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private static func fetchData(from urlString: String, completion: @escaping (Result<String, NetworkError>) -> Void) {
// check the URL is OK, otherwise return with a failure
guard let url = URL(string: urlString) else {
completion(.failure(.badURL))
return
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
func connection(_ connection: NSURLConnection, didReceive response: URLResponse) {
guard let stream = streamForConnection(connection) else {
errorLog("No matching stream for connection: \(connection) with response: \(response)")
return
}
- 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"