acoustic-house-77496
09/21/2023, 7:40 AMpre-commit
with pants but it seems that it does not read some configuration files, currently running directly from pants everything works as expected but when running from pre-commit it fails on bandit
and mypy
both are customized using pyproject.toml
in their corresponding sections
bandit `args`: are --quiet
and then when I run pre-commit
the output is not quiet so I guess is not reading the configuration from the pyproject.toml
any clue?
.pre-commit.config.yaml
fail_fast: false
repos:
- repo: local
hooks:
- id: pants-lint
name: pants lint
always_run: false
description: runs pants --no-dynamic-ui lint on python files
entry: pants --changed-since=HEAD --changed-dependents=transitive lint
language: system
verbose: true
pass_filenames: false
types: [file, python]
pants.toml
[bandit]
args = "--quiet"
config = "./pyproject.toml"
install_from_resolve = "python-default"
fresh-cat-90827
09/25/2023, 10:37 AM.pre-commit-config.yaml
whereas your file is named .pre-commit.config.yaml
. Please see https://pre-commit.com/#2-add-a-pre-commit-configuration. There's also another Slack thread you may find helpful.fresh-cat-90827
09/25/2023, 11:34 AMecho "\nprint('Done')" >> cheeseshop/cli/cli.py
git add . ; pre-commit
ā bandit succeeded.
(no messages from Bandit)
Remove skips = ["B101"]
and now there's an error and the detailed output is shown. So I can confirm that both pyproject.toml
is read and the args = "--quiet"
is respected by Pants as well (it's passing the args through). Try comment/uncomment #args = "--quiet"
in pants.toml
acoustic-house-77496
09/26/2023, 9:12 AM.pre-commit-config.yaml
was a typo here in the chat... but for some reason I get different outputs in pre-commit and in pants šfresh-cat-90827
09/26/2023, 9:13 AM