Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checkFilePaths autocorrection doesn't create new folders #38

Open
Jeehut opened this issue Sep 9, 2020 · 0 comments
Open

checkFilePaths autocorrection doesn't create new folders #38

Jeehut opened this issue Sep 9, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@Jeehut
Copy link
Member

Jeehut commented Sep 9, 2020

Expected Behavior

When I autocorrect a file path to a new path, the new path is created and the file is moved to it (unless the file already exists).

Actual Behavior

The parent folders are missing and I'm getting this error:

Fatal error: Error raised at top level: Error Domain=NSCocoaErrorDomain Code=4 "“ExampleInstrumentedTest.kt” couldn’t be moved to “api_client” because either the former doesn’t exist, or the folder containing the latter doesn’t exist." UserInfo={NSSourceFilePathErrorKey=/Users/Cihat/Code/Papershift/API-Client-Android/api_client/src/androidTest/java/com/papershift/api_client/ExampleInstrumentedTest.kt, NSUserStringVariant=(
    Move
), NSDestinationFilePath=/Users/Cihat/Code/Papershift/API-Client-Android/api_client/src/androidTest/kotlin/com/papershift/api_client/ExampleInstrumentedTest.kt, NSFilePath=/Users/Cihat/Code/Papershift/API-Client-Android/api_client/src/androidTest/java/com/papershift/api_client/ExampleInstrumentedTest.kt, NSUnderlyingError=0x7fabae43a8b0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}: file /AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-1103.8.25.8/swift/stdlib/public/core/ErrorType.swift, line 200
14:38:01.942: ❌ Linting failed using config file at /Users/Cihat/Code/Papershift/API-Client-Android/lint.swift.

Steps to Reproduce the Problem

Using this check:

// MARK: KotlinSourcePath
    try Lint.checkFilePaths(
        checkInfo: "KotlinSourcePath: All Kotlin source files should be placed under .",
        regex: #"^(.*/src/.*)(/java/)(.*\.kt)$"#,
        matchingExamples: ["app/src/main/java/com/android/BaseViewModel.kt", "app/src/debug/java/uk/co/hogwarts/TriWizardTournament.kt"],
        nonMatchingExamples: ["app/src/main/kotlin/com/android/BaseViewModel.kt", "app/src/debug/kotlin/uk/co/hogwarts/TriWizardTournament.kt", "app/generated/java/Script.kt"],
        autoCorrectReplacement: "$1/kotlin/$3",
        autoCorrectExamples: [
            ["before": "app/src/main/java/com/android/BaseViewModel.kt", "after": "app/src/main/kotlin/com/android/BaseViewModel.kt"],
            ["before": "app/src/debug/java/uk/co/hogwarts/TriWizardTournament.kt", "after": "app/src/debug/kotlin/uk/co/hogwarts/TriWizardTournament.kt"],
        ]
    )

Specifications

  • Version: 0.8.2
  • Platform: macOS 10.15.6
  • IDE Version: Xcode 11.7
@Jeehut Jeehut added the bug Something isn't working label Sep 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant