Skip to content

Commit ed1c6a2

Browse files
authored
Merge pull request #40 from Jibola/add-precommit
PYTHON-4687: Adding precommit and linting to repo
2 parents 13719f9 + 57c5a7a commit ed1c6a2

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed

.github/workflows/lint.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Pipeline Lint
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
concurrency:
8+
group: tests-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
defaults:
12+
run:
13+
shell: bash -eux {0}
14+
15+
jobs:
16+
17+
lint:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.10'
24+
- name: Install Python dependencies
25+
run: |
26+
python -m pip install -U pip pre-commit
27+
- name: Run linters
28+
run: |
29+
pre-commit run --hook-stage=manual --all-files

.pre-commit-config.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.5.0
4+
hooks:
5+
- id: check-added-large-files
6+
- id: check-case-conflict
7+
- id: check-toml
8+
- id: check-yaml
9+
exclude: template.yaml
10+
- id: debug-statements
11+
- id: end-of-file-fixer
12+
exclude: WHEEL
13+
exclude_types: [json]
14+
- id: forbid-new-submodules
15+
- id: trailing-whitespace
16+
exclude: .patch
17+
exclude_types: [json]
18+
19+
- repo: https://github.com/astral-sh/ruff-pre-commit
20+
# Ruff version.
21+
rev: v0.1.3
22+
hooks:
23+
- id: ruff
24+
args: ["--fix", "--show-fixes"]
25+
- id: ruff-format
26+
27+
- repo: https://github.com/adamchainz/blacken-docs
28+
rev: "1.16.0"
29+
hooks:
30+
- id: blacken-docs
31+
additional_dependencies:
32+
- black==22.3.0
33+
34+
# We use the Python version instead of the original version which seems to require Docker
35+
# https://github.com/koalaman/shellcheck-precommit
36+
- repo: https://github.com/shellcheck-py/shellcheck-py
37+
rev: v0.9.0.6
38+
hooks:
39+
- id: shellcheck
40+
name: shellcheck
41+
args: ["--severity=warning"]
42+
stages: [manual]
43+
44+
- repo: https://github.com/sirosen/check-jsonschema
45+
rev: 0.29.0
46+
hooks:
47+
- id: check-github-workflows
48+
- id: check-github-actions
49+
- id: check-jsonschema
50+
files: .*/(database|indexes)/.json$
51+
52+
- repo: https://github.com/codespell-project/codespell
53+
rev: "v2.2.6"
54+
hooks:
55+
- id: codespell

0 commit comments

Comments
 (0)