happy-psychiatrist-90774
07/24/2024, 7:39 PMhappy-kitchen-89482
07/24/2024, 8:09 PMhappy-psychiatrist-90774
07/24/2024, 8:16 PMhappy-psychiatrist-90774
07/24/2024, 8:20 PMhappy-kitchen-89482
07/24/2024, 9:54 PMhappy-psychiatrist-90774
07/25/2024, 8:36 AMpants.toml
, though. This is part of a git hook that runs linting, so I can leverage shell scripting to do this ad-hoc
This is the janky solution I came up with:
unstaged_files="$(git status --short | grep -E '^[ MARC]|\?\?')"
ignore_files=$(echo ${unstaged_files} | awk '{printf("\"%s\",", $2)}')
ignore_builtin='".*/","/dist/","__pycache__","!.semgrep/","!.github/"'
pants \
--changed-since=origin/master \
--pants-ignore="[${ignore_files} ${ignore_builtin}]" \
lint
happy-kitchen-89482
07/25/2024, 10:58 AMhappy-psychiatrist-90774
07/25/2024, 11:06 AMhappy-kitchen-89482
07/25/2024, 11:09 AMhappy-kitchen-89482
07/25/2024, 11:10 AMhappy-psychiatrist-90774
07/25/2024, 11:10 AMhappy-psychiatrist-90774
07/25/2024, 11:11 AMhappy-kitchen-89482
07/25/2024, 11:11 AMhappy-kitchen-89482
07/25/2024, 11:11 AM--pants-ignore-unstaged
makes sensehappy-kitchen-89482
07/25/2024, 11:12 AM--pants-ignore
happy-psychiatrist-90774
07/25/2024, 11:12 AMhappy-kitchen-89482
07/25/2024, 11:13 AMhappy-kitchen-89482
07/25/2024, 11:13 AMhappy-kitchen-89482
07/25/2024, 11:13 AMhappy-kitchen-89482
07/25/2024, 11:13 AMhappy-psychiatrist-90774
07/25/2024, 11:14 AM--pants-ignore-use-gitignore
then, because that and --pants-ignore
seem to be mutually exclusive atmhappy-kitchen-89482
07/25/2024, 11:14 AMhappy-psychiatrist-90774
07/25/2024, 11:14 AMhappy-kitchen-89482
07/25/2024, 11:15 AM`pants_ignore` can be used in tandem with `pants_ignore_use_gitignore`; any rules
specified here are applied after rules specified in a .gitignore file.
happy-kitchen-89482
07/25/2024, 11:15 AMhappy-psychiatrist-90774
07/25/2024, 11:15 AMhappy-psychiatrist-90774
07/25/2024, 11:15 AM--pants-ignore
happy-psychiatrist-90774
07/25/2024, 11:17 AM--pants-ignore-unstaged
as you mentioned 🙂
Thanks a bunch!happy-kitchen-89482
07/25/2024, 2:59 PMsrc/python/pants/vcs
that should be helpful