-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pre-commit configuration and workflow
Add our standard suite of pre-commit checks, including linting and formatting with ruff. Arrange to run these checks on pushes and pull requests. Remove the pep8 target from tox configuration. This includes a dependabot configuration to keep github action versions up to date.
- Loading branch information
Showing
5 changed files
with
78 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Set update schedule for GitHub Actions | ||
|
||
version: 2 | ||
updates: | ||
|
||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
# Check for updates to GitHub Actions every week | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: "Run pre-commit checks" | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
run-linters: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.12" | ||
|
||
- name: Configure caching | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/pre-commit | ||
key: precommit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }} | ||
|
||
- name: Install pre-commit | ||
run: | | ||
pip install pre-commit | ||
- name: Run linters | ||
run: | | ||
pre-commit run --all-files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v5.0.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: check-merge-conflict | ||
- id: end-of-file-fixer | ||
- id: check-added-large-files | ||
- id: check-case-conflict | ||
- id: check-json | ||
- id: check-symlinks | ||
- id: detect-private-key | ||
- id: check-executables-have-shebangs | ||
|
||
- repo: https://github.com/adrienverge/yamllint.git | ||
rev: v1.35.1 | ||
hooks: | ||
- id: yamllint | ||
files: \.(yaml|yml)$ | ||
types: [file, yaml] | ||
entry: yamllint --strict | ||
|
||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.9.1 | ||
hooks: | ||
- id: ruff | ||
- id: ruff-format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
extends: default | ||
rules: | ||
line-length: disable | ||
document-start: disable | ||
indentation: | ||
indent-sequences: whatever | ||
hyphens: | ||
max-spaces-after: 4 | ||
truthy: | ||
check-keys: false |