From 9524155922ef37d8fa8eb845905dcba4e280c51c Mon Sep 17 00:00:00 2001 From: vanzan01 Date: Thu, 12 Jun 2025 23:51:33 +0800 Subject: [PATCH 1/6] Add yamllint pre-commit hook for YAML file standardization Add yamllint hook to .pre-commit-config.yaml to standardize YAML files across the project. Created .yamllint.yml configuration with relaxed rules to accommodate existing files. Fixed colon spacing in .asf.yaml to pass yamllint checks. Closes #10974 Signed-off-by: vanzan01 --- .asf.yaml | 6 +++--- .pre-commit-config.yaml | 8 ++++++++ .yamllint.yml | 27 +++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 .yamllint.yml diff --git a/.asf.yaml b/.asf.yaml index 0603bf8e487f..7bdfdd442e75 100644 --- a/.asf.yaml +++ b/.asf.yaml @@ -64,7 +64,7 @@ github: protected_branches: ~ notifications: - commits: commits@cloudstack.apache.org - issues: commits@cloudstack.apache.org + commits: commits@cloudstack.apache.org + issues: commits@cloudstack.apache.org pullrequests: commits@cloudstack.apache.org - discussions: users@cloudstack.apache.org + discussions: users@cloudstack.apache.org diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a9bc87454f1c..41d6bd7961c6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -95,3 +95,11 @@ repos: args: [--config=.github/linters/.markdown-lint.yml] types: [markdown] files: \.(md|mdown|markdown)$ + - repo: https://github.com/adrienverge/yamllint + rev: v1.35.1 + hooks: + - id: yamllint + name: run yamllint + description: check YAML files with yamllint + args: [--config-file=.yamllint.yml] + files: \.(yaml|yml)$ diff --git a/.yamllint.yml b/.yamllint.yml new file mode 100644 index 000000000000..9856969ae509 --- /dev/null +++ b/.yamllint.yml @@ -0,0 +1,27 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software 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. +--- +extends: relaxed + +rules: + line-length: + max: 200 # Very lenient for existing files + indentation: disable # Disable indentation checking for existing files + comments: disable # Disable comment formatting checks + brackets: disable # Disable bracket spacing checks + truthy: + allowed-values: ['true', 'false', 'on', 'off', 'yes', 'no'] \ No newline at end of file From 89cf7a6fb3232c8ec4c77ebe96b922c8548bda59 Mon Sep 17 00:00:00 2001 From: vanzan01 Date: Sat, 14 Jun 2025 09:28:37 +0800 Subject: [PATCH 2/6] Add extra eol to .yamllint.yml Address review comment from DaanHoogland Signed-off-by: vanzan01 --- .yamllint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.yamllint.yml b/.yamllint.yml index 9856969ae509..90974260a110 100644 --- a/.yamllint.yml +++ b/.yamllint.yml @@ -24,4 +24,4 @@ rules: comments: disable # Disable comment formatting checks brackets: disable # Disable bracket spacing checks truthy: - allowed-values: ['true', 'false', 'on', 'off', 'yes', 'no'] \ No newline at end of file + allowed-values: ['true', 'false', 'on', 'off', 'yes', 'no'] From 6a94e6fe4024f437efd62c8a26e8c891c8efc339 Mon Sep 17 00:00:00 2001 From: vanzan01 Date: Fri, 20 Jun 2025 23:51:12 +0800 Subject: [PATCH 3/6] Move .yamllint.yml to .github/linters/ and improve file pattern - Move .yamllint.yml to .github/linters/ directory for better organization - Update pre-commit config to point to new location - Change file pattern to \.ya?ml$ as suggested Address review feedback from jbampton Signed-off-by: vanzan01 --- .yamllint.yml => .github/linters/.yamllint.yml | 0 .pre-commit-config.yaml | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename .yamllint.yml => .github/linters/.yamllint.yml (100%) diff --git a/.yamllint.yml b/.github/linters/.yamllint.yml similarity index 100% rename from .yamllint.yml rename to .github/linters/.yamllint.yml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 41d6bd7961c6..b652c6024be0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -101,5 +101,5 @@ repos: - id: yamllint name: run yamllint description: check YAML files with yamllint - args: [--config-file=.yamllint.yml] - files: \.(yaml|yml)$ + args: [--config-file=.github/linters/.yamllint.yml] + files: \.ya?ml$ From c3f9d6087ab7c8170030220aea7a700ed34ff1e8 Mon Sep 17 00:00:00 2001 From: vanzan01 <35181591+vanzan01@users.noreply.github.com> Date: Sat, 21 Jun 2025 00:04:01 +0800 Subject: [PATCH 4/6] Update .pre-commit-config.yaml Co-authored-by: John Bampton --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b652c6024be0..d7455058c4ca 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -96,7 +96,7 @@ repos: types: [markdown] files: \.(md|mdown|markdown)$ - repo: https://github.com/adrienverge/yamllint - rev: v1.35.1 + rev: v1.37.1 hooks: - id: yamllint name: run yamllint From 7fb54b5c168b667ef4b87f6cf6931932c259ecc5 Mon Sep 17 00:00:00 2001 From: vanzan01 Date: Sat, 21 Jun 2025 00:47:45 +0800 Subject: [PATCH 5/6] Make yamllint more forgiving and exclude only k8s templates - Remove extensive file exclusions, keep only k8s templates - Increase line length limit to 400 chars (GitHub Actions friendly) - Allow flexible colon spacing (max-spaces-after: -1) - Disable document-start requirement This provides linting value while handling infrastructure patterns. Signed-off-by: vanzan01 --- .github/linters/.yamllint.yml | 6 +++++- .pre-commit-config.yaml | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/linters/.yamllint.yml b/.github/linters/.yamllint.yml index 90974260a110..8a72aee0adbe 100644 --- a/.github/linters/.yamllint.yml +++ b/.github/linters/.yamllint.yml @@ -19,9 +19,13 @@ extends: relaxed rules: line-length: - max: 200 # Very lenient for existing files + max: 400 # Very forgiving for GitHub Actions and infrastructure files indentation: disable # Disable indentation checking for existing files comments: disable # Disable comment formatting checks brackets: disable # Disable bracket spacing checks + colons: + max-spaces-after: -1 # Allow any number of spaces after colon + max-spaces-before: 0 + document-start: disable # Many files don't have --- truthy: allowed-values: ['true', 'false', 'on', 'off', 'yes', 'no'] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d7455058c4ca..46fecba69c6e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -103,3 +103,4 @@ repos: description: check YAML files with yamllint args: [--config-file=.github/linters/.yamllint.yml] files: \.ya?ml$ + exclude: ^.*k8s-.*\.ya?ml$ From e74dd6d4545e984a71318bf41a312940d8e8ea12 Mon Sep 17 00:00:00 2001 From: vanzan01 <35181591+vanzan01@users.noreply.github.com> Date: Wed, 16 Jul 2025 09:02:11 +0800 Subject: [PATCH 6/6] Update .pre-commit-config.yaml Co-authored-by: John Bampton --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 46fecba69c6e..27072fa6317d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -102,5 +102,6 @@ repos: name: run yamllint description: check YAML files with yamllint args: [--config-file=.github/linters/.yamllint.yml] + types: [yaml] files: \.ya?ml$ exclude: ^.*k8s-.*\.ya?ml$