Showing 53 of 104 total issues
Avoid deeply nested control flow statements. Open
if (j < numKeys) {
var key = page.rows[i][j]
var keyView = self.createKey(key, vibrancy: key.isSpecial ? specialKeyVibrancy : normalKeyVibrancy)
Function specialKey
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
class func specialKey(darkMode: Bool, solidColorMode: Bool) -> UIColor {
if darkMode {
if solidColorMode {
return self.darkModeSolidColorSpecialKey
}
- 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 layoutSpecialKeysRow
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
func layoutSpecialKeysRow(row: [Key], modelToView: [Key:KeyboardKey], gapWidth: CGFloat, leftSideRatio: CGFloat, rightSideRatio: CGFloat, frame: CGRect) {
Function layoutCharacterRow
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func layoutCharacterRow(row: [Key], modelToView: [Key:KeyboardKey], keyWidth: CGFloat, gapWidth: CGFloat, frame: CGRect) {
Function layoutSubviews
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
override func layoutSubviews() {
if !self.dirty {
if self.bounds.width == 0 || self.bounds.height == 0 {
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 layoutSubviews
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
override func layoutSubviews() {
self.layoutPopupIfNeeded()
var boundingBox = (self.popup != nil ? CGRectUnion(self.bounds, self.popup!.frame) : self.bounds)
- 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
Avoid too many return
statements within this function. Open
return ""
Avoid too many return
statements within this function. Open
return self.rounded(returnHeight)
Avoid too many return
statements within this function. Open
return self.uppercaseOutput!
Avoid too many return
statements within this function. Open
return self.rounded(returnWidth)
Avoid too many return
statements within this function. Open
return self.uppercaseKeyCap!
Avoid too many return
statements within this function. Open
return ""
Method login
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def login(host, port, user, pass)
@host = host || '127.0.0.1'
@port = port || 443
@http = Net::HTTP.new(@host, @port)
@http.use_ssl = 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"