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
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

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

View File

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

View File

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

View File

@ -43,15 +43,17 @@ c2VyMAoGCCqGSM49BAMCA0cAMEQCIEwPZhPpYhYHndfTEsWOxnxzJkmhAcYIMCeJ
d9kyq/fPAiBNCJw1MCLT8LjNlyUZCfwI2zuI3e0w6vuau89oj2zvVA==
-----END CERTIFICATE-----
`)
testKey = strings.TrimSpace(`
-----BEGIN EC PRIVATE KEY-----
testKey = maskKey(strings.TrimSpace(`
-----BEGIN EC TESTING KEY-----
MHcCAQEEIAqkBGGKTH5GzLx8XZLAHEFW2E8jT+jpy0p6w6MMR7DkoAoGCCqGSM49
AwEHoUQDQgAEZO1wQvjo2Jq1zoZu0WiYh1uEOVbBPojFfdAc6u2p7KgIW9OESOt2
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) {
library.SkipUnlessIntegration(t)
tmcClusterToken := library.Getenv(t, "PLACEHOLDER_NAME_TMC_CLUSTER_TOKEN")