Kinvey/swift-sdk

View on GitHub
Kinvey/Kinvey/FileStore.swift

Summary

Maintainability
F
2 wks
Test Coverage

File FileStore.swift has 1185 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import Foundation
import PromiseKit

#if os(macOS)
    import AppKit
Severity: Major
Found in Kinvey/Kinvey/FileStore.swift - About 3 days to fix

    Function createBucket has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
    Open

        fileprivate func createBucket<ResultType>(
            _ file: FileType,
            fromSource source: InputSource,
            options: Options?,
            requests: MultiRequest<ResultType>
    Severity: Minor
    Found in Kinvey/Kinvey/FileStore.swift - About 1 day 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

    FileStore has 44 methods (exceeds 20 allowed). Consider refactoring.
    Open

    open class FileStore<FileType: File> {
        
        @available(*, deprecated, message: "Deprecated in version 3.17.0. Please use Result<FileType, Swift.Error> instead")
        public typealias FileCompletionHandler = (FileType?, Swift.Error?) -> Void
        
    Severity: Minor
    Found in Kinvey/Kinvey/FileStore.swift - About 6 hrs to fix

      Function upload has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

          fileprivate func upload<ResultType>(
              _ file: FileType,
              fromSource source: InputSource,
              skip: Int?,
              options: Options?,
      Severity: Minor
      Found in Kinvey/Kinvey/FileStore.swift - About 4 hrs 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 downloadFileURL has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

          @discardableResult
          fileprivate func downloadFileURL(
              _ file: FileType,
              storeType: StoreType,
              downloadURL: URL,
      Severity: Minor
      Found in Kinvey/Kinvey/FileStore.swift - About 4 hrs 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 createBucket has 95 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          fileprivate func createBucket<ResultType>(
              _ file: FileType,
              fromSource source: InputSource,
              options: Options?,
              requests: MultiRequest<ResultType>
      Severity: Major
      Found in Kinvey/Kinvey/FileStore.swift - About 3 hrs to fix

        Function download has 89 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @discardableResult
            open func download(
                file: FileType,
                storeType: StoreType,
                options: Options? = nil,
        Severity: Major
        Found in Kinvey/Kinvey/FileStore.swift - About 3 hrs to fix

          Function download has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

              @discardableResult
              open func download(
                  file: FileType,
                  storeType: StoreType,
                  options: Options? = nil,
          Severity: Minor
          Found in Kinvey/Kinvey/FileStore.swift - About 3 hrs 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 78 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              fileprivate func upload<ResultType>(
                  _ file: FileType,
                  fromSource source: InputSource,
                  skip: Int?,
                  options: Options?,
          Severity: Major
          Found in Kinvey/Kinvey/FileStore.swift - About 3 hrs to fix

            Function download has 74 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @discardableResult
                open func download(
                    _ file: FileType,
                    options: Options? = nil,
                    completionHandler: ((Swift.Result<(FileType, Data), Swift.Error>) -> Void)? = nil
            Severity: Major
            Found in Kinvey/Kinvey/FileStore.swift - About 2 hrs to fix

              Function downloadFileURL has 62 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  @discardableResult
                  fileprivate func downloadFileURL(
                      _ file: FileType,
                      storeType: StoreType,
                      downloadURL: URL,
              Severity: Major
              Found in Kinvey/Kinvey/FileStore.swift - About 2 hrs to fix

                Function download has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    @discardableResult
                    open func download(
                        _ file: FileType,
                        options: Options? = nil,
                        completionHandler: ((Swift.Result<(FileType, Data), Swift.Error>) -> Void)? = nil
                Severity: Minor
                Found in Kinvey/Kinvey/FileStore.swift - About 2 hrs 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 find has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    @discardableResult
                    open func find(
                        _ query: Query = Query(),
                        options: Options? = nil,
                        completionHandler: ((Swift.Result<[FileType], Swift.Error>) -> Void)? = nil
                Severity: Minor
                Found in Kinvey/Kinvey/FileStore.swift - About 1 hr to fix

                  Function getFileMetadata has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      fileprivate func getFileMetadata<ResultType>(
                          _ file: FileType,
                          options: Options?,
                          requests: MultiRequest<ResultType>?
                      ) -> (request: AnyRequest<Swift.Result<FileType, Swift.Error>>, promise: Promise<FileType>) {
                  Severity: Minor
                  Found in Kinvey/Kinvey/FileStore.swift - About 1 hr 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 find has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      @discardableResult
                      open func find(
                          _ query: Query = Query(),
                          options: Options? = nil,
                          completionHandler: ((Swift.Result<[FileType], Swift.Error>) -> Void)? = nil
                  Severity: Minor
                  Found in Kinvey/Kinvey/FileStore.swift - About 1 hr 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 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      fileprivate func upload(
                          _ file: FileType,
                          fromSource source: InputSource,
                          options: Options?,
                          completionHandler: ((Swift.Result<FileType, Swift.Error>) -> Void)? = nil
                  Severity: Minor
                  Found in Kinvey/Kinvey/FileStore.swift - About 1 hr to fix

                    Function getFileMetadata has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        fileprivate func getFileMetadata<ResultType>(
                            _ file: FileType,
                            options: Options?,
                            requests: MultiRequest<ResultType>?
                        ) -> (request: AnyRequest<Swift.Result<FileType, Swift.Error>>, promise: Promise<FileType>) {
                    Severity: Minor
                    Found in Kinvey/Kinvey/FileStore.swift - About 1 hr to fix

                      Function remove has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          @discardableResult
                          open func remove(
                              _ file: FileType,
                              options: Options? = nil,
                              completionHandler: ((Swift.Result<UInt, Swift.Error>) -> Void)? = nil
                      Severity: Minor
                      Found in Kinvey/Kinvey/FileStore.swift - About 1 hr to fix

                        Function remove has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            @discardableResult
                            open func remove(
                                _ file: FileType,
                                options: Options? = nil,
                                completionHandler: ((Swift.Result<UInt, Swift.Error>) -> Void)? = nil
                        Severity: Minor
                        Found in Kinvey/Kinvey/FileStore.swift - About 55 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 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                _ file: FileType,
                                image: UIImage,
                                imageRepresentation: ImageRepresentation = .png,
                                ttl: TTL? = nil,
                                completionHandler: ((Swift.Result<FileType, Swift.Error>) -> Void)? = nil
                        Severity: Minor
                        Found in Kinvey/Kinvey/FileStore.swift - About 35 mins to fix

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

                                  _ file: FileType,
                                  image: UIImage,
                                  imageRepresentation: ImageRepresentation = .png,
                                  ttl: TTL? = nil,
                                  completionHandler: FileCompletionHandler? = nil
                          Severity: Minor
                          Found in Kinvey/Kinvey/FileStore.swift - About 35 mins to fix

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

                                    _ file: FileType,
                                    image: UIImage,
                                    imageRepresentation: ImageRepresentation = .png,
                                    options: Options? = nil,
                                    completionHandler: ((Swift.Result<FileType, Swift.Error>) -> Void)? = nil
                            Severity: Minor
                            Found in Kinvey/Kinvey/FileStore.swift - About 35 mins to fix

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

                                      _ file: FileType,
                                      image: NSImage,
                                      imageRepresentation: ImageRepresentation = .png,
                                      options: Options? = nil,
                                      completionHandler: ((Swift.Result<FileType, Swift.Error>) -> Void)? = nil
                              Severity: Minor
                              Found in Kinvey/Kinvey/FileStore.swift - About 35 mins to fix

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

                                        _ file: FileType,
                                        image: NSImage,
                                        imageRepresentation: ImageRepresentation = .png,
                                        ttl: TTL? = nil,
                                        completionHandler: FileCompletionHandler? = nil
                                Severity: Minor
                                Found in Kinvey/Kinvey/FileStore.swift - About 35 mins to fix

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

                                          _ file: FileType,
                                          image: NSImage,
                                          imageRepresentation: ImageRepresentation = .png,
                                          ttl: TTL? = nil,
                                          completionHandler: ((Swift.Result<FileType, Swift.Error>) -> Void)? = nil
                                  Severity: Minor
                                  Found in Kinvey/Kinvey/FileStore.swift - About 35 mins to fix

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

                                            _ file: FileType,
                                            fromSource source: InputSource,
                                            skip: Int?,
                                            options: Options?,
                                            requests: MultiRequest<ResultType>
                                    Severity: Minor
                                    Found in Kinvey/Kinvey/FileStore.swift - About 35 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                                          return Promise(error: error)
                                      Severity: Major
                                      Found in Kinvey/Kinvey/FileStore.swift - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                                            return Promise(Guarantee { seal in
                                                                seal((cachedFile, pathURL))
                                                            })
                                        Severity: Major
                                        Found in Kinvey/Kinvey/FileStore.swift - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                                      return AnyRequest(multiRequest)
                                          Severity: Major
                                          Found in Kinvey/Kinvey/FileStore.swift - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                    return AnyRequest(multiRequest)
                                            Severity: Major
                                            Found in Kinvey/Kinvey/FileStore.swift - About 30 mins to fix

                                              Avoid too many return statements within this function.
                                              Open

                                                          return AnyRequest(LocalRequest(result))
                                              Severity: Major
                                              Found in Kinvey/Kinvey/FileStore.swift - About 30 mins to fix

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

                                                    @discardableResult
                                                    open func upload(
                                                        _ file: FileType,
                                                        image: UIImage,
                                                        imageRepresentation: ImageRepresentation = .png,
                                                Severity: Major
                                                Found in Kinvey/Kinvey/FileStore.swift and 1 other location - About 2 hrs to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 142..158

                                                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 146.

                                                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

                                                    @discardableResult
                                                    open func upload(
                                                        _ file: FileType,
                                                        image: NSImage,
                                                        imageRepresentation: ImageRepresentation = .png,
                                                Severity: Major
                                                Found in Kinvey/Kinvey/FileStore.swift and 1 other location - About 2 hrs to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 202..218

                                                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 146.

                                                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

                                                    @discardableResult
                                                    @available(*, deprecated, message: "Deprecated in version 3.17.0. Please use FileStore.upload(_:image:imageRepresentation:options:completionHandler:) instead")
                                                    open func upload(
                                                        _ file: FileType,
                                                        image: UIImage,
                                                Severity: Major
                                                Found in Kinvey/Kinvey/FileStore.swift and 1 other location - About 2 hrs to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 123..139

                                                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 132.

                                                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

                                                    @discardableResult
                                                    @available(*, deprecated, message: "Deprecated in version 3.18.0. Please use FileStore.upload(_:image:imageRepresentation:options:completionHandler:) instead")
                                                    open func upload(
                                                        _ file: FileType,
                                                        image: NSImage,
                                                Severity: Major
                                                Found in Kinvey/Kinvey/FileStore.swift and 1 other location - About 2 hrs to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 183..199

                                                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 132.

                                                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

                                                    @available(*, deprecated, message: "Deprecated in version 3.17.0. Please use FileStore.upload(_:image:imageRepresentation:options:completionHandler:) instead")
                                                    @discardableResult
                                                    open func upload(
                                                        _ file: FileType,
                                                        image: NSImage,
                                                Severity: Major
                                                Found in Kinvey/Kinvey/FileStore.swift and 1 other location - About 2 hrs to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 163..180

                                                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 130.

                                                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

                                                    @discardableResult
                                                    @available(*, deprecated, message: "Deprecated in version 3.17.0. Please use FileStore.upload(_:image:imageRepresentation:options:completionHandler:) instead")
                                                    open func upload(
                                                        _ file: FileType,
                                                        image: UIImage,
                                                Severity: Major
                                                Found in Kinvey/Kinvey/FileStore.swift and 1 other location - About 2 hrs to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 103..120

                                                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 130.

                                                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 3 locations. Consider refactoring.
                                                Open

                                                    @discardableResult
                                                    @available(*, deprecated, message: "Deprecated in version 3.17.0. Please use FileStore.upload(_:stream:options:completionHandler:) instead")
                                                    open func upload(
                                                        _ file: FileType,
                                                        stream: InputStream,
                                                Severity: Major
                                                Found in Kinvey/Kinvey/FileStore.swift and 2 other locations - About 1 hr to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 241..255
                                                Kinvey/Kinvey/FileStore.swift on lines 380..394

                                                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 120.

                                                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 3 locations. Consider refactoring.
                                                Open

                                                    @discardableResult
                                                    @available(*, deprecated, message: "Deprecated in version 3.17.0. Please use FileStore.upload(_:path:options:completionHandler:) instead")
                                                    open func upload(
                                                        _ file: FileType,
                                                        path: String,
                                                Severity: Major
                                                Found in Kinvey/Kinvey/FileStore.swift and 2 other locations - About 1 hr to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 292..306
                                                Kinvey/Kinvey/FileStore.swift on lines 380..394

                                                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 120.

                                                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 3 locations. Consider refactoring.
                                                Open

                                                    @discardableResult
                                                    @available(*, deprecated, message: "Deprecated in version 3.17.0. Please use FileStore.upload(_:data:options:completionHandler:) instead")
                                                    open func upload(
                                                        _ file: FileType,
                                                        data: Data,
                                                Severity: Major
                                                Found in Kinvey/Kinvey/FileStore.swift and 2 other locations - About 1 hr to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 241..255
                                                Kinvey/Kinvey/FileStore.swift on lines 292..306

                                                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 120.

                                                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 3 locations. Consider refactoring.
                                                Open

                                                    @discardableResult
                                                    @available(*, deprecated, message: "Deprecated in version 3.17.0. Please use FileStore.upload(_:stream:options:completionHandler:) instead")
                                                    open func upload(
                                                        _ file: FileType,
                                                        stream: InputStream,
                                                Severity: Major
                                                Found in Kinvey/Kinvey/FileStore.swift and 2 other locations - About 1 hr to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 223..238
                                                Kinvey/Kinvey/FileStore.swift on lines 362..377

                                                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 118.

                                                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 3 locations. Consider refactoring.
                                                Open

                                                    @discardableResult
                                                    @available(*, deprecated, message: "Deprecated in version 3.17.0. Please use FileStore.upload(_:path:options:completionHandler:) instead")
                                                    open func upload(
                                                        _ file: FileType,
                                                        path: String,
                                                Severity: Major
                                                Found in Kinvey/Kinvey/FileStore.swift and 2 other locations - About 1 hr to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 274..289
                                                Kinvey/Kinvey/FileStore.swift on lines 362..377

                                                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 118.

                                                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 3 locations. Consider refactoring.
                                                Open

                                                    @discardableResult
                                                    @available(*, deprecated, message: "Deprecated in version 3.17.0. Please use FileStore.upload(_:data:options:completionHandler:) instead")
                                                    open func upload(
                                                        _ file: FileType,
                                                        data: Data,
                                                Severity: Major
                                                Found in Kinvey/Kinvey/FileStore.swift and 2 other locations - About 1 hr to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 223..238
                                                Kinvey/Kinvey/FileStore.swift on lines 274..289

                                                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 118.

                                                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

                                                    @discardableResult
                                                    open func upload(
                                                        _ file: FileType,
                                                        data: Data,
                                                        options: Options? = nil,
                                                Severity: Major
                                                Found in Kinvey/Kinvey/FileStore.swift and 1 other location - About 1 hr to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 309..322

                                                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 117.

                                                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

                                                    @discardableResult
                                                    open func upload(
                                                        _ file: FileType,
                                                        stream: InputStream,
                                                        options: Options? = nil,
                                                Severity: Major
                                                Found in Kinvey/Kinvey/FileStore.swift and 1 other location - About 1 hr to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 397..410

                                                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 117.

                                                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

                                                    @discardableResult
                                                    @available(*, deprecated, message: "Deprecated in version 3.17.0. Please use FileStore.download(_:storeType:options:completionHandler:) instead")
                                                    open func download(
                                                        _ file: FileType,
                                                        storeType: StoreType = .cache,
                                                Severity: Major
                                                Found in Kinvey/Kinvey/FileStore.swift and 1 other location - About 1 hr to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 944..958

                                                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 110.

                                                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

                                                    @available(*, deprecated, message: "Deprecated in version 3.21.0. Please use `download(file:storeType:options:completionHandler:)` instead")
                                                    @discardableResult
                                                    open func download(
                                                        _ file: FileType,
                                                        storeType: StoreType = .cache,
                                                Severity: Major
                                                Found in Kinvey/Kinvey/FileStore.swift and 1 other location - About 1 hr to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 927..941

                                                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 110.

                                                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

                                                    @discardableResult
                                                    open func download(
                                                        _ file: FileType,
                                                        options: Options? = nil,
                                                        completionHandler: ((Swift.Result<(FileType, Data), Swift.Error>) -> Void)? = nil
                                                Severity: Major
                                                Found in Kinvey/Kinvey/FileStore.swift and 1 other location - About 1 hr to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 1086..1098

                                                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 101.

                                                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

                                                    @discardableResult
                                                    @available(*, deprecated, message: "Deprecated in version 3.17.0. Please use FileStore.download(_:options:completionHandler:) instead")
                                                    open func download(
                                                        _ file: FileType,
                                                        ttl: TTL? = nil,
                                                Severity: Major
                                                Found in Kinvey/Kinvey/FileStore.swift and 1 other location - About 1 hr to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 1101..1183

                                                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 101.

                                                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 3 locations. Consider refactoring.
                                                Open

                                                    @discardableResult
                                                    @available(*, deprecated, message: "Deprecated in version 3.17.0. Please use FileStore.find(_:options:completionHandler:) instead")
                                                    open func find(
                                                        _ query: Query = Query(),
                                                        ttl: TTL? = nil,
                                                Severity: Major
                                                Found in Kinvey/Kinvey/FileStore.swift and 2 other locations - About 1 hr to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 1282..1333
                                                Kinvey/Kinvey/User.swift on lines 825..855

                                                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 87.

                                                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 3 locations. Consider refactoring.
                                                Open

                                                    @discardableResult
                                                    open func find(
                                                        _ query: Query = Query(),
                                                        options: Options? = nil,
                                                        completionHandler: ((Swift.Result<[FileType], Swift.Error>) -> Void)? = nil
                                                Severity: Major
                                                Found in Kinvey/Kinvey/FileStore.swift and 2 other locations - About 1 hr to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 1267..1279
                                                Kinvey/Kinvey/User.swift on lines 825..855

                                                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 87.

                                                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

                                                            Promise<(FileType, URL)> { resolver in
                                                                if let downloadURL = file.downloadURL,
                                                                    file.publicAccessible ||
                                                                    (
                                                                        file.expiresAt != nil &&
                                                Severity: Major
                                                Found in Kinvey/Kinvey/FileStore.swift and 1 other location - About 1 hr to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 996..1052

                                                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 70.

                                                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

                                                    @discardableResult
                                                    @available(*, deprecated, message: "Deprecated in version 3.17.0. Please use FileStore.remove(_:options:completionHandler:) instead")
                                                    open func remove(
                                                        _ file: FileType,
                                                        completionHandler: ((Swift.Result<UInt, Swift.Error>) -> Void)? = nil
                                                Severity: Minor
                                                Found in Kinvey/Kinvey/FileStore.swift and 1 other location - About 1 hr to fix
                                                Kinvey/Kinvey/User.swift on lines 605..616

                                                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 68.

                                                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

                                                //
                                                //  FileStore.swift
                                                //  Kinvey
                                                //
                                                //  Created by Victor Barros on 2016-02-04.
                                                Severity: Minor
                                                Found in Kinvey/Kinvey/FileStore.swift and 1 other location - About 50 mins to fix
                                                Kinvey/Kinvey/Push.swift on lines 1..386

                                                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 59.

                                                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

                                                        createBucket(
                                                            file,
                                                            fromSource: source,
                                                            options: options,
                                                            requests: requests
                                                Severity: Minor
                                                Found in Kinvey/Kinvey/FileStore.swift and 1 other location - About 40 mins to fix
                                                Kinvey/Kinvey/User.swift on lines 152..176

                                                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 52.

                                                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 = response, response.isOK,
                                                                    let data = data,
                                                                    let json = try? self.client.jsonParser.parseDictionary(from: data),
                                                                    let count = json["count"] as? UInt
                                                                {
                                                Severity: Minor
                                                Found in Kinvey/Kinvey/FileStore.swift and 1 other location - About 40 mins to fix
                                                Kinvey/Kinvey/RemoveOperation.swift on lines 71..81

                                                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 50.

                                                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

                                                        createBucket(
                                                            file,
                                                            fromSource: .data(data),
                                                            options: options,
                                                            requests: requests
                                                Severity: Minor
                                                Found in Kinvey/Kinvey/FileStore.swift and 2 other locations - About 40 mins to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 453..466
                                                Kinvey/Kinvey/FileStore.swift on lines 478..492

                                                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 3 locations. Consider refactoring.
                                                Open

                                                        createBucket(
                                                            file,
                                                            fromSource: .url(URL(fileURLWithPath: (path as NSString).expandingTildeInPath)),
                                                            options: options,
                                                            requests: requests
                                                Severity: Minor
                                                Found in Kinvey/Kinvey/FileStore.swift and 2 other locations - About 40 mins to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 428..441
                                                Kinvey/Kinvey/FileStore.swift on lines 478..492

                                                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 3 locations. Consider refactoring.
                                                Open

                                                        createBucket(
                                                            file,
                                                            fromSource: .stream(stream),
                                                            options: options,
                                                            requests: requests
                                                Severity: Minor
                                                Found in Kinvey/Kinvey/FileStore.swift and 2 other locations - About 40 mins to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 428..441
                                                Kinvey/Kinvey/FileStore.swift on lines 453..466

                                                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

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

                                                                let result: Swift.Result<(FileType, URL), Swift.Error> = .success((cachedFile, pathURL))
                                                Severity: Minor
                                                Found in Kinvey/Kinvey/FileStore.swift and 1 other location - About 40 mins to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 1174..1174

                                                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 48.

                                                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

                                                            let result: Swift.Result<(FileType, Data), Swift.Error> = .success((file, data))
                                                Severity: Minor
                                                Found in Kinvey/Kinvey/FileStore.swift and 1 other location - About 40 mins to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 980..980

                                                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 48.

                                                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

                                                                let uploadTask = urlSession.uploadTask(with: request, from: uploadData) { (data, response, error) -> Void in
                                                                    handler(data, response, error)
                                                                }
                                                Severity: Minor
                                                Found in Kinvey/Kinvey/FileStore.swift and 1 other location - About 35 mins to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 678..680

                                                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 46.

                                                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

                                                                let uploadTask = urlSession.uploadTask(with: request, fromFile: url) { (data, response, error) -> Void in
                                                                    handler(data, response, error)
                                                                }
                                                Severity: Minor
                                                Found in Kinvey/Kinvey/FileStore.swift and 1 other location - About 35 mins to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 664..666

                                                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 46.

                                                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

                                                        return download(
                                                            file,
                                                            ttl: ttl
                                                        ) { (result: Swift.Result<(FileType, Data), Swift.Error>) in
                                                            result.into(completionHandler: completionHandler)
                                                Severity: Minor
                                                Found in Kinvey/Kinvey/FileStore.swift and 1 other location - About 35 mins to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 917..923

                                                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 44.

                                                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

                                                        return download(
                                                            file,
                                                            storeType: storeType,
                                                            ttl: ttl
                                                        ) { (result: Swift.Result<(FileType, URL), Swift.Error>) in
                                                Severity: Minor
                                                Found in Kinvey/Kinvey/FileStore.swift and 1 other location - About 35 mins to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 1070..1075

                                                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 44.

                                                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

                                                                    if let downloadURL = file.downloadURL,
                                                                        file.publicAccessible ||
                                                                        (
                                                                            file.expiresAt != nil &&
                                                                            file.expiresAt!.timeIntervalSinceNow > 0
                                                Severity: Minor
                                                Found in Kinvey/Kinvey/FileStore.swift and 2 other locations - About 35 mins to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 997..1020
                                                Kinvey/Kinvey/FileStore.swift on lines 1125..1154

                                                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 43.

                                                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

                                                                if let downloadURL = file.downloadURL,
                                                                    file.publicAccessible ||
                                                                    (
                                                                        file.expiresAt != nil &&
                                                                        file.expiresAt!.timeIntervalSinceNow > 0
                                                Severity: Minor
                                                Found in Kinvey/Kinvey/FileStore.swift and 2 other locations - About 35 mins to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 1125..1154
                                                Kinvey/Kinvey/FileStore.swift on lines 1140..1150

                                                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 43.

                                                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

                                                            if let downloadURL = file.downloadURL,
                                                                file.publicAccessible ||
                                                                (
                                                                    file.expiresAt != nil &&
                                                                    file.expiresAt!.timeIntervalSinceNow > 0
                                                Severity: Minor
                                                Found in Kinvey/Kinvey/FileStore.swift and 2 other locations - About 35 mins to fix
                                                Kinvey/Kinvey/FileStore.swift on lines 997..1020
                                                Kinvey/Kinvey/FileStore.swift on lines 1140..1150

                                                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 43.

                                                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

                                                There are no issues that match your filters.

                                                Category
                                                Status