diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 5d59b30f5..1d5f0ecbb 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -62,7 +62,7 @@ jobs: # and modify them (or add more) to build your code if your project # uses a compiled language - #- run: | + # - run: | # make bootstrap # make release diff --git a/.github/workflows/conformance.yml b/.github/workflows/conformance.yml index 3451325f6..4414b5932 100644 --- a/.github/workflows/conformance.yml +++ b/.github/workflows/conformance.yml @@ -107,7 +107,7 @@ jobs: nkg_prefix=$(echo ${{ steps.meta.outputs.tags }} | cut -d ":" -f 1) nkg_tag=$(echo ${{ steps.meta.outputs.tags }} | cut -d ":" -f 2) if [ ${{ github.event_name }} == "schedule" ]; then - export GW_API_VERSION=main + export GW_API_VERSION=main fi make install-nkg-local-no-build NKG_PREFIX=${nkg_prefix} NKG_TAG=${nkg_tag} working-directory: ./conformance diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 613cffd74..4be00b6b8 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -81,13 +81,13 @@ jobs: name: Markdown Lint runs-on: ubuntu-22.04 steps: - - name: Checkout Repository - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + - name: Checkout Repository + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - - uses: DavidAnson/markdownlint-cli2-action@8f3516061301755c97ff833a8e933f09282cc5b5 # v11.0.0 - with: - config: ${{ github.workspace }}/.markdownlint-cli2.yaml - globs: '**/*.md' + - uses: DavidAnson/markdownlint-cli2-action@8f3516061301755c97ff833a8e933f09282cc5b5 # v11.0.0 + with: + config: ${{ github.workspace }}/.markdownlint-cli2.yaml + globs: '**/*.md' chart-lint: name: Chart Lint @@ -97,3 +97,16 @@ jobs: uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Lint chart run: make lint-helm + + yaml-lint: + name: Yaml Lint + runs-on: ubuntu-22.04 + steps: + - name: Checkout Repository + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + + - name: Install yamllint + run: pip install yamllint + + - name: Lint YAML files + run: yamllint . diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index 633e93ca8..334f32c2e 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -2,6 +2,7 @@ name: Scorecards supply-chain security on: # Only the default branch is supported. branch_protection_rule: + types: [created, edited, deleted] schedule: - cron: "27 5 * * 0" push: diff --git a/.golangci.yml b/.golangci.yml index 656cb6818..7b84de3ec 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -34,11 +34,11 @@ linters-settings: min-complexity: 15 govet: enable: - - fieldalignment + - fieldalignment lll: line-length: 120 linters: - enable: + enable: - asciicheck - errcheck - errorlint @@ -63,7 +63,7 @@ linters: - unparam - unused - wastedassign - disable-all: true + disable-all: true issues: max-issues-per-linter: 0 max-same-issues: 0 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4a155f1de..47069ea9b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -49,13 +49,20 @@ repos: - id: golangci-lint args: [--new-from-patch=/tmp/diff.patch] - # Rules are in .markdownlint-cli2.yaml file - # See https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md for rule descriptions + # Rules are in .markdownlint-cli2.yaml file + # See https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md for rule descriptions - repo: https://github.com/DavidAnson/markdownlint-cli2 rev: v0.8.1 hooks: - - id: markdownlint-cli2-fix + - id: markdownlint-cli2-fix + + # Rules are in .yamllint.yaml file + # See https://yamllint.readthedocs.io/en/stable/rules.html# for rule descriptions + - repo: https://github.com/adrienverge/yamllint.git + rev: v1.29.0 + hooks: + - id: yamllint ci: - skip: [golang-diff, golangci-lint, prettier, markdownlint-cli2-fix] + skip: [golang-diff, golangci-lint, prettier, markdownlint-cli2-fix, yamllint] autofix_prs: false diff --git a/.yamllint.yaml b/.yamllint.yaml new file mode 100644 index 000000000..ee5549f96 --- /dev/null +++ b/.yamllint.yaml @@ -0,0 +1,50 @@ +--- + +yaml-files: + - '*.yaml' + - '*.yml' + +ignore: + - deploy/helm-chart/templates/ + - deploy/helm-chart/crds/ + +rules: + braces: enable + brackets: enable + colons: enable + commas: enable + comments: + require-starting-space: true + ignore-shebangs: true + min-spaces-from-content: 1 + comments-indentation: enable + document-end: disable + document-start: disable + empty-lines: enable + empty-values: enable + float-values: disable + hyphens: enable + indentation: + spaces: consistent + indent-sequences: consistent + check-multi-line-strings: true + ignore: | + deploy/manifests/nginx-gateway.yaml + deploy/manifests/njs-modules.yaml + key-duplicates: enable + key-ordering: disable + line-length: + max: 120 + allow-non-breakable-words: true + allow-non-breakable-inline-mappings: true + ignore: | + .github/workflows/ + deploy/manifests/nginx-gateway.yaml + new-line-at-end-of-file: enable + new-lines: enable + octal-values: disable + quoted-strings: disable + trailing-spaces: enable + truthy: + ignore: | + .github/workflows/ diff --git a/examples/http-header-filter/echo-route.yaml b/examples/http-header-filter/echo-route.yaml index b3f5da29d..b92357128 100644 --- a/examples/http-header-filter/echo-route.yaml +++ b/examples/http-header-filter/echo-route.yaml @@ -22,7 +22,7 @@ spec: add: - name: Accept-Encoding value: compress - - name: My-cool-header + - name: My-cool-header value: this-is-an-appended-value remove: - User-Agent diff --git a/examples/http-header-filter/headers.yaml b/examples/http-header-filter/headers.yaml index a15cd0379..4324c41e9 100644 --- a/examples/http-header-filter/headers.yaml +++ b/examples/http-header-filter/headers.yaml @@ -30,6 +30,7 @@ apiVersion: v1 kind: ConfigMap metadata: name: headers-config +# yamllint disable rule:indentation data: nginx.conf: |- user nginx; @@ -61,7 +62,7 @@ data: return s; } export default {getRequestHeaders}; - +# yamllint enable rule:indentation --- apiVersion: v1 kind: Service