Skip to content

Conversation

@dsbibby
Copy link
Contributor

@dsbibby dsbibby commented Jul 3, 2025

This PR fixes an issue with conftest-fmt where all files in the working directory are formatted regardless of if they are staged or committed to git. This is an undesirable behaviour for pre-commit as files should be passed to hooks by pre-commit rather than treating all files regardless.

In particular this causes an issue when the PRE_COMMIT_HOME environment variable is set to a path within the git repo (as per the gitlab CI example) as the hook tries to lint files within .cache directories.

The current behaviour can be maintained if required by configuring the hook to run on all files in the working directory, but this is not the default behaviour of pre-commit and is not recommended - eg:

    hooks:
    - id: conftest-fmt
      args:
        - '.' # Format all files

The conftest-validate hook has a similar issue and is also fixed by this PR.

Copy link
Owner

@anderseknert anderseknert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@anderseknert anderseknert merged commit 8b72c4a into anderseknert:master Jul 6, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants