Showing 36 of 147 total issues
Function handleErrorOS11
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
@available(iOS 11.0, *)
private static func handleErrorOS11(_ error: NSError) -> Result {
switch error {
case LAError.authenticationFailed:
return .authenticationFailed
Function smoothGradient
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
func smoothGradient(colors: [UIColor], direction: UIViewGradientDirection, type: UIViewGradientType = .linear) {
UIGraphicsBeginImageContextWithOptions(bounds.size, false, UIImage.screenScale())
guard let context = UIGraphicsGetCurrentContext() else {
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 flatten
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public func flatten<T>(_ array: [T]) -> [T] {
/// Returned flattened array.
var flattened: [T] = []
/// For every element inside the array.
- 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 scaleProportionally
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
func scaleProportionally(toSize targetSize: CGSize) -> UIImage {
let sourceImage: UIImage = self
let newTargetSize: CGSize = targetSize
let imageSize: CGSize = sourceImage.size
- 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 cmykHalftone
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
func cmykHalftone(center: CIVector, width: Float, angle: Float, sharpness: Float, gcr: Float, ucr: Float) -> UIImage { // swiftlint:disable:this function_parameter_count
Function shadow
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func shadow(offset: CGSize, opacity: Float, radius: CGFloat, cornerRadius: CGFloat = 0, color: UIColor = UIColor.black) {
Function translateAround
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func translateAround(topView: UIView, duration: CGFloat, direction: UIViewAnimationTranslationDirection, repeatAnimation: Bool = true, startFromEdge: Bool = true) {
Function scaleProportionally
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
func scaleProportionally(toMinimumSize targetSize: CGSize) -> UIImage {
let sourceImage: UIImage = self
let newTargetSize: CGSize = targetSize
let imageSize: CGSize = sourceImage.size
- 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 self
Avoid too many return
statements within this function. Open
return self
Avoid too many return
statements within this function. Open
return outputImage
Avoid too many return
statements within this function. Open
return self
Function swap
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
mutating func swap(from fromIndex: Int, to toIndex: Int) {
if toIndex != fromIndex {
guard let object: Element = safeObject(at: fromIndex) else {
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 scaleProportionally
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func scaleProportionally(toMaximumSize targetSize: CGSize) -> UIImage {
let newTargetSize: CGSize = targetSize
if size.width > newTargetSize.width || newTargetSize.width == newTargetSize.height, size.width > size.height {
let factor: CGFloat = (newTargetSize.width * 100) / size.width
- 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 useBiometric
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static func useBiometric(localizedReason: String, fallbackTitle: String? = nil, completion: @escaping (_ result: Result) -> Void) {
let context = LAContext()
context.localizedFallbackTitle = fallbackTitle
- 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 saveAPNSIdentifier
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static func saveAPNSIdentifier(_ uniqueIdentifier: Any, completion: @escaping (_ isValid: Bool, _ needsUpdate: Bool, _ oldUUID: String?, _ newUUID: String) -> Void) {
var newUUID: String = ""
var oldUUID: String?
var isValid = false, needsUpdate = 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"