Failed to find files for provided patterns with pre-commit
I have 1 sql script in my staging directory at the moment (I'm using squawk with pre-commit and I specified the git pre-commit hook to act on all scripts with in my fly away migration folder). If I add this script to my exclude paths or do the following:
excluded_paths = [
"*.sql"
]
I get the error: Failed to find files for provided patterns: ...
Doesn't it make more sense to exit 0 in this case since no .sql files should be listed/analyzed and therefore there is no error to be thrown? https://github.com/sbdchd/squawk/blob/ca1f346d4a98529418a0ee635efe4e11c5580a86/cli/src/main.rs#L175
The use case for this is: there is currently no way to override if I don't care about the violation. The docs say to usefail_on_violations = false. I add this property and I still getting a violation, causing squawk to fail and exit 1. This prevents me from making a commit since this is a pre-commit hook
I think this behavior is mimicking the behavior of ESLint. We should add a flag like they have to handle this: https://eslint.org/docs/latest/use/command-line-interface#--no-error-on-unmatched-pattern
I think this behavior is mimicking the behavior of ESLint. We should add a flag like they have to handle this: https://eslint.org/docs/latest/use/command-line-interface#--no-error-on-unmatched-pattern
would it not make sense to remove:
if found_paths.is_empty() && !opts.path_patterns.is_empty() {
eprintln!(
"Failed to find files for provided patterns: {:?}",
opts.path_patterns
);
process::exit(1);
}
Why is it an error if there are no paths vs exiting successfully and simply stating that no sql scripts were found?
Fixed in the latest version: v2.25.0! Thanks @PascalFrenz!