process(python): Explore the possibility of using a single linter #1373
Labels
lang: python
Issues specific to Python.
type: process
A process-related concern. May include testing, release, or the like.
In the templated
nox_file.py
for python, there is alint
nox
session which runs bothblack
andflake8
linters.synthtool/synthtool/gcp/templates/python_library/noxfile.py.j2
Lines 52 to 64 in 02193e4
googleapis/python-aiplatform#1087, there is a conflict between the 2 lint tools that we use where a formatting change made by
black
causes theflake8
check to fail.In the current configuration,
black
andflake8
check for different things.black
tests/applies formatting whileflake
checks for syntax.To check this, create an empty file
test_lint.py
with a single import statement and no new line at the end of the file. As an example, I usedimport google.api
in an empty file without a blank line at the end.If you run
black --check test_lint.py
which tests the file without changing it.Then run
black test_lint.py
, which adds an empty line at the end of the file.On the same file run
flake8 test_lint.py
which tests for syntax.I've opened this issue to understand the impact of removing
black
, and confirm thatflake8
can fill the gap.The text was updated successfully, but these errors were encountered: