filestack/filestack-swift

View on GitHub

Showing 70 of 260 total issues

Function multiPartUpload has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public func multiPartUpload(from localURL: URL,
                                storeOptions: StorageOptions = StorageOptions(location: .s3, access: .private),
                                useIntelligentIngestionIfAvailable: Bool = true,
                                queue: DispatchQueue = .main,
                                startUploadImmediately: Bool = true,
Severity: Major
Found in Sources/FilestackSDK/Public/Extensions/Client+Deprecated.swift - About 50 mins to fix

    Function stubMultipartCompleteRequest has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        func stubMultipartCompleteRequest(requestTime: TimeInterval = 0,
                                          responseTime: TimeInterval = 0,
                                          workflows: [String]? = nil,
                                          uploadTags: [String: String]? = nil) {
            let uploadMultipartCompleteStubConditions = isScheme(Constants.uploadURL.scheme!) &&
    Severity: Minor
    Found in Tests/FilestackSDKTests/UploadTests.swift - About 45 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 upload has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        func upload(data: Data,
                    to url: URL,
                    method: String,
                    headers: [String: String]? = nil,
                    uploadProgress: ((Progress) -> Void)? = nil,
    Severity: Minor
    Found in Sources/FilestackSDK/Internal/Services/UploadService.swift - About 45 mins to fix

      Function buildURL has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          func buildURL(handle: String? = nil,
                        path: String? = nil,
                        extra: String? = nil,
                        queryItems: [URLQueryItem]? = nil,
                        security: Security? = nil) -> URL? {

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

          func doRun() -> Result? {
              stopWatch.signalStart()
      
              for attempt in 1...attempts {
                  guard !shouldCancel else { break }
      Severity: Minor
      Found in Sources/FilestackSDK/Internal/TaskRetrier.swift - About 45 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 uploadMultipleURLs has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          @objc public func uploadMultipleURLs(using localURLs: [NSURL],
                                               options: UploadOptions = .defaults,
                                               queue: DispatchQueue = .main,
                                               uploadProgress: ((Progress) -> Void)? = nil,
                                               completionHandler: @escaping ([JSONResponse]) -> Void) -> Uploader {
      Severity: Minor
      Found in Sources/FilestackSDK/Public/Extensions/Client+ObjC.swift - About 35 mins to fix

        Function uploadData has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            @objc public func uploadData(using data: NSData,
                                         options: UploadOptions = .defaults,
                                         queue: DispatchQueue = .main,
                                         uploadProgress: ((Progress) -> Void)? = nil,
                                         completionHandler: @escaping (JSONResponse) -> Void) -> Uploader {
        Severity: Minor
        Found in Sources/FilestackSDK/Public/Extensions/Client+ObjC.swift - About 35 mins to fix

          Function uploadURL has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              @objc public func uploadURL(using localURL: NSURL,
                                          options: UploadOptions = .defaults,
                                          queue: DispatchQueue = .main,
                                          uploadProgress: ((Progress) -> Void)? = nil,
                                          completionHandler: @escaping (JSONResponse) -> Void) -> Uploader {
          Severity: Minor
          Found in Sources/FilestackSDK/Public/Extensions/Client+ObjC.swift - About 35 mins to fix

            Function upload has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                func upload(using uploadable: Uploadable,
                            options: UploadOptions = .defaults,
                            queue: DispatchQueue = .main,
                            uploadProgress: ((Progress) -> Void)? = nil,
                            completionHandler: @escaping (JSONResponse) -> Void) -> Uploader {
            Severity: Minor
            Found in Sources/FilestackSDK/Public/Models/Client.swift - About 35 mins to fix

              Function uploadMultipleData has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  @objc public func uploadMultipleData(using multipleData: [NSData],
                                                       options: UploadOptions = .defaults,
                                                       queue: DispatchQueue = .main,
                                                       uploadProgress: ((Progress) -> Void)? = nil,
                                                       completionHandler: @escaping ([JSONResponse]) -> Void) -> Uploader {
              Severity: Minor
              Found in Sources/FilestackSDK/Public/Extensions/Client+ObjC.swift - About 35 mins to fix

                Function overwrite has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    @objc func overwrite(parameters: [String: Any]? = nil,
                                         fileURL: URL,
                                         queue: DispatchQueue? = .main,
                                         uploadProgress: ((Progress) -> Void)? = nil,
                                         completionHandler: @escaping (DataResponse) -> Void) {
                Severity: Minor
                Found in Sources/FilestackSDK/Public/Models/FileLink.swift - About 35 mins to fix

                  Function buildURL has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      func buildURL(handle: String? = nil,
                                    path: String? = nil,
                                    extra: String? = nil,
                                    queryItems: [URLQueryItem]? = nil,
                                    security: Security? = nil) -> URL? {

                    Function upload has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        func upload(using uploadables: [Uploadable]? = nil,
                                    options: UploadOptions = .defaults,
                                    queue: DispatchQueue = .main,
                                    uploadProgress: ((Progress) -> Void)? = nil,
                                    completionHandler: @escaping ([JSONResponse]) -> Void) -> Uploader & DeferredAdd {
                    Severity: Minor
                    Found in Sources/FilestackSDK/Public/Models/Client.swift - About 35 mins to fix

                      Function download has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          @objc func download(destinationURL: URL,
                                              parameters: [String: Any]? = nil,
                                              queue: DispatchQueue? = .main,
                                              downloadProgress: ((Progress) -> Void)? = nil,
                                              completionHandler: @escaping (DownloadResponse) -> Void) {
                      Severity: Minor
                      Found in Sources/FilestackSDK/Public/Models/FileLink.swift - About 35 mins to fix

                        Function uploadDataChunk has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            func uploadDataChunk(using response: JSONResponse) {
                                guard !isCancelled else { return }
                        
                                if let apiErrorDescription = error(from: response) {
                                    finish(with: .failure(.api(apiErrorDescription)))

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

                            func toDictionary() -> [String: Any] {
                                var dict = [String: Any]()
                        
                                dict["expiry"] = expiry.timeIntervalSince1970
                        
                        
                        Severity: Minor
                        Found in Sources/FilestackSDK/Public/Models/Policy.swift - About 35 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 asDictionary has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public func asDictionary() -> [String: Any] {
                                var options: [String: Any] = [
                                    "location": location.description.lowercased(),
                                ]
                        
                        
                        Severity: Minor
                        Found in Sources/FilestackSDK/Public/Extensions/StorageOptions+asDictionary.swift - About 35 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 upload has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            func upload() {
                                let uploadURL = URL(string: "multipart/complete", relativeTo: Constants.uploadURL)!
                                let headers = ["Content-Type": "application/json"]
                        
                                retrier = .init(attempts: Defaults.maxRetries, label: uploadURL.relativePath) { (semaphore) -> JSONResponse? in
                        Severity: Minor
                        Found in Sources/FilestackSDK/Internal/Operations/CompleteUploadOperation.swift - About 35 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 uploadDataChunk has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            func uploadDataChunk(using response: JSONResponse) {
                                guard !isCancelled else { return }
                        
                                if let apiErrorDescription = error(from: response) {
                                    finish(with: .failure(.api(apiErrorDescription)))

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

                            func upload() {
                                let uploadURL = URL(string: "multipart/commit", relativeTo: Constants.uploadURL)!
                        
                                retrier = .init(attempts: Defaults.maxRetries, label: uploadURL.relativePath) { (semaphore) -> HTTPURLResponse? in
                                    var httpURLResponse: HTTPURLResponse?
                        Severity: Minor
                        Found in Sources/FilestackSDK/Internal/Operations/CommitPartUploadOperation.swift - About 35 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