Skip to content

check-added-large-files does not check files when run in a CI loop #518

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

Closed
mshawcroft opened this issue Sep 15, 2020 · 4 comments
Closed

Comments

@mshawcroft
Copy link
Contributor

check-added-large-files works as expected when executed as a pre-commit hook, but when executed in a CI loop via run --all-files it does not diagnose over size files. This appears to be because the list of files provided on the command line is filtered to remove files that are not reported as staged for addition by git diff. Hence if a developer chooses not to install pre-commit as a git hook and adds an over size file, this will not subsequently be picked up by pre-commit running in CI.

@asottile
Copy link
Member

this is by design, it's intended to allow existing things to exist but error on anything moving forward

@asottile asottile reopened this Sep 16, 2020
@asottile
Copy link
Member

@mshawcroft one idea would be to add an option to check everything regardless (not sure what it would be called) -- would you be interested in contributing something like that?

@mshawcroft
Copy link
Contributor Author

mshawcroft commented Sep 16, 2020

@asottile Im happy to propose a patch.

I don't have any great suggestion for an option name, but note that some of the other commands in the repo appear to adopt a convention of --xxx and --no-xxx, so how about --no-check-only-staged ?

@asottile
Copy link
Member

maybe --enforce-all? like "enforce all files"?

mshawcroft added a commit to mshawcroft/pre-commit-hooks that referenced this issue Sep 24, 2020
…_files

The --enforce-all option when provided ensures that all files passed
on the command line are checked against the size limit.  Default
behaviour remains unchanged.
mshawcroft added a commit to mshawcroft/pre-commit-hooks that referenced this issue Sep 25, 2020
…_files

The --enforce-all option when provided ensures that all files passed
on the command line are checked against the size limit.  Default
behaviour remains unchanged.
asottile added a commit that referenced this issue Sep 27, 2020
Fix #518, provide --enforce-all option to check_added_large_files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants