PDF-Archiver/PDF-Archiver

View on GitHub

Showing 599 of 599 total issues

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

    public static var tutorialShown: Bool {
        get {
            appGroup.bool(forKey: Names.tutorialShown.rawValue)
        }
        set {
Severity: Major
Found in Shared/Other/Constants/UserDefaults.swift and 5 other locations - About 40 mins to fix
Shared/Other/Constants/UserDefaults.swift on lines 64..71
Shared/Other/Constants/UserDefaults.swift on lines 73..80
Shared/Other/Constants/UserDefaults.swift on lines 167..174
Shared/Other/Constants/UserDefaults.swift on lines 176..183
Shared/Other/Constants/UserDefaults.swift on lines 185..192

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

    public static var lastAppUsagePermitted: Bool {
        get {
            appGroup.bool(forKey: Names.lastAppUsagePermitted.rawValue)
        }
        set {
Severity: Major
Found in Shared/Other/Constants/UserDefaults.swift and 5 other locations - About 40 mins to fix
Shared/Other/Constants/UserDefaults.swift on lines 55..62
Shared/Other/Constants/UserDefaults.swift on lines 64..71
Shared/Other/Constants/UserDefaults.swift on lines 167..174
Shared/Other/Constants/UserDefaults.swift on lines 176..183
Shared/Other/Constants/UserDefaults.swift on lines 185..192

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

    public static var documentTagsNotRequired: Bool {
        get {
            appGroup.bool(forKey: Names.documentTagsNotRequired.rawValue)
        }
        set {
Severity: Major
Found in Shared/Other/Constants/UserDefaults.swift and 5 other locations - About 40 mins to fix
Shared/Other/Constants/UserDefaults.swift on lines 55..62
Shared/Other/Constants/UserDefaults.swift on lines 64..71
Shared/Other/Constants/UserDefaults.swift on lines 73..80
Shared/Other/Constants/UserDefaults.swift on lines 167..174
Shared/Other/Constants/UserDefaults.swift on lines 185..192

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

    public static var notSaveDocumentTagsAsPDFMetadata: Bool {
        get {
            appGroup.bool(forKey: Names.notSaveDocumentTagsAsPDFMetadata.rawValue)
        }
        set {
Severity: Major
Found in Shared/Other/Constants/UserDefaults.swift and 5 other locations - About 40 mins to fix
Shared/Other/Constants/UserDefaults.swift on lines 55..62
Shared/Other/Constants/UserDefaults.swift on lines 64..71
Shared/Other/Constants/UserDefaults.swift on lines 73..80
Shared/Other/Constants/UserDefaults.swift on lines 176..183
Shared/Other/Constants/UserDefaults.swift on lines 185..192

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

    public static var firstDocumentScanAlertPresented: Bool {
        get {
            appGroup.bool(forKey: Names.firstDocumentScanAlertPresented.rawValue)
        }
        set {
Severity: Major
Found in Shared/Other/Constants/UserDefaults.swift and 5 other locations - About 40 mins to fix
Shared/Other/Constants/UserDefaults.swift on lines 55..62
Shared/Other/Constants/UserDefaults.swift on lines 73..80
Shared/Other/Constants/UserDefaults.swift on lines 167..174
Shared/Other/Constants/UserDefaults.swift on lines 176..183
Shared/Other/Constants/UserDefaults.swift on lines 185..192

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

    public static var documentSpecificationNotRequired: Bool {
        get {
            appGroup.bool(forKey: Names.documentSpecificationNotRequired.rawValue)
        }
        set {
Severity: Major
Found in Shared/Other/Constants/UserDefaults.swift and 5 other locations - About 40 mins to fix
Shared/Other/Constants/UserDefaults.swift on lines 55..62
Shared/Other/Constants/UserDefaults.swift on lines 64..71
Shared/Other/Constants/UserDefaults.swift on lines 73..80
Shared/Other/Constants/UserDefaults.swift on lines 167..174
Shared/Other/Constants/UserDefaults.swift on lines 176..183

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

    modelContext.insert(Document(id: UUID().uuidString, url: URL(filePath: ""), isTagged: false, filename: "scan2", date: Date(), specification: "", tags: [], downloadStatus: 1))
Severity: Minor
Found in Shared/Other/Persistence/DatabaseConfiguration.swift and 1 other location - About 40 mins to fix
Shared/Other/Persistence/DatabaseConfiguration.swift on lines 26..26

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

    modelContext.insert(Document(id: UUID().uuidString, url: URL(filePath: ""), isTagged: false, filename: "scan1", date: Date(), specification: "", tags: [], downloadStatus: 1))
Severity: Minor
Found in Shared/Other/Persistence/DatabaseConfiguration.swift and 1 other location - About 40 mins to fix
Shared/Other/Persistence/DatabaseConfiguration.swift on lines 27..27

Duplicated Code

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

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

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

Tuning

This issue has a mass of 49.

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

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

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

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

Refactorings

Further Reading

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

    public init(isShown: Binding<Bool>, imageHandler: @escaping ([CIImage]) -> Void) {
        self.isShown = isShown
        self.imageHandler = imageHandler
    }
Severity: Minor
Found in Shared/ArchiveViews/ScanTab/DocumentCameraView.swift and 1 other location - About 40 mins to fix
Shared/ArchiveViews/ScanTab/DocumentCameraView.swift on lines 40..43

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

        for pageNumber in 0..<min(document.pageCount, 10) {
            content += document.page(at: pageNumber)?.string ?? ""
        }
Severity: Minor
Found in Tests macOS/ArchiveBackendTests/TagParserTests.swift and 1 other location - About 40 mins to fix
Tests macOS/ArchiveBackendTests/DateParserTests.swift on lines 145..147

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

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

        fileprivate init(isShown: Binding<Bool>, imageHandler: @escaping ([CIImage]) -> Void) {
            self.isShown = isShown
            self.imageHandler = imageHandler
        }
Severity: Minor
Found in Shared/ArchiveViews/ScanTab/DocumentCameraView.swift and 1 other location - About 40 mins to fix
Shared/ArchiveViews/ScanTab/DocumentCameraView.swift on lines 19..22

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

        for pageNumber in 0..<min(document.pageCount, 1) {
            content += document.page(at: pageNumber)?.string ?? ""
        }
Severity: Minor
Found in Tests macOS/ArchiveBackendTests/DateParserTests.swift and 1 other location - About 40 mins to fix
Tests macOS/ArchiveBackendTests/TagParserTests.swift on lines 53..55

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

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

    func info(_ message: String,
               metadata: @autoclosure () -> [String: String],
               file: StaticString = #file,
               function: StaticString = #function,
               line: UInt = #line) {
Severity: Minor
Found in Shared/Other/Constants/Logging/Log.swift - About 35 mins to fix

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

        func debug(_ message: String,
                   metadata: @autoclosure () -> [String: String],
                   file: StaticString = #file,
                   function: StaticString = #function,
                   line: UInt = #line) {
    Severity: Minor
    Found in Shared/Other/Constants/Logging/Log.swift - About 35 mins to fix

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

          func errorAndAssert(_ message: String,
                              metadata: @autoclosure () -> [String: String]? = nil,
                              file: StaticString = #file,
                              function: StaticString = #function,
                              line: UInt = #line) {
      Severity: Minor
      Found in Shared/Other/Constants/Logging/Log.swift - About 35 mins to fix

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

            func criticalAndAssert(_ message: String,
                                   metadata: @autoclosure () -> [String: String]? = nil,
                                   file: StaticString = #file,
                                   function: StaticString = #function,
                                   line: UInt = #line) {
        Severity: Minor
        Found in Shared/Other/Constants/Logging/Log.swift - About 35 mins to fix

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

              func trace(_ message: String,
                         metadata: @autoclosure () -> [String: String],
                         file: StaticString = #file,
                         function: StaticString = #function,
                         line: UInt = #line) {
          Severity: Minor
          Found in Shared/Other/Constants/Logging/Log.swift - About 35 mins to fix

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

                func error(_ message: String,
                           metadata: @autoclosure () -> [String: String]?,
                           file: StaticString = #file,
                           function: StaticString = #function,
                           line: UInt = #line) {
            Severity: Minor
            Found in Shared/Other/Constants/Logging/Log.swift - About 35 mins to fix

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

                  private func input2message(_ message: String,
                                             metadata: [String: String]?,
                                             file: StaticString,
                                             function: StaticString,
                                             line: UInt) -> String {
              Severity: Minor
              Found in Shared/Other/Constants/Logging/Log.swift - About 35 mins to fix

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

                    public static let tempPdfURL: URL = {
                        let tempImageURL = appGroupContainerURL.appendingPathComponent("TempPDFDocuments")
                        createFolderIfNotExists(tempImageURL, name: "TempPDFDocuments")
                        return tempImageURL
                    }()
                Severity: Minor
                Found in Shared/Other/Constants/PathConstants.swift and 1 other location - About 35 mins to fix
                Shared/Other/Constants/PathConstants.swift on lines 19..23

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

                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

                Severity
                Category
                Status
                Source
                Language