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

Failed to find files for provided patterns with pre-commit #363

Open
dhakshin32 opened this issue Jun 28, 2024 · 2 comments
Open

Failed to find files for provided patterns with pre-commit #363

dhakshin32 opened this issue Jun 28, 2024 · 2 comments
Labels

Comments

@dhakshin32
Copy link

dhakshin32 commented Jun 28, 2024

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?

"Failed to find files for provided patterns: {:?}",

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

@dhakshin32 dhakshin32 changed the title Failed to find files for provided patterns: Failed to find files for provided patterns with pre-commit Jun 28, 2024
@chdsbd chdsbd added the bug label Jun 28, 2024
@chdsbd
Copy link
Collaborator

chdsbd commented Jun 28, 2024

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

@dhakshin32
Copy link
Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants