From 46bbd92218475ed5bbe1d4cf4736d392ea3d2cfd Mon Sep 17 00:00:00 2001 From: "Patrick J. Roddy" Date: Mon, 23 Sep 2024 11:46:32 +0100 Subject: [PATCH] gh-170: add `yamllint` and run over the repo (#230) Add `yamllint` as a pre-commit hook and format all the YAML files in the repository. Refs: #170 Co-authored-by: Saransh Chopra --- .github/dependabot.yml | 9 +++--- .github/workflows/examples.yml | 7 ++-- .github/workflows/pull_request.yml | 1 + .github/workflows/release.yml | 8 +++-- .github/workflows/test.yml | 8 ++++- .pre-commit-config.yaml | 51 +++++++++++++++++++++++++++++- .readthedocs.yml | 1 + 7 files changed, 73 insertions(+), 12 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 9a11bdb2..1cac8340 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,8 +1,9 @@ +--- version: 2 updates: - - package-ecosystem: "github-actions" - directory: "/" + - package-ecosystem: github-actions + directory: / schedule: - interval: "weekly" + interval: weekly commit-message: - prefix: "DEV" + prefix: DEV diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index b465a8c2..aa23b4c7 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -1,14 +1,15 @@ +--- name: Test examples on: push: paths: - - "glass/**" + - glass/** branches: - main pull_request: paths: - - "glass/**" + - glass/** concurrency: # Skip intermediate builds: always. @@ -27,6 +28,6 @@ jobs: fetch-depth: 0 - uses: actions/setup-python@v5 with: - python-version: "3.x" + python-version: 3.x cache: pip - run: pipx run --spec '.[examples]' jupyter execute examples/**/*.ipynb diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 222e10c0..66f6fb25 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -1,3 +1,4 @@ +--- name: PR Title Checker on: pull_request_target: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 26febed9..16b692c8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,11 +1,12 @@ +--- name: Release on: workflow_dispatch: inputs: target: - description: 'Deployment target. Can be "pypi" or "testpypi"' - default: "testpypi" + description: Deployment target. Can be pypi or testpypi. + default: testpypi release: types: - published @@ -30,7 +31,8 @@ jobs: path: dist/* publish: - needs: [dist] + needs: + - dist runs-on: ubuntu-latest environment: name: publish diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 24a405ec..b647f753 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,3 +1,4 @@ +--- name: Test on: @@ -19,7 +20,12 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: + - "3.8" + - "3.9" + - "3.10" + - "3.11" + - "3.12" steps: - uses: actions/checkout@v4 with: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5d3d9f09..79361b08 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,4 @@ +--- ci: autoupdate_commit_msg: "MNT: update pre-commit hooks" autofix_commit_msg: "STY: pre-commit fixes" @@ -24,11 +25,59 @@ repos: - id: rst-backticks - id: rst-directive-colons - id: rst-inline-touching-normal + - repo: https://github.com/adrienverge/yamllint + rev: v1.35.1 + hooks: + - id: yamllint + args: + - >- + --config-data={ + extends: default, + rules: { + anchors: enable, + braces: { + forbid: non-empty + }, + brackets: { + forbid: non-empty + }, + colons: enable, + commas: enable, + comments: { + min-spaces-from-content: 1 + }, + comments-indentation: enable, + document-end: disable, + document-start: enable, + empty-lines: enable, + empty-values: disable, + float-values: enable, + hyphens: enable, + indentation: enable, + key-duplicates: enable, + key-ordering: disable, + line-length: enable, + new-line-at-end-of-file: enable, + new-lines: enable, + octal-values: enable, + quoted-strings: { + quote-type: double, + required: only-when-needed + }, + trailing-spaces: enable, + truthy: { + check-keys: false + } + } + } + - --strict - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.6.3 hooks: - id: ruff - args: ["--fix", "--show-fixes"] + args: + - --fix + - --show-fixes - id: ruff-format - repo: https://github.com/pappasam/toml-sort rev: v0.23.1 diff --git a/.readthedocs.yml b/.readthedocs.yml index 98d9e442..da56d1d7 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,3 +1,4 @@ +--- version: 2 build: