Skip to content

Error when running squawk on an excluded file #387

@PascalFrenz

Description

@PascalFrenz

Hi, first of all thanks for providing this awesome tool!

Problem

We are using it in our CI Pipelines to check any changed or added files within a PR one by one. Sometimes we encounter the situation that we want to accept a breaking change, for example when changing the type of an unused column or dropping an unused column. We use the .squawk.toml and more specifically the excluded_paths array to do this.

Squawk is called like this:
squawk "$FILENAME"

We noticed that squawk exits with an error code (1) and prints the following error:
Failed to find files for provided patterns: ["<FILENAME>"]
<FILENAME> = the path to the changed file.

Digging into the source code a little bit, it seems like this check is responsible for the behavior:

squawk/cli/src/main.rs

Lines 172 to 178 in 0019f41

if found_paths.is_empty() && !opts.path_patterns.is_empty() {
eprintln!(
"Failed to find files for provided patterns: {:?}",
opts.path_patterns
);
process::exit(1);
}

Expected Behavior

When calling squawk with a path that is excluded via configuration, I would expect squawk to exit successfully (exit code 0). It could be helpful to print a message, stating that the file was ignored due to configuration.

Actual Behavior

Squawk exits with exit code 1, indicating a failure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions