diff --git a/.gitattributes b/.gitattributes index ff2ea64ec3..78fb299413 100644 --- a/.gitattributes +++ b/.gitattributes @@ -10,6 +10,7 @@ scripts/ export-ignore .cspell.json export-ignore .gitattributes export-ignore .gitignore export-ignore +.yamllint.yml export-ignore phpcs.xml.dist export-ignore phpstan.neon.dist export-ignore phpunit.xml.dist export-ignore diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index f2bd3555d5..eeb39a09f0 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -63,3 +63,18 @@ jobs: diff -B ./src/Standards/PSR12/ruleset.xml <(xmllint --format "./src/Standards/PSR12/ruleset.xml") diff -B ./src/Standards/Squiz/ruleset.xml <(xmllint --format "./src/Standards/Squiz/ruleset.xml") diff -B ./src/Standards/Zend/ruleset.xml <(xmllint --format "./src/Standards/Zend/ruleset.xml") + + yamllint: + name: 'Lint Yaml' + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run Yamllint on all yaml files in repo + run: yamllint . --format colored --strict + + - name: Pipe Yamllint results on to GH for inline display + if: ${{ failure() }} + run: yamllint . --format github --strict diff --git a/.yamllint.yml b/.yamllint.yml new file mode 100644 index 0000000000..76ea3dce5f --- /dev/null +++ b/.yamllint.yml @@ -0,0 +1,23 @@ +# Details on the default config: +# https://yamllint.readthedocs.io/en/stable/configuration.html#default-configuration +extends: default + +yaml-files: + - '*.yaml' + - '*.yml' + - '.yamllint' + - 'phpstan.neon' + +# Rule documentation: https://yamllint.readthedocs.io/en/stable/rules.html +rules: + colons: + max-spaces-after: -1 # Disabled to allow aligning of values. + comments: + min-spaces-from-content: 1 + comments-indentation: {} + document-start: + present: false + line-length: + max: 150 + truthy: + allowed-values: ["true", "false", "on", "off"]