From 5aefea4ed94bd44d59d85f488b66317485c5d7c0 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 7 Jan 2021 06:58:34 -0800 Subject: [PATCH] chore: add pre-commit (#36) * changes without context autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. * docs(python): fix intersphinx link for google-auth Source-Author: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Source-Date: Thu Nov 19 10:16:05 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: a073c873f3928c561bdf87fdfbf1d081d1998984 Source-Link: https://github.com/googleapis/synthtool/commit/a073c873f3928c561bdf87fdfbf1d081d1998984 * chore: add config / docs for 'pre-commit' support Source-Author: Tres Seaver Source-Date: Tue Dec 1 16:01:20 2020 -0500 Source-Repo: googleapis/synthtool Source-Sha: 32af6da519a6b042e3da62008e2a75e991efb6b4 Source-Link: https://github.com/googleapis/synthtool/commit/32af6da519a6b042e3da62008e2a75e991efb6b4 * chore(deps): update precommit hook pre-commit/pre-commit-hooks to v3.3.0 Source-Author: WhiteSource Renovate Source-Date: Wed Dec 2 17:18:24 2020 +0100 Source-Repo: googleapis/synthtool Source-Sha: 69629b64b83c6421d616be2b8e11795738ec8a6c Source-Link: https://github.com/googleapis/synthtool/commit/69629b64b83c6421d616be2b8e11795738ec8a6c * test(python): give filesystem paths to pytest-cov https://pytest-cov.readthedocs.io/en/latest/config.html The pytest-cov docs seem to suggest a filesystem path is expected. Source-Author: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Source-Date: Wed Dec 2 09:28:04 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: f94318521f63085b9ccb43d42af89f153fb39f15 Source-Link: https://github.com/googleapis/synthtool/commit/f94318521f63085b9ccb43d42af89f153fb39f15 Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> --- .../.pre-commit-config.yaml | 17 +++++++++++++++++ .../CONTRIBUTING.rst | 10 ++++++++++ .../google-cloud-bigquery-connection/noxfile.py | 5 ++--- .../synth.metadata | 7 ++++--- 4 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 packages/google-cloud-bigquery-connection/.pre-commit-config.yaml diff --git a/packages/google-cloud-bigquery-connection/.pre-commit-config.yaml b/packages/google-cloud-bigquery-connection/.pre-commit-config.yaml new file mode 100644 index 000000000000..6ad83346e261 --- /dev/null +++ b/packages/google-cloud-bigquery-connection/.pre-commit-config.yaml @@ -0,0 +1,17 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.3.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml +- repo: https://github.com/psf/black + rev: 19.10b0 + hooks: + - id: black +- repo: https://gitlab.com/pycqa/flake8 + rev: 3.8.4 + hooks: + - id: flake8 diff --git a/packages/google-cloud-bigquery-connection/CONTRIBUTING.rst b/packages/google-cloud-bigquery-connection/CONTRIBUTING.rst index b76c2280ab4b..55e5868f6234 100644 --- a/packages/google-cloud-bigquery-connection/CONTRIBUTING.rst +++ b/packages/google-cloud-bigquery-connection/CONTRIBUTING.rst @@ -111,6 +111,16 @@ Coding Style should point to the official ``googleapis`` checkout and the the branch should be the main branch on that remote (``master``). +- This repository contains configuration for the + `pre-commit `__ tool, which automates checking + our linters during a commit. If you have it installed on your ``$PATH``, + you can enable enforcing those checks via: + +.. code-block:: bash + + $ pre-commit install + pre-commit installed at .git/hooks/pre-commit + Exceptions to PEP8: - Many unit tests use a helper method, ``_call_fut`` ("FUT" is short for diff --git a/packages/google-cloud-bigquery-connection/noxfile.py b/packages/google-cloud-bigquery-connection/noxfile.py index 18dc5281da04..a57e24be11e3 100644 --- a/packages/google-cloud-bigquery-connection/noxfile.py +++ b/packages/google-cloud-bigquery-connection/noxfile.py @@ -81,9 +81,8 @@ def default(session): session.run( "py.test", "--quiet", - "--cov=google.cloud.bigqueryconnection", - "--cov=google.cloud", - "--cov=tests.unit", + "--cov=google/cloud", + "--cov=tests/unit", "--cov-append", "--cov-config=.coveragerc", "--cov-report=", diff --git a/packages/google-cloud-bigquery-connection/synth.metadata b/packages/google-cloud-bigquery-connection/synth.metadata index d84fc59af22f..f44e6e799bd8 100644 --- a/packages/google-cloud-bigquery-connection/synth.metadata +++ b/packages/google-cloud-bigquery-connection/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/python-bigquery-connection.git", - "sha": "6e85354f33041ba8612207f7bac4e2313d982e8c" + "sha": "f3ce3aa826173bf61b3b79803d0231c27f89e6fa" } }, { @@ -19,14 +19,14 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "9a7d9fbb7045c34c9d3d22c1ff766eeae51f04c9" + "sha": "f94318521f63085b9ccb43d42af89f153fb39f15" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "9a7d9fbb7045c34c9d3d22c1ff766eeae51f04c9" + "sha": "f94318521f63085b9ccb43d42af89f153fb39f15" } } ], @@ -85,6 +85,7 @@ ".kokoro/test-samples.sh", ".kokoro/trampoline.sh", ".kokoro/trampoline_v2.sh", + ".pre-commit-config.yaml", ".trampolinerc", "CODE_OF_CONDUCT.md", "CONTRIBUTING.rst",