AnyLint
AnyLint copied to clipboard
`checkFilePaths` autocorrection doesn't create new folders
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