chore: add config / docs for 'pre-commit' support (#103)
Source-Author: Tres Seaver <tseaver@palladion.com>
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
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..fb80a95
--- /dev/null
+++ b/.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/CONTRIBUTING.rst b/CONTRIBUTING.rst
index d77c486..3f971e6 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -111,6 +111,16 @@
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 <https://pre-commit.com/>`__ 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/synth.metadata b/synth.metadata
index 1d8cb42..e401af9 100644
--- a/synth.metadata
+++ b/synth.metadata
@@ -4,14 +4,14 @@
"git": {
"name": ".",
"remote": "https://github.com/googleapis/python-api-core.git",
- "sha": "fcf261fc3c4c1f28f2fa13d055716cf70d21f6f5"
+ "sha": "93976931f231da6b42304bd117d8481067c55f6a"
}
},
{
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
- "sha": "a073c873f3928c561bdf87fdfbf1d081d1998984"
+ "sha": "32af6da519a6b042e3da62008e2a75e991efb6b4"
}
}
],
@@ -58,6 +58,7 @@
".kokoro/test-samples.sh",
".kokoro/trampoline.sh",
".kokoro/trampoline_v2.sh",
+ ".pre-commit-config.yaml",
".trampolinerc",
"CODE_OF_CONDUCT.md",
"CONTRIBUTING.rst",