rootstrap/ios-base

View on GitHub

Showing 18 of 22 total issues

Function multipartFormData has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

class func multipartFormData(
_ multipartForm: MultipartFormData,
params: Any,
rootKey: String
) {
Severity: Minor
Found in ios-base/Networking/Services/APIClient.swift - About 2 hrs to fix

Function handleCustomError has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

class func handleCustomError(_ code: Int?, dictionary: [String: Any]) -> NSError? {
if
let messageDict = dictionary["errors"] as? [String: [String]],
let firstKey = messageDict.keys.first
{
Severity: Minor
Found in ios-base/Networking/Services/APIClient.swift - About 1 hr to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    func attachVertically(
    to view: UIView,
    topMargin: CGFloat = UI.Defaults.margin,
    bottomMargin: CGFloat = UI.Defaults.margin
    ) {
    Severity: Major
    Found in ios-base/Extensions/ViewExtension.swift and 1 other location - About 1 hr to fix
    ios-base/Extensions/ViewExtension.swift on lines 68..80

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    func attachHorizontally(
    to view: UIView,
    leadingMargin: CGFloat = UI.Defaults.margin,
    trailingMargin: CGFloat = UI.Defaults.margin
    ) {
    Severity: Major
    Found in ios-base/Extensions/ViewExtension.swift and 1 other location - About 1 hr to fix
    ios-base/Extensions/ViewExtension.swift on lines 82..91

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    func centerHorizontally(
    with view: UIView,
    withOffset offset: CGFloat = 0
    ) {
    centerXAnchor.constraint(
    Severity: Minor
    Found in ios-base/Extensions/ViewExtension.swift and 1 other location - About 35 mins to fix
    ios-base/Extensions/ViewExtension.swift on lines 124..132

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    func centerVertically(
    with view: UIView,
    withOffset offset: CGFloat = 0
    ) {
    centerYAnchor.constraint(
    Severity: Minor
    Found in ios-base/Extensions/ViewExtension.swift and 1 other location - About 35 mins to fix
    ios-base/Extensions/ViewExtension.swift on lines 109..117

    Function validateSerializationErrors has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    fileprivate class func validateSerializationErrors(
    response: HTTPURLResponse,
    error: Error?,
    data: Data,
    success: @escaping SuccessCallback,
    Severity: Minor
    Found in ios-base/Networking/Services/APIClient.swift - About 25 mins to fix

    Line should be 90 characters or less: currently 117 characters
    Open

    try! fileManager.moveItem(at: self, to: URL(fileURLWithPath: newName, relativeTo: deletingLastPathComponent()))
    Severity: Critical
    Found in init.swift by swiftlint

    Force tries should be avoided.
    Open

    try! fileManager.moveItem(at: self, to: URL(fileURLWithPath: newName, relativeTo: deletingLastPathComponent()))
    Severity: Minor
    Found in init.swift by swiftlint

    Prefer shorthand operators (+=, -=, *=, /=) over doing the operation and assigning.
    Open

    left = left + right

    Line should be 90 characters or less: currently 108 characters
    Open

    let result = prompt(message: "\(step.rawValue). " + step.question + " (leave blank for \(defaultValue)).")
    Severity: Critical
    Found in init.swift by swiftlint

    Force unwrapping should be avoided.
    Open

    return answer == nil || answer == "" ? nil : answer!
    Severity: Minor
    Found in init.swift by swiftlint

    Force unwrapping should be avoided.
    Open

    let enumerator = fileManager.enumerator(at: URL(fileURLWithPath: currentFolder), includingPropertiesForKeys: [.nameKey, .isDirectoryKey])!
    Severity: Minor
    Found in init.swift by swiftlint

    Line should be 90 characters or less: currently 96 characters
    Open

    return userDataManager.currentUser != nil && sessionManager.currentSession?.isValid ?? false

    Line should be 90 characters or less: currently 91 characters
    Open

    static let shared = AppNavigator(isLoggedIn: SessionManager.shared.currentSession != nil)

    Line should be 90 characters or less: currently 138 characters
    Open

    let enumerator = fileManager.enumerator(at: URL(fileURLWithPath: currentFolder), includingPropertiesForKeys: [.nameKey, .isDirectoryKey])!
    Severity: Critical
    Found in init.swift by swiftlint

    Line should be 90 characters or less: currently 94 characters
    Open

    let image = MultipartMedia(fileName: "\(email)_image", key: "user[avatar]", data: picData)

    Force tries should be avoided.
    Open

    try! updatedContent.write(to: self, atomically: true, encoding: .utf8)
    Severity: Minor
    Found in init.swift by swiftlint
    Severity
    Category
    Status
    Source
    Language