Skip to content

Commit

Permalink
chore: add pre-commit hook (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored Dec 8, 2020
1 parent 901c300 commit 0510ef6
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 17 deletions.
15 changes: 7 additions & 8 deletions packages/google-cloud-container/.coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Generated by synthtool. DO NOT EDIT!
[run]
branch = True

[report]
fail_under = 100
show_missing = True
omit =
google/cloud/container/__init__.py
exclude_lines =
# Re-enable the standard pragma
pragma: NO COVER
# Ignore debug-only repr
def __repr__
# Ignore abstract methods
raise NotImplementedError
omit =
*/gapic/*.py
*/proto/*.py
*/core/*.py
*/site-packages/*.py
# Ignore pkg_resources exceptions.
# This is added at the module level as a safeguard for if someone
# generates the code and tries to run it without pip installing. This
# makes it virtually impossible to test properly.
except pkg_resources.DistributionNotFound
17 changes: 17 additions & 0 deletions packages/google-cloud-container/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions packages/google-cloud-container/CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <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
Expand Down
5 changes: 1 addition & 4 deletions packages/google-cloud-container/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,7 @@
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
"python": ("https://python.readthedocs.org/en/latest/", None),
"google-auth": (
"https://googleapis.dev/python/google-auth/latest/index.html",
None,
),
"google-auth": ("https://googleapis.dev/python/google-auth/latest/", None),
"google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,),
"grpc": ("https://grpc.github.io/grpc/python/", None),
"proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None),
Expand Down
5 changes: 2 additions & 3 deletions packages/google-cloud-container/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@ def default(session):
session.run(
"py.test",
"--quiet",
"--cov=google.cloud.container",
"--cov=google.cloud",
"--cov=tests.unit",
"--cov=google/cloud",
"--cov=tests/unit",
"--cov-append",
"--cov-config=.coveragerc",
"--cov-report=",
Expand Down
5 changes: 3 additions & 2 deletions packages/google-cloud-container/synth.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"git": {
"name": ".",
"remote": "https://github.com/googleapis/python-container.git",
"sha": "20401fb2dfa4ac59d385926d345db979473c4688"
"sha": "6a0fef7f30976357cc9f42c0213931d1a2c76eac"
}
},
{
Expand All @@ -19,7 +19,7 @@
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
"sha": "9a7d9fbb7045c34c9d3d22c1ff766eeae51f04c9"
"sha": "f94318521f63085b9ccb43d42af89f153fb39f15"
}
}
],
Expand Down Expand Up @@ -87,6 +87,7 @@
".kokoro/test-samples.sh",
".kokoro/trampoline.sh",
".kokoro/trampoline_v2.sh",
".pre-commit-config.yaml",
".trampolinerc",
"CODE_OF_CONDUCT.md",
"CONTRIBUTING.rst",
Expand Down

0 comments on commit 0510ef6

Please sign in to comment.