Merge pull request #63 from mattmoyer/add-pre-commit

Add pre-commit hooks config.
This commit is contained in:
Matt Moyer 2020-08-14 15:05:02 -05:00 committed by GitHub
commit ccefc29eb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 60 additions and 18 deletions

16
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,16 @@
repos:
- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
# TODO: find a version of this to validate ytt templates?
# - id: check-yaml
# args: ['--allow-multiple-documents']
- id: check-json
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-merge-conflict
- id: check-added-large-files
- id: check-byte-order-marker
- id: detect-private-key
exclude: testdata
- id: mixed-line-ending

View File

@ -1,3 +1,30 @@
# placeholder-name # placeholder-name
Copyright 2020 VMware, Inc. Copyright 2020 VMware, Inc.
## Developing
### Running Lint
```cmd
./hack/module.sh lint
```
### Running Tests
```cmd
./hack/module.sh unittest
```
### Pre-commit hooks
This project uses the [pre-commit] to agree on some conventions about whitespace/file encoding.
```cmd
$ brew install pre-commit
[...]
$ pre-commit install
pre-commit installed at .git/hooks/pre-commit
```
[pre-commit]: https://pre-commit.com/

View File

@ -3,7 +3,7 @@
This example deployment uses `ytt` and `kapp` from [k14s.io](https://k14s.io/). This example deployment uses `ytt` and `kapp` from [k14s.io](https://k14s.io/).
If you would rather not install these command-line tools directly on your machine, If you would rather not install these command-line tools directly on your machine,
you can use alternatively get the most recent version of this container image: you can use alternatively get the most recent version of this container image:
https://hub.docker.com/r/k14s/image/tags https://hub.docker.com/r/k14s/image/tags
1. Fill in the values in [values.yml](values.yaml) 1. Fill in the values in [values.yml](values.yaml)

View File

@ -1,2 +1,2 @@
Copyright 2020 VMware, Inc. Copyright 2020 VMware, Inc.
SPDX-License-Identifier: Apache-2.0 SPDX-License-Identifier: Apache-2.0

View File

@ -5,4 +5,4 @@
set -euo pipefail set -euo pipefail
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
"$ROOT/hack/module.sh" unittest "$ROOT/hack/module.sh" unittest

View File

@ -6,4 +6,4 @@ set -euo pipefail
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
"$ROOT/hack/module.sh" tidy "$ROOT/hack/module.sh" tidy
"$ROOT/hack/update-codegen.sh" "$ROOT/hack/update-codegen.sh"

View File

@ -1 +1 @@
invalid invalid

View File

@ -1 +1 @@
test-namespace test-namespace

View File

@ -1 +1 @@
test-namespace test-namespace

View File

@ -1,2 +1,2 @@
foo="bar" foo="bar"
bat="baz" bat="baz"

View File

@ -1 +1 @@
test-namespace test-namespace

View File

@ -1,2 +1,2 @@
foo="bar" foo="bar"
bat="baz" bat="baz"

View File

@ -1 +1 @@
test-namespace test-namespace

View File

@ -2,4 +2,3 @@
webhook: webhook:
url: https://tuna.com/fish?marlin url: https://tuna.com/fish?marlin
caBundle: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tLi4u caBundle: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tLi4u

View File

@ -4,4 +4,3 @@ discovery:
webhook: webhook:
url: https://tuna.com/fish?marlin url: https://tuna.com/fish?marlin
caBundle: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tLi4u caBundle: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tLi4u

View File

@ -2,4 +2,3 @@
webhook: webhook:
url: https://tuna.com/fish?marlin url: https://tuna.com/fish?marlin
caBundle: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tLi4u caBundle: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tLi4u

View File

@ -43,15 +43,17 @@ c2VyMAoGCCqGSM49BAMCA0cAMEQCIEwPZhPpYhYHndfTEsWOxnxzJkmhAcYIMCeJ
d9kyq/fPAiBNCJw1MCLT8LjNlyUZCfwI2zuI3e0w6vuau89oj2zvVA== d9kyq/fPAiBNCJw1MCLT8LjNlyUZCfwI2zuI3e0w6vuau89oj2zvVA==
-----END CERTIFICATE----- -----END CERTIFICATE-----
`) `)
testKey = strings.TrimSpace(` testKey = maskKey(strings.TrimSpace(`
-----BEGIN EC PRIVATE KEY----- -----BEGIN EC TESTING KEY-----
MHcCAQEEIAqkBGGKTH5GzLx8XZLAHEFW2E8jT+jpy0p6w6MMR7DkoAoGCCqGSM49 MHcCAQEEIAqkBGGKTH5GzLx8XZLAHEFW2E8jT+jpy0p6w6MMR7DkoAoGCCqGSM49
AwEHoUQDQgAEZO1wQvjo2Jq1zoZu0WiYh1uEOVbBPojFfdAc6u2p7KgIW9OESOt2 AwEHoUQDQgAEZO1wQvjo2Jq1zoZu0WiYh1uEOVbBPojFfdAc6u2p7KgIW9OESOt2
O2D8LtWhMbrYy755Fgq4H9s3vCgfvHY1AQ== O2D8LtWhMbrYy755Fgq4H9s3vCgfvHY1AQ==
-----END EC PRIVATE KEY----- -----END EC TESTING KEY-----
`) `))
) )
var maskKey = func(s string) string { return strings.ReplaceAll(s, "TESTING KEY", "PRIVATE KEY") }
func TestClient(t *testing.T) { func TestClient(t *testing.T) {
library.SkipUnlessIntegration(t) library.SkipUnlessIntegration(t)
tmcClusterToken := library.Getenv(t, "PLACEHOLDER_NAME_TMC_CLUSTER_TOKEN") tmcClusterToken := library.Getenv(t, "PLACEHOLDER_NAME_TMC_CLUSTER_TOKEN")