Skip to content

Commit

Permalink
Lint yaml more aggressively
Browse files Browse the repository at this point in the history
  • Loading branch information
asmacdo committed Jun 10, 2024
1 parent 1490445 commit 7d0fd7a
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 33 deletions.
23 changes: 12 additions & 11 deletions .github/workflows/readme-updated.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Check README.md helptext

on:
Expand All @@ -12,17 +13,17 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v2

- name: Install duct
run: |
pip install .
- name: Install duct
run: |
pip install .
- name: Update README.md helptext
run: |
./.update-readme-help.sh
- name: Update README.md helptext
run: |
./.update-readme-help.sh
- name: Ensure no diff
run: |
git diff --exit-code
- name: Ensure no diff
run: |
git diff --exit-code
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Auto-release on PR merge

on:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Test

on:
Expand Down
49 changes: 29 additions & 20 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,37 +1,46 @@
---
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
exclude: (profilers|sandbox|\.chatgpt)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
- id: black
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/PyCQA/flake8
- id: isort
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
- flake8-builtins
- flake8-unused-arguments
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
- repo: local
hooks:
- id: update-readme
name: Update README with --help output
entry: ./.update-readme-help.sh
language: system
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
- repo: local
hooks:
- id: update-readme
name: Update README with --help output
entry: ./.update-readme-help.sh
language: system
- repo: local
hooks:
- id: yamllint
name: "YAML linting with yamllint"
entry: yamllint
language: system
types: [yaml]
args: ["."]
5 changes: 3 additions & 2 deletions .update-readme-help.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
set -e
rm -f .help_content.txt
duct --help > .help_content.txt
sed -i '/<\!--- BEGIN HELP -->/,/<\!--- END HELP -->/{//!d;}' README.md
sed -i '/<\!--- BEGIN HELP -->/r .help_content.txt' README.md
rm .help_content.txt
sed -i '/<\!--- BEGIN HELP -->/r .help_content.txt' README.md && rm -f .help_content.txt
34 changes: 34 additions & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---

yaml-files:
- '*.yaml'
- '*.yml'
- '.yamllint'

rules:
line-length: disable
truthy: disable
anchors: enable
braces: enable
brackets: enable
colons: enable
commas: enable
comments:
level: warning
comments-indentation:
level: warning
document-end: disable
document-start:
level: warning
empty-lines: enable
empty-values: disable
float-values: disable
hyphens: enable
indentation: enable
key-duplicates: enable
key-ordering: disable
new-line-at-end-of-file: enable
new-lines: enable
octal-values: disable
quoted-strings: disable
trailing-spaces: enable

0 comments on commit 7d0fd7a

Please sign in to comment.