From 67d529ae6cf4e4f42e2e84a0694649f26ad19f13 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 29 Dec 2020 07:54:09 -0800 Subject: [PATCH] chore: add config / docs for 'pre-commit' support (#38) 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 Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> --- .../.pre-commit-config.yaml | 17 +++++++++++++++++ .../CONTRIBUTING.rst | 10 ++++++++++ .../google-cloud-access-approval/synth.metadata | 6 ++++-- 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 packages/google-cloud-access-approval/.pre-commit-config.yaml diff --git a/packages/google-cloud-access-approval/.pre-commit-config.yaml b/packages/google-cloud-access-approval/.pre-commit-config.yaml new file mode 100644 index 000000000000..fb80a95e88bb --- /dev/null +++ b/packages/google-cloud-access-approval/.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.2.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-access-approval/CONTRIBUTING.rst b/packages/google-cloud-access-approval/CONTRIBUTING.rst index 4aef11c3ae31..95226d2b5a6a 100644 --- a/packages/google-cloud-access-approval/CONTRIBUTING.rst +++ b/packages/google-cloud-access-approval/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-access-approval/synth.metadata b/packages/google-cloud-access-approval/synth.metadata index a43de519c156..037b446e4733 100644 --- a/packages/google-cloud-access-approval/synth.metadata +++ b/packages/google-cloud-access-approval/synth.metadata @@ -19,14 +19,14 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "a073c873f3928c561bdf87fdfbf1d081d1998984" + "sha": "32af6da519a6b042e3da62008e2a75e991efb6b4" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "a073c873f3928c561bdf87fdfbf1d081d1998984" + "sha": "32af6da519a6b042e3da62008e2a75e991efb6b4" } } ], @@ -85,11 +85,13 @@ ".kokoro/test-samples.sh", ".kokoro/trampoline.sh", ".kokoro/trampoline_v2.sh", + ".pre-commit-config.yaml", ".trampolinerc", "CODE_OF_CONDUCT.md", "CONTRIBUTING.rst", "LICENSE", "MANIFEST.in", + "accessapproval-v1-py.tar.gz", "docs/_static/custom.css", "docs/_templates/layout.html", "docs/accessapproval_v1/services.rst",