Skip to content

Commit

Permalink
Add pre-commit config file
Browse files Browse the repository at this point in the history
... so that we can run the validation in CI later. This also fixes
a few errors detected atm.
  • Loading branch information
kajinamit committed Jul 27, 2023
1 parent 22118f4 commit b0aab13
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 3 deletions.
18 changes: 18 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
linters:
# Enable specific linter
# https://golangci-lint.run/usage/linters/#enabled-by-default
enable:
- errorlint
- revive
- ginkgolinter
- gofmt
- govet
linters-settings:
revive:
rules:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter
- name: unused-parameter
severity: warning
disabled: true
run:
timeout: 5m
62 changes: 62 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
repos:
- repo: local
hooks:
- id: gotidy
name: gotidy
language: system
entry: make
args: ["tidy"]
pass_filenames: false
- id: make-manifests
name: make-manifests
language: system
entry: make
args: ['manifests']
pass_filenames: false
- id: make-generate
name: make-generate
language: system
entry: make
args: ['generate']
pass_filenames: false
- id: make-operator-lint
name: make-operator-lint
language: system
entry: make
args: ['operator-lint']
pass_filenames: false

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
- id: fix-byte-order-marker
- id: check-case-conflict
- id: check-executables-have-shebangs
exclude: ^vendor
- id: check-shebang-scripts-are-executable
exclude: ^vendor
- id: check-merge-conflict
- id: check-symlinks
- id: destroyed-symlinks
- id: check-yaml
args: [-m]
- id: check-json
- id: detect-private-key
- id: end-of-file-fixer
exclude: ^vendor
- id: no-commit-to-branch
- id: trailing-whitespace
exclude: ^vendor

- repo: https://github.com/openstack/bashate.git
rev: 2.1.1
hooks:
- id: bashate
entry: bashate --error . --ignore=E006,E040,E011,E020,E012

- repo: https://github.com/golangci/golangci-lint
rev: v1.52.2
hooks:
- id: golangci-lint
args: ["-v"]
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,3 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

2 changes: 1 addition & 1 deletion hack/boilerplate.go.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
*/
2 changes: 1 addition & 1 deletion templates/common/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ function merge_config_dir {
cp -f ${conf} /var/lib/config-data/merged/
fi
done
}
}

0 comments on commit b0aab13

Please sign in to comment.