Skip to content

Commit

Permalink
Pre commit fixes (techno-tim#167)
Browse files Browse the repository at this point in the history
* chore(dependencies): updated kube-vip to 0.5.6

* fix(pre-commit): pin to hash

* fix(pre-commit): added more hooks and fixed lint

* fix(pre-commit): added pre-commit hook so we don't have to run it manually

* fix(pre-commit): Added docs to readme

* fix(pre-commit): added texthooks

* fix(pre-commit): pin to hash

* fix(pre-commit): added mor hooks and fixed lint

* fix(lint): Fixing quotes

* fix(ci): only run test if linting passes

* fix(ci): convert to reusable workflows

* fix(pr template): Reorder steps
  • Loading branch information
timothystewart6 committed Nov 14, 2022
1 parent 88d679e commit 17a74b6
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
- [ ] Ran `site.yml` playbook
- [ ] Ran `reset.yml` playbook
- [ ] Did not add any unnecessary changes
- [ ] 🚀
- [ ] Ran pre-commit install at least once before committing
- [ ] 🚀
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: "CI"
on:
pull_request:
push:
branches:
- master
paths-ignore:
- '**/README.md'
jobs:
lint:
uses: ./.github/workflows/lint.yml
test:
uses: ./.github/workflows/test.yml
needs: [lint]
7 changes: 1 addition & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
---
name: Linting
on:
pull_request:
push:
branches:
- master
paths-ignore:
- '**/README.md'
workflow_call:
jobs:
pre-commit-ci:
name: Pre-Commit
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
---
name: Test
on:
pull_request:
push:
branches:
- master
paths-ignore:
- '**/README.md'
workflow_call:
jobs:
molecule:
name: Molecule
runs-on: macos-12

strategy:
matrix:
scenario:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.env/
*.log
*.log
22 changes: 18 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,35 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: 3298ddab3c13dd77d6ce1fc0baf97691430d84b0 # v4.3.0
hooks:
- id: requirements-txt-fixer
- id: sort-simple-yaml
- id: detect-private-key
- id: check-merge-conflict
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.28.0
rev: 9cce2940414e9560ae4c8518ddaee2ac1863a4d2 # v1.28.0
hooks:
- id: yamllint
args: [-c=.yamllint]
- repo: https://github.com/ansible-community/ansible-lint.git
rev: v6.8.2
rev: a058554b9bcf88f12ad09ab9fb93b267a214368f # v6.8.6
hooks:
- id: ansible-lint
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.8.0.4
rev: 4c7c3dd7161ef39e984cb295e93a968236dc8e8a # v0.8.0.4
hooks:
- id: shellcheck
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: 04618e68aa2380828a36a23ff5f65a06ae8f59b9 # v1.3.1
hooks:
- id: remove-crlf
- id: remove-tabs
- repo: https://github.com/sirosen/texthooks
rev: 30d9af95631de0d7cff4e282bde9160d38bb0359 # 0.4.0
hooks:
- id: fix-smartquotes
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,4 @@
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS
END OF TERMS AND CONDITIONS
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ It is run automatically in CI, but you can also run the tests locally.
This might be helpful for quick feedback in a few cases.
You can find more information about it [here](molecule/README.md).

### Pre-commit Hooks

This repo uses `pre-commit` and `pre-commit-hooks` to lint and fix common style and syntax errors. Be sure to install python packages and then run `pre-commit install`. For more information, see [pre-commit](https://pre-commit.com/)

## Thanks 🤝

This repo is really standing on the shoulders of giants. Thank you to all those who have contributed and thanks to these repos for code and ideas:
Expand Down
2 changes: 1 addition & 1 deletion ansible.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ scp_if_ssh = smart
retries = 3
ssh_args = -o ControlMaster=auto -o ControlPersist=30m -o Compression=yes -o ServerAliveInterval=15s
pipelining = True
control_path = %(directory)s/%%h-%%r
control_path = %(directory)s/%%h-%%r
2 changes: 1 addition & 1 deletion deploy.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

ansible-playbook site.yml -i inventory/my-cluster/hosts.ini
ansible-playbook site.yml -i inventory/my-cluster/hosts.ini
3 changes: 2 additions & 1 deletion requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ molecule-vagrant>=1.0.0
molecule>=4.0.3
netaddr>=0.8.0
pre-commit>=2.20.0
pre-commit-hooks>=1.3.1
pyyaml>=6.0
yamllint>=1.28.0
yamllint>=1.28.0
10 changes: 8 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ pluggy==1.0.0
# via molecule
pre-commit==2.20.0
# via -r requirements.in
pre-commit-hooks==4.3.0
# via -r requirements.in
pyasn1==0.4.8
# via
# pyasn1-modules
Expand Down Expand Up @@ -179,7 +181,9 @@ rich==12.6.0
rsa==4.9
# via google-auth
ruamel-yaml==0.17.21
# via ansible-lint
# via
# ansible-lint
# pre-commit-hooks
ruamel-yaml-clib==0.2.7
# via ruamel-yaml
selinux==0.2.1
Expand All @@ -196,7 +200,9 @@ text-unidecode==1.3
toml==0.10.2
# via pre-commit
tomli==2.0.1
# via black
# via
# black
# pre-commit-hooks
typing-extensions==4.4.0
# via
# black
Expand Down
8 changes: 4 additions & 4 deletions roles/k3s/master/templates/metallb.crds.j2
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ spec:
aggregationLength:
default: 32
description: The aggregation-length advertisement option lets
you roll up the /32s into a larger prefix.
you "roll up" the /32s into a larger prefix.
format: int32
minimum: 1
type: integer
Expand Down Expand Up @@ -167,7 +167,7 @@ spec:
aggregationLength:
default: 32
description: The aggregation-length advertisement option lets
you roll up the /32s into a larger prefix.
you "roll up" the /32s into a larger prefix.
format: int32
minimum: 1
type: integer
Expand Down Expand Up @@ -359,15 +359,15 @@ spec:
aggregationLength:
default: 32
description: The aggregation-length advertisement option lets you
roll up the /32s into a larger prefix. Defaults to 32. Works for
"roll up" the /32s into a larger prefix. Defaults to 32. Works for
IPv4 addresses.
format: int32
minimum: 1
type: integer
aggregationLengthV6:
default: 128
description: The aggregation-length advertisement option lets you
roll up the /128s into a larger prefix. Defaults to 128. Works
"roll up" the /128s into a larger prefix. Defaults to 128. Works
for IPv6 addresses.
format: int32
type: integer
Expand Down

0 comments on commit 17a74b6

Please sign in to comment.