Skip to content

Commit

Permalink
implements gha doc, yamlfmt, yamllint and global-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
leiicamundi committed Sep 19, 2024
1 parent 41b7d92 commit eea84b8
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 58 deletions.
21 changes: 8 additions & 13 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
---
# desc: lint sanity check
name: lint

on:
push:
workflow_dispatch:

workflow_dispatch:
pull_request:
push:
branches: [main]

jobs:
lint:
name: pre-commit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Install tooling using asdf
uses: asdf-vm/actions/install@05e0d2ed97b598bfce82fd30daf324ae0c4570e6 # v3

- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
lint:
uses: camunda/infraex-common-config/.github/workflows/lint-global.yml@feature/auto-update-renovate-doc
# TODO: pin the version on main
secrets: inherit
105 changes: 60 additions & 45 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,63 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-yaml
args: [--allow-multiple-documents]
- id: check-json
- id: check-symlinks
- id: check-shebang-scripts-are-executable
- id: detect-private-key

- repo: https://github.com/rhysd/actionlint
rev: v1.7.1
hooks:
- id: actionlint-docker

- repo: https://github.com/renovatebot/pre-commit-hooks
rev: 38.80.0
hooks:
- id: renovate-config-validator
args: ["--strict"]

- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.4.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
args: ["--strict" , "--force-scope"]

- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.95.0
hooks:
- id: terraform_fmt
- id: terraform_tflint
args:
- --args=--config=__GIT_WORKING_DIR__/.lint/tflint/.tflint.hcl
- id: terraform_docs
args:
- --hook-config=--path-to-file=README.md
- --hook-config=--create-file-if-not-exist=true
- --hook-config=--add-to-existing-file=true
- --args=--config=.lint/terraform_docs/.terraform-docs.yml
...
- repo: https://github.com/camunda/infraex-common-config
rev: 1.0.1 # use tags until renovate supports sha: https://github.com/renovatebot/renovate/issues/22567
hooks:
- id: update-action-readmes-docker

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-yaml
args: [--allow-multiple-documents]
- id: check-json
- id: check-symlinks
- id: check-shebang-scripts-are-executable
- id: detect-private-key

- repo: https://github.com/rhysd/actionlint
rev: v1.7.1
hooks:
- id: actionlint-docker

- repo: https://github.com/renovatebot/pre-commit-hooks
rev: 38.80.0
hooks:
- id: renovate-config-validator
args: [--strict]

- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.4.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
args: [--strict, --force-scope]

- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.95.0
hooks:
- id: terraform_fmt
- id: terraform_tflint
args:
- --args=--config=__GIT_WORKING_DIR__/.lint/tflint/.tflint.hcl
- id: terraform_docs
args:
- --hook-config=--path-to-file=README.md
- --hook-config=--create-file-if-not-exist=true
- --hook-config=--add-to-existing-file=true
- --args=--config=.lint/terraform_docs/.terraform-docs.yml

- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
hooks:
- id: yamllint
args: [-c, .yamllint.yaml]

- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 0.2.3
hooks:
- id: yamlfmt
17 changes: 17 additions & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
extends: default

rules:
document-start:
level: error
comments:
level: error
min-spaces-from-content: 1
comments-indentation:
level: error
line-length:
max: 175
truthy:
# prevent false positives on Github Actions workflow files with `on`,
# see https://github.com/adrienverge/yamllint/issues/158
check-keys: false

0 comments on commit eea84b8

Please sign in to comment.