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

check-useless-excludes meta hook doesn't seem to work well with broken symlinks #2019

Closed
pkoch opened this issue Aug 23, 2021 · 4 comments · Fixed by #2029
Closed

check-useless-excludes meta hook doesn't seem to work well with broken symlinks #2019

pkoch opened this issue Aug 23, 2021 · 4 comments · Fixed by #2029
Labels

Comments

@pkoch
Copy link

pkoch commented Aug 23, 2021

Repro steps

  1. Add a submodule
  2. Add a symlink to somewhere inside this submodule
  3. Use check-symlinks
  4. Deinit submodule (to simulate the case when people clone without --recursive)
  5. Notice that it now complains about the symlink created on 2
  6. Add an exclude entry with the path to that symlink
  7. Use check-useless-excludes
  8. Notice that it complains that the added exclude entry doesn't apply.

For a working example, check out https://github.com/pkoch/test-check-useless-excludes (without --recursive, or run git submodule deinit --all) and run pre-commit run --all.

@pkoch pkoch changed the title check-useless-excludes meta hook doesn't seem to work well with submodule links check-useless-excludes meta hook doesn't seem to work well with broken symlinks Aug 23, 2021
@asottile
Copy link
Member

hmm indeed -- the "test" hook gets initialized with types: [file] which filters out the symlink -- the fix needs to happen here -- notably it should probably have a hook.setdefault('types', []) ? something like that?

@asottile asottile added the bug label Aug 23, 2021
@pkoch
Copy link
Author

pkoch commented Aug 23, 2021

Unsure, can't really reason about the code. However, I can add that adding types: [] to check-useless-excludes doesn't help.

@pkoch
Copy link
Author

pkoch commented Aug 31, 2021

Interesting! Any clues on why adding types: [] on my side didn't help?

@asottile
Copy link
Member

asottile commented Aug 31, 2021 via email

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

Successfully merging a pull request may close this issue.

2 participants