Search code examples
pre-commitpre-commit.com

Is it possible that `pre-commit autoupdate` skips a single linter?


One of the projects I maintain still needs to provide Python 2.7 compatibility.

I use pre-commit with black and black dropped Python 2 support, so I want to stay on e.g. black version 21.9b0, but still I'd like to use pre-commit autoupdate to update the other linters.

I have seen the freeze command for pre-commit but this still updates my black version:

-   repo: https://github.com/psf/black
    rev: 911470a610e47d9da5ea938b0887c3df62819b85 # frozen: 21.9b0
    hooks:
    -   id: black
        additional_dependencies: ['click<8.1']

FWIW: I created the above snippet manually.

❯ pre-commit autoupdate
Updating https://github.com/pre-commit/pre-commit-hooks ... already up to date.
Updating https://github.com/PyCQA/flake8 ... already up to date.
Updating https://github.com/psf/black ... updating 911470a610e47d9da5ea938b0887c3df62819b85 -> 22.10.0.
Updating https://github.com/get-woke/woke ... already up to date.

Is it possible to just skip one linter?


Solution

  • there is no such option -- it's autoupdate not manualupdate

    you can always git checkout -p the changes you don't want -- though it's almost 2023 and time to let python 2 go


    disclaimer: I created pre-commit