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

polite-garden-50641

03/25/2020, 10:20 PM
@hundreds-father-404 is there a way to tell the flake8 linter to ignore whole directories (i.e. pants targets), configuring excludes in the flake8 config file pants uses has no effect since in v2, pants passed a list of .py files for flake8 to process.
h

hundreds-father-404

03/25/2020, 10:22 PM
Hm, can you share more about the use case, please? The way we achieve this in the Pants code base is via tags. For every target you wan to skip, add something like this:
Copy code
python_library(
  tags=['nolint']
)
Then
./tc --tags='-nolint' lint ::
p

polite-garden-50641

03/25/2020, 11:29 PM
yes, I am looking into vendoring an external package into our repo. under src/python/some_package I want to take it "as is", I don't mind re-formatting it with black, but I don't want to go and fix all the other lint and perhaps typing (mypy) issues it has... so I want pants to ignore it for certain checks (specifically flake8 & mypy)
will try that... how do I figure out tag names ?
without digging thru the pants code base? is there some sort of convention for those ?
h

hundreds-father-404

03/25/2020, 11:38 PM
you can name the tag whatever you want, so long as you use a convention
it can be any arbitrary string. You have to explicitly tell Pants to filter out those targets via
./tc --tags='-mytag'
, though (note the
-
)
We could possibly make this automatic with the Target API by adding a new target type to say “this acts like a Python library, but please don’t format or lint this.” It’s not ready yet, but very feasible
5 Views