Showing 26 of 41 total issues
Function presentAppStore
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static func presentAppStore(animated: Bool = true,
appStoreId: String?,
appStoreURL: URL?,
delegate: SKStoreProductViewControllerDelegate,
presentingViewController: UIViewController) {
Function fetchSettings
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private func fetchSettings(configurationURL: URL, defaults: ConfigurationResult) -> ConfigurationServiceResult {
guard let configurationData = try? Data(contentsOf: configurationURL) else {
return .failure(.networking)
}
let parsingResult = parsingService.parse(configurationData)
- 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 checkForUpdates
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
func checkForUpdates(completion: @escaping (UpdatesResult) -> Void) {
DispatchQueue.global(qos: .background).async {
self.appMetadataService.fetchAppMetadata { result in
switch result {
case .success(let apiResult):
- 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 .success(result)
Avoid too many return
statements within this function. Open
return willNotify ? .available(update) : .none(isAppUpdated)
Function parse
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func parse(_ data: Data) -> Result<ITunesSearchAPIResult, ParsingError> {
guard !data.isEmpty else {
return .failure(.emptyPayload)
}
let decoder = JSONDecoder()
- 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"