filestack/filestack-swift

View on GitHub

Showing 70 of 260 total issues

Avoid too many return statements within this function.
Open

            return $0.name
Severity: Major
Found in Sources/FilestackSDK/Public/Models/Transformable.swift - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return operation

      Avoid too many return statements within this function.
      Open

              return tasks.joined(separator: "/")
      Severity: Major
      Found in Sources/FilestackSDK/Public/Models/Transformable.swift - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return "\(mirror.subjectType)(\(components.joined(separator: ", ")))"
        Severity: Major
        Found in Sources/FilestackSDK/Internal/Tools.swift - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                                                 retries: retries - 1) != nil else { return }

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

                public func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Swift.Error?) {
                    guard let result = UserDefaults.backgroundUploadProcess.tasks[task.taskIdentifier] else { return }
            
                    if task.state == .completed, let responseData = transitorySessionData[task] {
                        transitorySessionData.removeValue(forKey: task)

            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 finish has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                func finish(with results: [JSONResponse]) {
                    progressObservers.removeAll()
            
                    // Update state to `completed` unless it is already in `cancelled` state.
                    if state != .cancelled {
            Severity: Minor
            Found in Sources/FilestackSDK/Internal/Uploaders/MultipartUpload.swift - About 25 mins to fix

            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 store has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                @objc
                @discardableResult
                func store(using options: StorageOptions,
                           base64Decode: Bool = false,
                           queue: DispatchQueue? = .main,
            Severity: Minor
            Found in Sources/FilestackSDK/Public/Models/Transformable.swift - About 25 mins to fix

            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 describe has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                static func describe(subject: Any, only: [String]? = nil, except: [String]? = nil) -> String {
                    let mirror = Mirror(reflecting: subject)
            
                    let components: [String] = mirror.children.compactMap {
                        guard let label = $0.label else { return nil }
            Severity: Minor
            Found in Sources/FilestackSDK/Internal/Tools.swift - About 25 mins to fix

            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 testObserversOnCancelledOperation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                func testObserversOnCancelledOperation() throws {
                    let queue = serialOperationQueue()
                    let semaphore = DispatchSemaphore(value: 0)
            
                    let operation = WorkOperation<Bool>() { work in
            Severity: Minor
            Found in Tests/FilestackSDKTests/BaseOperationTests.swift - About 25 mins to fix

            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

            Severity
            Category
            Status
            Source
            Language