Showing 70 of 260 total issues
File TransformableTests.swift
has 1267 lines of code (exceeds 250 allowed). Consider refactoring. Open
import OHHTTPStubs
import OHHTTPStubsSwift
import XCTest
@testable import FilestackSDK
TransformableTests
has 117 methods (exceeds 20 allowed). Consider refactoring. Open
class TransformableTests: XCTestCase {
private let processStubConditions = isScheme(Constants.cdnURL.scheme!) && isHost(Constants.cdnURL.host!)
private let client = Client(apiKey: "My-API-KEY")
private var transformable: Transformable!
File FileLinkTests.swift
has 496 lines of code (exceeds 250 allowed). Consider refactoring. Open
import OHHTTPStubs
import OHHTTPStubsSwift
import XCTest
@testable import FilestackSDK
File UploadTests.swift
has 431 lines of code (exceeds 250 allowed). Consider refactoring. Open
import OHHTTPStubs
import OHHTTPStubsSwift
import XCTest
@testable import FilestackSDK
Function submitChunk
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
func submitChunk(chunkOffset: UInt64, chunkSize: Int, retries: Int = Defaults.maxRetries) -> SubmitChunkUploadOperation? {
guard !isCancelled else { return nil }
guard retries > 0 else {
finish(with: .failure(.custom("Exceeded max retries trying to submit data chunk.")))
- 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 testChainedTransformationsURLWithExternalURL
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
func testChainedTransformationsURLWithExternalURL() {
let security = Seeds.Securities.basic
let client = Client(apiKey: "MY-API-KEY", security: security)
let transformable = client.transformable(externalURL: URL(string: "https://SOME-EXTERNAL-URL/photo.jpg")!)
Function testChainedTransformationsURL
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
func testChainedTransformationsURL() {
let security = Seeds.Securities.basic
let client = Client(apiKey: "MY-API-KEY", security: security)
let transformable = client.transformable(handle: "MY-HANDLE")
FileLinkTests
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class FileLinkTests: XCTestCase {
private let cdnStubConditions = isScheme(Constants.cdnURL.scheme!) && isHost(Constants.cdnURL.host!)
private let apiStubConditions = isScheme(Constants.apiURL.scheme!) && isHost(Constants.apiURL.host!)
private let downloadsDirectoryURL = try! FileManager.default.url(for: .downloadsDirectory,
Function enqueue
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
func enqueue(operations: [SubmitPartUploadOperation]) {
var partsAndEtags: [Int: String] = [:]
var completeCount = 0
- 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 tasksToURLFragment
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
func tasksToURLFragment() -> String {
let tasks: [String] = transformationTasks.map {
if let options = $0.options {
let params: [String] = options.map {
switch $0.value {
- 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 download
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
@objc func download(destinationURL: URL,
parameters: [String: Any]? = nil,
queue: DispatchQueue? = .main,
downloadProgress: ((Progress) -> Void)? = nil,
completionHandler: @escaping (DownloadResponse) -> Void) {
Function testStoreImageTransformation
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
func testStoreImageTransformation() {
stub(condition: processStubConditions) { _ in
let json: [String: Any] = [
"container": "filestack-web-demo",
Function testVideoConvertTransformationURL
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
func testVideoConvertTransformationURL() {
transformable.add(transform: AVTransform()
.preset("h264")
.force(false)
.width(1080)
Function upload
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
func upload() {
guard let uploadables = uploadables else { return }
config.currentUploaders.append(self)
state = .inProgress
Function testGetMetadata
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
func testGetMetadata() {
stub(condition: cdnStubConditions) { _ in
let headers = ["Content-Type": "application/json"]
let returnedJSON: [String: Any] = [
Function testDownloadExistingContent
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
func testDownloadExistingContent() {
stub(condition: cdnStubConditions) { _ in
let stubPath = Helpers.url(forResource: "sample", withExtension: "jpg", subdirectory: "Fixtures")!.path
let httpHeaders: [AnyHashable: Any] = [
Function upload
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
func upload() {
// Step 1) Execute start operation
executeStartOperation { (result) in
switch result {
case let .success(descriptor):
- 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 submitChunk
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
func submitChunk(chunkOffset: UInt64, chunkSize: Int, retries: Int = Defaults.maxRetries) -> SubmitChunkUploadOperation? {
guard !isCancelled else { return nil }
guard retries > 0 else {
finish(with: .failure(.custom("Exceeded max retries trying to submit data chunk.")))
Function testMultiPartUploadWithWorkflowsAndUploadTags
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
func testMultiPartUploadWithWorkflowsAndUploadTags() {
var hitCount = 0
let workflows = ["workflow-1", "workflow-2", "workflow-3"]
let uploadTags = ["key1": "value1", "key2": "value2"]
let storeOptions = StorageOptions(location: .s3, workflows: workflows)
Function store
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
@objc
@discardableResult
func store(using options: StorageOptions,
base64Decode: Bool = false,
queue: DispatchQueue? = .main,