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

The pre-commit hook should only lint staged files #520

Open
patrys opened this issue Nov 15, 2023 · 0 comments
Open

The pre-commit hook should only lint staged files #520

patrys opened this issue Nov 15, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@patrys
Copy link

patrys commented Nov 15, 2023

Describe the bug

When the repository contains files that are not going to be committed (for example, not tracked by git at all), the pre-commit hook for deptry will fail if any of those files don't pass the checks. This is inconsistent with the behavior of other pre-commit hooks, which only validate the changes that are about to be committed.

To Reproduce

Steps to reproduce the behavior:

  1. Take a clean repository with a deptry hook passing
  2. Create an untracked Python script with import foobarbaz as the only line
  3. Try to commit an unrelated change
  4. See the hook fail, complaining about an unlisted dependency on foobarbaz

Expected behavior

The hook should ignore any files that are not going to be part of the commit.

System [please complete the following information]:

  • OS: macOS Sonoma 14.0
  • Language Version: Python 3.9
  • Poetry version: 1.7.0

Additional context

N/A

@patrys patrys added the bug Something isn't working label Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant