filestack/filestack-swift

View on GitHub

Showing 260 of 260 total issues

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

        observers.append(operation.observe(\.isExecuting, options: [.new]) { (operation, change) in
            if change.newValue == true {
                isExecutingExpectation.fulfill()
            }
        })
Severity: Major
Found in Tests/FilestackSDKTests/BaseOperationTests.swift and 4 other locations - About 40 mins to fix
Tests/FilestackSDKTests/BaseOperationTests.swift on lines 151..155
Tests/FilestackSDKTests/BaseOperationTests.swift on lines 157..161
Tests/FilestackSDKTests/BaseOperationTests.swift on lines 185..189
Tests/FilestackSDKTests/BaseOperationTests.swift on lines 191..195

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

        switch operation.result {
        case .success(_):
            XCTFail()
        case let .failure(error):
            XCTAssertEqual(error.localizedDescription, Error.cancelled.localizedDescription)
Severity: Minor
Found in Tests/FilestackSDKTests/BaseOperationTests.swift and 1 other location - About 40 mins to fix
Tests/FilestackSDKTests/BaseOperationTests.swift on lines 122..127

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

        switch operation.result {
        case .success(_):
            XCTFail()
        case let .failure(error):
            XCTAssertEqual(error.localizedDescription, Error.cancelled.localizedDescription)
Severity: Minor
Found in Tests/FilestackSDKTests/BaseOperationTests.swift and 1 other location - About 40 mins to fix
Tests/FilestackSDKTests/BaseOperationTests.swift on lines 102..107

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

        observers.append(operation.observe(\.isFinished, options: [.new]) { (operation, change) in
            if change.newValue == true {
                isFinishedExpectation.fulfill()
            }
        })
Severity: Major
Found in Tests/FilestackSDKTests/BaseOperationTests.swift and 4 other locations - About 40 mins to fix
Tests/FilestackSDKTests/BaseOperationTests.swift on lines 145..149
Tests/FilestackSDKTests/BaseOperationTests.swift on lines 157..161
Tests/FilestackSDKTests/BaseOperationTests.swift on lines 185..189
Tests/FilestackSDKTests/BaseOperationTests.swift on lines 191..195

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

        observers.append(operation.observe(\.isExecuting, options: [.new]) { (operation, change) in
            if change.newValue == true {
                isExecutingExpectation.fulfill()
            }
        })
Severity: Major
Found in Tests/FilestackSDKTests/BaseOperationTests.swift and 4 other locations - About 40 mins to fix
Tests/FilestackSDKTests/BaseOperationTests.swift on lines 145..149
Tests/FilestackSDKTests/BaseOperationTests.swift on lines 151..155
Tests/FilestackSDKTests/BaseOperationTests.swift on lines 157..161
Tests/FilestackSDKTests/BaseOperationTests.swift on lines 191..195

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

        if let response = retrier?.run() {
            finish(with: .success(response))
        } else {
            finish(with: .failure(.custom("Unable to complete /multipart/commit operation.")))
        }
Sources/FilestackSDK/Internal/Operations/CompleteUploadOperation.swift on lines 74..78

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

        if let response = retrier?.run() {
            finish(with: .success(response))
        } else {
            finish(with: .failure(.custom("Failed to complete /multipart/complete operation.")))
        }
Sources/FilestackSDK/Internal/Operations/CommitPartUploadOperation.swift on lines 74..78

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

        observers.append(operation.observe(\.isFinished, options: [.new]) { (operation, change) in
            if change.newValue == true {
                isFinishedExpectation.fulfill()
            }
        })
Severity: Major
Found in Tests/FilestackSDKTests/BaseOperationTests.swift and 4 other locations - About 40 mins to fix
Tests/FilestackSDKTests/BaseOperationTests.swift on lines 145..149
Tests/FilestackSDKTests/BaseOperationTests.swift on lines 151..155
Tests/FilestackSDKTests/BaseOperationTests.swift on lines 157..161
Tests/FilestackSDKTests/BaseOperationTests.swift on lines 185..189

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

        observers.append(operation.observe(\.isCancelled, options: [.new]) { (operation, change) in
            if change.newValue == true {
                isCancelledExpectation.fulfill()
            }
        })
Severity: Major
Found in Tests/FilestackSDKTests/BaseOperationTests.swift and 4 other locations - About 40 mins to fix
Tests/FilestackSDKTests/BaseOperationTests.swift on lines 145..149
Tests/FilestackSDKTests/BaseOperationTests.swift on lines 151..155
Tests/FilestackSDKTests/BaseOperationTests.swift on lines 185..189
Tests/FilestackSDKTests/BaseOperationTests.swift on lines 191..195

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 3 locations. Consider refactoring.
Open

        transformable.add(transform: ShadowTransform()
            .blur(10)
            .opacity(35)
            .vector(x: 30, y: 30)
            .color(.black)
Severity: Minor
Found in Tests/FilestackSDKTests/TransformableTests.swift and 2 other locations - About 40 mins to fix
Tests/FilestackSDKTests/TransformableTests.swift on lines 1098..1122
Tests/FilestackSDKTests/TransformableTests.swift on lines 1225..1249

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 49.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

        let downloadProgress: ((Progress) -> Void) = { progress in
            if progress.fractionCompleted == 1.0 {
                progressExpectation.fulfill()
            }
        }
Severity: Minor
Found in Tests/FilestackSDKTests/FileLinkTests.swift and 1 other location - About 40 mins to fix
Tests/FilestackSDKTests/FileLinkTests.swift on lines 388..392

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 49.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

        let downloadProgress: ((Progress) -> Void) = { progress in
            if progress.fractionCompleted == 1.0 {
                progressExpectation.fulfill()
            }
        }
Severity: Minor
Found in Tests/FilestackSDKTests/FileLinkTests.swift and 1 other location - About 40 mins to fix
Tests/FilestackSDKTests/FileLinkTests.swift on lines 209..213

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 49.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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 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 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 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 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 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 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
                  Severity
                  Category
                  Status
                  Source
                  Language