Thanks to visit codestin.com
Credit goes to github.com

Skip to content

stages: [commit] hooks will run with pre-commit run otherhookid #772

@asottile

Description

@asottile

minor logic bug, good new-contributor ticket

Easy to reproduce on pre-commit itself:

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index a146bd2..7bb382d 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -3,6 +3,7 @@ repos:
     rev: v1.2.3
     hooks:
     -   id: trailing-whitespace
+        stages: [commit]
     -   id: end-of-file-fixer
     -   id: autopep8-wrapper
     -   id: check-docstring-first
$ pre-commit run end-of-file-fixer --all-files
Trim Trailing Whitespace.................................................Passed
Fix End of Files.........................................................Passed

(it should have only run end-of-file-fixer but also run trailing-whitespace due to a logic error).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions