https://pantsbuild.org/ logo
#general
Title
# general
r

refined-addition-53644

04/06/2022, 7:50 AM
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

curved-television-6568

04/06/2022, 10:02 AM
Yes, I’ve added
update-build-files —check
to our pre commit hooks at work.
r

refined-addition-53644

04/06/2022, 10:19 AM
I would imagine you wrote a custom git hook then?
c

curved-television-6568

04/06/2022, 10:55 AM
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

wide-midnight-78598

04/06/2022, 3:13 PM
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
4 Views