From b42c00959f77d61b538cef36b706174faa15c952 Mon Sep 17 00:00:00 2001 From: Patrick Schratz Date: Sun, 6 Oct 2024 14:41:54 +0200 Subject: [PATCH] chore: update and apply linters (#231) --- .editorconfig | 12 ++++++++++++ .editorconfig-checker.json | 22 ++++++++++++++++++++++ .prettierignore | 4 ++++ .woodpecker/lint.yaml | 33 +++++++++++++++++++++++++++++++++ .woodpecker/release-helper.yml | 5 ++--- .woodpecker/release.yml | 4 ++-- Makefile | 15 +++++++++++++++ 7 files changed, 90 insertions(+), 5 deletions(-) create mode 100644 .editorconfig create mode 100644 .editorconfig-checker.json create mode 100644 .prettierignore create mode 100644 .woodpecker/lint.yaml diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..8f5d8087 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = false +insert_final_newline = true diff --git a/.editorconfig-checker.json b/.editorconfig-checker.json new file mode 100644 index 00000000..f8cbd3b3 --- /dev/null +++ b/.editorconfig-checker.json @@ -0,0 +1,22 @@ +{ + "Verbose": false, + "Debug": false, + "IgnoreDefaults": false, + "SpacesAftertabs": false, + "NoColor": false, + "Exclude": [ + "LICENSE", + ".git/", + "Makefile" + ], + "AllowedContentTypes": [], + "PassedFiles": [], + "Disable": { + "EndOfLine": false, + "Indentation": false, + "IndentSize": false, + "InsertFinalNewline": false, + "TrimTrailingWhitespace": false, + "MaxLineLength": false + } +} diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..fc52265a --- /dev/null +++ b/.prettierignore @@ -0,0 +1,4 @@ +charts/woodpecker/templates/ +charts/woodpecker/server/templates/ +charts/woodpecker/agent/templates/ +values.yaml diff --git a/.woodpecker/lint.yaml b/.woodpecker/lint.yaml new file mode 100644 index 00000000..8e6f4f32 --- /dev/null +++ b/.woodpecker/lint.yaml @@ -0,0 +1,33 @@ +when: + - event: tag + - event: push + branch: main + - event: pull_request + +steps: + lint-markdown: + depends_on: [] + image: docker.io/davidanson/markdownlint-cli2:v0.14.0 + commands: + - 'markdownlint-cli2 *.{md,markdown}' + + editor-config: + image: docker.io/mstruebing/editorconfig-checker:v3.0.3 + depends_on: [] + commands: + - ec --config .editorconfig-checker.json . + + helm-lint: + image: docker.io/alpine/helm:3.16.1 + depends_on: [] + commands: + - helm dependency update charts/woodpecker + - helm lint --with-subcharts charts/* + + lint-yaml: + image: docker.io/pipelinecomponents/yamllint:0.32.1 + depends_on: [] + commands: + - yamllint . + when: + path: '*.{yml,yaml}' diff --git a/.woodpecker/release-helper.yml b/.woodpecker/release-helper.yml index 81c1f3f4..3fb66483 100644 --- a/.woodpecker/release-helper.yml +++ b/.woodpecker/release-helper.yml @@ -1,11 +1,10 @@ when: event: push - branch: - ${CI_REPO_DEFAULT_BRANCH} + branch: ${CI_REPO_DEFAULT_BRANCH} steps: release-helper: - image: woodpeckerci/plugin-ready-release-go:2.0.0 + image: docker.io/woodpeckerci/plugin-ready-release-go:2.0.0 pull: true settings: release_branch: ${CI_REPO_DEFAULT_BRANCH} diff --git a/.woodpecker/release.yml b/.woodpecker/release.yml index 7856eabe..fdd1521c 100644 --- a/.woodpecker/release.yml +++ b/.woodpecker/release.yml @@ -31,13 +31,13 @@ steps: - event: tag update-readme: - image: jnorwood/helm-docs:v1.14.2 + image: docker.io/jnorwood/helm-docs:v1.14.2 commands: - helm-docs - cat charts/woodpecker/README.md push-readme: - image: appleboy/drone-git-push:1.1.0 + image: docker.io/appleboy/drone-git-push:1.1.0 settings: remote: ssh://git@github.com/woodpecker-ci/helm.git branch: main diff --git a/Makefile b/Makefile index 8d70f236..a18ae132 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,21 @@ docs: helm-docs +lint-markdown: + markdownlint-cli2 *.{md,markdown} + +lint-yaml: + yamllint --strict -f colored . + +lint-editorconfig: + editorconfig-checker --config .editorconfig-checker.json . + +lint-helm: + helm lint --with-subcharts charts/* + +.PHONY: lint +lint: lint-helm lint-yaml lint-markdown lint-editorconfig + .PHONY: test test: helm unittest --strict -f 'unittests/**/*.yaml' ./charts/woodpecker/