diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f9c0d9f649f6..cef59ccc61e4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,6 +10,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +default_language_version: + python: python3.7 repos: - repo: https://github.com/pre-commit/mirrors-yapf # this rev is a release tag in the repo above and corresponds with a yapf @@ -18,8 +20,8 @@ repos: hooks: - id: yapf files: ^sdks/python/apache_beam/ - # keep these in sync with sdks/python/.yapfignore - exclude: > + # keep these in sync with sdks/python/.yapfignore and run_pylint.sh + exclude: &exclude > (?x)^( sdks/python/apache_beam/io/gcp/internal/clients/bigquery/bigquery_v2_client.py| sdks/python/apache_beam/io/gcp/internal/clients/bigquery/bigquery_v2_messages.py| @@ -30,3 +32,13 @@ repos: sdks/python/apache_beam/coders/proto2_coder_test_messages_pb2.py| sdks/python/apache_beam/portability/api/.*pb2.*.py )$ + + - repo: https://github.com/pycqa/pylint + # this rev is a release tag in the repo above and corresponds with a pylint + # version. make sure this matches the version of pylint in tox.ini. + rev: pylint-2.4.3 + hooks: + - id: pylint + args: ["--rcfile=sdks/python/.pylintrc"] + files: ^sdks/python/apache_beam/ + exclude: *exclude diff --git a/sdks/python/tox.ini b/sdks/python/tox.ini index 1111a648b1e5..12acec3febd6 100644 --- a/sdks/python/tox.ini +++ b/sdks/python/tox.ini @@ -185,6 +185,7 @@ commands = [testenv:py37-lint] # Don't set TMPDIR to avoid "AF_UNIX path too long" errors in pylint. setenv = +# keep the version of pylint in sync with the 'rev' in .pre-commit-config.yaml deps = -r build-requirements.txt astroid<2.4,>=2.3.0