Hi, has someone already hooked up `update-build-fi...
# general
r
Hi, has someone already hooked up
update-build-files
to their git hooks? I want them to run like any other pre-commit hook. I have already connected pants to git hooks thanks to @wide-midnight-78598
c
Yes, I’ve added
update-build-files —check
to our pre commit hooks at work.
r
I would imagine you wrote a custom git hook then?
c
No, I’m using https://pre-commit.com/
Copy code
$ cat .pre-commit-config.yaml
repos:
- repo: local
  hooks:
  - id: lint-check-test
    name: Checking source files and running tests
    entry: "./pants lint check test ::"
    language: script
    types: [python]
    pass_filenames: false
    verbose: true
  - id: lint-build-files
    name: Checking BUILD files
    entry: "./pants --no-pantsd update-build-files --check"
    language: script
    files: BUILD
    pass_filenames: false
    verbose: true
🙌 2
For the
lint check test
step, you could have
pass_filenames: true
and omit the
::
spec, but I have fmt issues then: https://github.com/pantsbuild/pants/pull/15002
w
I actually didn't realize the update-build-files check wasn't in the pre-commit hook in my sample repo! It should run just like the other two, as @curved-television-6568 mentioned. https://github.com/sureshjoshi/pants-example-plugin/issues/13 Should have it fixed in a couple hours when I'm back at my computer
👍 1
❤️ 1