PDF-Archiver/PDF-Archiver

View on GitHub
UITests iOS/SnapshotHelper.swift

Summary

Maintainability
A
2 hrs
Test Coverage

Function snapshot has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    open class func snapshot(_ name: String, timeWaitingForIdle timeout: TimeInterval = 20) {
        if timeout > 0 {
            waitForLoadingIndicatorToDisappear(within: timeout)
        }

Severity: Minor
Found in UITests iOS/SnapshotHelper.swift - About 1 hr to fix

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

        open class func snapshot(_ name: String, timeWaitingForIdle timeout: TimeInterval = 20) {
            if timeout > 0 {
                waitForLoadingIndicatorToDisappear(within: timeout)
            }
    
    
    Severity: Minor
    Found in UITests iOS/SnapshotHelper.swift - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Line should be 120 characters or less: currently 158 characters
    Open

            let networkLoadingIndicatorDisappeared = XCTNSPredicateExpectation(predicate: NSPredicate(format: "exists == false"), object: networkLoadingIndicator)
    Severity: Minor
    Found in UITests iOS/SnapshotHelper.swift by swiftlint

    Line should be 120 characters or less: currently 122 characters
    Open

            let hasNewLoadingIndicatorSize = frame.size.width.isBetween(46, and: 47) && frame.size.height.isBetween(2, and: 3)
    Severity: Minor
    Found in UITests iOS/SnapshotHelper.swift by swiftlint

    Line should be 120 characters or less: currently 133 characters
    Open

                let matches = regex.matches(in: launchArguments, options: [], range: NSRange(location: 0, length: launchArguments.count))
    Severity: Minor
    Found in UITests iOS/SnapshotHelper.swift by swiftlint

    Line should be 120 characters or less: currently 126 characters
    Open

    ///   - timeout: Amount of seconds to wait until the network loading indicator disappears. Pass `0` if you don't want to wait.
    Severity: Minor
    Found in UITests iOS/SnapshotHelper.swift by swiftlint

    Line should be 120 characters or less: currently 139 characters
    Open

            NSLog("snapshot: \(name)") // more information about this, check out https://docs.fastlane.tools/actions/snapshot/#how-does-it-work
    Severity: Minor
    Found in UITests iOS/SnapshotHelper.swift by swiftlint

    Line should be 120 characters or less: currently 143 characters
    Open

                guard var simulator = ProcessInfo().environment["SIMULATOR_DEVICE_NAME"], let screenshotsDir = screenshotsDirectory else { return }
    Severity: Minor
    Found in UITests iOS/SnapshotHelper.swift by swiftlint

    Line should be 120 characters or less: currently 144 characters
    Open

                    // The simulator name contains "Clone X of " inside the screenshot file when running parallelized UI Tests on concurrent devices
    Severity: Minor
    Found in UITests iOS/SnapshotHelper.swift by swiftlint

    Line should be 120 characters or less: currently 135 characters
    Open

                let image = XCUIDevice.shared.orientation.isLandscape ? fixLandscapeOrientation(image: screenshot.image) : screenshot.image
    Severity: Minor
    Found in UITests iOS/SnapshotHelper.swift by swiftlint

    There are no issues that match your filters.

    Category
    Status