Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-170: add yamllint and run over the repo #230

Merged
merged 4 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 4 additions & 3 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
name: Test examples

on:
push:
paths:
- "glass/**"
- glass/**
branches:
- main
pull_request:
paths:
- "glass/**"
- glass/**

concurrency:
# Skip intermediate builds: always.
Expand All @@ -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
1 change: 1 addition & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: PR Title Checker
on:
pull_request_target:
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -30,7 +31,8 @@ jobs:
path: dist/*

publish:
needs: [dist]
needs:
- dist
runs-on: ubuntu-latest
environment:
name: publish
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Test

on:
Expand All @@ -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:
Expand Down
51 changes: 50 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
ci:
autoupdate_commit_msg: "MNT: update pre-commit hooks"
autofix_commit_msg: "STY: pre-commit fixes"
Expand All @@ -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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to add these args as config in pyproject.toml? Looks good otherwise!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can always add "move some of the pre-commit config to pyproject" as a to-do item.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry this is my bad. These options have been tried and tested, but I have some hacky "global" pre-commit hooks, where I don't want to have the same config everywhere https://github.com/paddyroddy/.github/blob/main/precommit/general/general-hooks.yaml

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to add these args as config in pyproject.toml? Looks good otherwise!

It's not by the way, but can add to a .yamllint.yaml file

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thanks for looking into this, keeping it as it is should be fine!

- >-
--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
Expand Down
1 change: 1 addition & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
version: 2

build:
Expand Down