0

I just found out that black's default behavior for long logfile messages does not enforce a maximum line length. I have verified that I can enforce max line length if I invoke black manually (v 23.1.0, in a Python 3.9.9 venv). Now I'd like to make sure that enforcement happens with every commit, using pre-commit, but I don't know how to do this.

Is it possible? If so, how?

anthony sottile
  • 61,815
  • 15
  • 148
  • 207
Jeff Wright
  • 1,014
  • 1
  • 11
  • 17

1 Answers1

2

this isn't specific to black -- any tool can add arguments in pre-commit by utilizing args

taking black's base config:

-   repo: https://github.com/psf/black
    rev: ...  # use your revision here
    hooks:
    -   id: black
        args: [--preview]

disclaimer: I wrote pre-commit, I've contributed to black

anthony sottile
  • 61,815
  • 15
  • 148
  • 207