fresh-cat-90827
07/19/2023, 9:53 PMflake8
. The use case is https://github.com/pantsbuild/pants/issues/19486 - I want to error on duplicate keys in a dict, e.g.
python_sources(
name="lib",
overrides={
"main.py": {"dependencies": ["//:reqs#pytest"]},
"main.py": {"dependencies": []},
},
)
we currently only run formatter on BUILD files, so this would be new. I've experimented in a local branch and this would require making changes to the flake8 rules. Before I proceed, are we okay with the new feature? Anything that is worth taking into account?hundreds-father-404
07/19/2023, 10:02 PMfresh-cat-90827
07/19/2023, 10:02 PMfresh-cat-90827
07/19/2023, 10:04 PMfresh-cat-90827
07/19/2023, 10:04 PMhundreds-father-404
07/19/2023, 10:04 PMfresh-cat-90827
07/19/2023, 10:07 PMsrc/python/pants/backend/python/lint/flake8/rules.py
for Python sources, I thought to have an independent function/rule in src/python/pants/backend/build_files/lint/flake8/rules.py
that would only be used by the pants lint src/files/BUILD
hundreds-father-404
07/19/2023, 10:07 PMfresh-cat-90827
07/19/2023, 10:07 PMpants lint src/files/BUILD src/files/module.py
hundreds-father-404
07/19/2023, 10:08 PMwill route the requests accordingly to the relevant rules when run pants lint src/files/BUILDI thinkkkkk I fixed this but am not certain. What happens when you run
pants lint
on a BUILD file today? In the past, it would run on all targets defined in that BUILD file. But I think I changed that.
(sorry, don't have Pants handy)fresh-cat-90827
07/19/2023, 10:10 PMpants lint src/python/pants/backend/python/lint/flake8/BUILD
doesn't lint Python files from the BUILD file targetsfresh-cat-90827
07/19/2023, 10:11 PMAnd is it worth using Ruff instead since it's so much faster?worth exploring, thanks for reminding about that one. I believe more and more rules are ported, so that one should be available now or in the near future
fresh-cat-90827
07/19/2023, 10:12 PMfresh-cat-90827
07/19/2023, 10:12 PMhundreds-father-404
07/19/2023, 10:14 PMbuild_ignore
or pants_ignore
, or inline comments to disable Ruff for each violation
The last thing I'd suggest is: where would you document this? An issue with Pants is discoverability. How do users find out about this?fresh-cat-90827
07/19/2023, 10:16 PMproud-dentist-22844
07/21/2023, 10:52 PM