Skip to content
This repository was archived by the owner on Jul 21, 2026. It is now read-only.

Commit afcea88

Browse files
committed
Add pre-commit config and workflow
Bring this repository in line with other ESI repositories and introduce our standard linting and ruff-based formatting of Python code.
1 parent 3a3cda5 commit afcea88

5 files changed

Lines changed: 79 additions & 3 deletions

File tree

.github/dependabot.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Set update schedule for GitHub Actions
2+
3+
version: 2
4+
updates:
5+
6+
- package-ecosystem: "github-actions"
7+
directory: "/"
8+
schedule:
9+
# Check for updates to GitHub Actions every week
10+
interval: "weekly"

.github/workflows/precommit.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "Run pre-commit checks"
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
run-linters:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check out code
12+
uses: actions/checkout@v4
13+
14+
- name: Setup Python
15+
uses: actions/setup-python@v5
16+
with:
17+
python-version: "3.12"
18+
19+
- name: Configure caching
20+
uses: actions/cache@v4
21+
with:
22+
path: ~/.cache/pre-commit
23+
key: precommit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
24+
25+
- name: Install pre-commit
26+
run: |
27+
pip install pre-commit
28+
29+
- name: Run linters
30+
run: |
31+
pre-commit run --all-files

.github/workflows/tests.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: python-esileapclient
1+
name: Run unit tests
22

33
on: [push, pull_request]
44

@@ -20,7 +20,5 @@ jobs:
2020
run: |
2121
python -m pip install --upgrade pip
2222
pip install tox
23-
- name: Lint
24-
run: tox -epep8
2523
- name: Unit Tests
2624
run: tox -epy3

.pre-commit-config.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: check-merge-conflict
7+
- id: end-of-file-fixer
8+
- id: check-added-large-files
9+
- id: check-case-conflict
10+
- id: check-json
11+
- id: check-symlinks
12+
- id: detect-private-key
13+
- id: check-executables-have-shebangs
14+
15+
- repo: https://github.com/adrienverge/yamllint.git
16+
rev: v1.37.0
17+
hooks:
18+
- id: yamllint
19+
files: \.(yaml|yml)$
20+
types: [file, yaml]
21+
entry: yamllint --strict
22+
23+
- repo: https://github.com/astral-sh/ruff-pre-commit
24+
rev: v0.11.2
25+
hooks:
26+
- id: ruff
27+
- id: ruff-format

.yamllint.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
extends: default
2+
rules:
3+
line-length: disable
4+
document-start: disable
5+
indentation:
6+
indent-sequences: whatever
7+
hyphens:
8+
max-spaces-after: 4
9+
truthy:
10+
check-keys: false

0 commit comments

Comments
 (0)