ruff-pre-commit icon indicating copy to clipboard operation
ruff-pre-commit copied to clipboard

Consider not using --force-exclude by default

Open boenshao opened this issue 1 year ago • 6 comments

Contrary to #19, making --force-exclude an implicit default can cause confusing behaviors. As some CI environments might run under paths that are excluded by default or excluded by custom configuration.

For example, the Bitbucket pipeline runs under /opt/atlassian/pipelines/agent/build, which is excluded by default (build), so running pre-commit run --all-files takes no effect at all, but it totally works as expected under local repo, really confusing!

Take me quite some time to figure out why our CI is not working, apparently, others have the same problem.

I suggest making the --force-exclude an opt-in, or at least add a reminder in README for setting --no-force-exclude.

boenshao avatar Feb 20 '24 16:02 boenshao

Agreed, this has recently caught me out too, i think the best option is to just add it to the readme for now. Its trivial to remove if we do make the decision to drop it as a default argument. I have submitted a PR for this here: #72

schlerp avatar Feb 23 '24 02:02 schlerp

Alternatively, I'm going to remove build from the default exclusion list in v0.3.0. It causes all sorts of problems (like this), and it's the only default for which we get issues like this.

charliermarsh avatar Feb 23 '24 05:02 charliermarsh

See: https://github.com/astral-sh/ruff/pull/10093.

charliermarsh avatar Feb 23 '24 05:02 charliermarsh

Yeah that makes sense :) Do we still think it's worth mentioning its the default? I spent quite a bit of time digging into this and really would have appreciated it being pointed out in the README 😆

schlerp avatar Feb 23 '24 06:02 schlerp

I don't want to run with --force-exclude. This should be an option. Also I went crazy for an hour trying to figure out why it was ignoring files I had in a .github/scripts folder (hidden, thus excluded). Please move this to args and document it.

ryanpeach avatar Sep 10 '24 20:09 ryanpeach

Actually, sorry. I'm still going crazy. --force-exclude doesn't seem to change whether or not my .github/scripts folder is evaluated. It works in cli but not in pre-commit.

ryanpeach avatar Sep 10 '24 20:09 ryanpeach