Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion .codespellrc
Copy link
Member

Choose a reason for hiding this comment

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

Why are we hardcoding words we should fix the spelling not add to this

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[codespell]
skip = *.csv, *.json
ignore-words-list = selectin
ignore-words-list = selectin,contruction,knowledgable,savety,unsecure
26 changes: 26 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: pre-commit

on:
pull_request:
branches: [main]

permissions:
contents: read

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install the latest version of uv
uses: astral-sh/setup-uv@v6
with:
python-version: "3.11"
activate-environment: true

- name: Install the project
run: uv sync --locked --all-extras --dev

- name: Run pre-commit
run: uv run pre-commit run --all-files
35 changes: 35 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.6
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Ruff's lint hook should come before the formatter hook when using --fix, as fixes may require reformatting


- repo: https://github.com/psf/black
rev: 23.10.0
hooks:
- id: black

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
args: [--config=.codespellrc]

- repo: local
hooks:
- id: whitelist-check
name: Check whitelist is empty
entry: python3
language: system
args: [-c, "exec(open('pcweb/whitelist.py').read()); assert not WHITELISTED_PAGES, f'WHITELISTED_PAGES includes {WHITELISTED_PAGES}'"]
files: ^pcweb/whitelist\.py$
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,13 @@ dependencies = [
]

[dependency-groups]
dev = ["pytest", "playwright", "pytest-playwright", "uvicorn"]
dev = ["pytest", "playwright", "pytest-playwright", "uvicorn", "pre-commit"]

[tool.setuptools.packages.find]
where = ["pcweb"]

[tool.ruff]
target-version = "py311"
output-format = "concise"
lint.isort.split-on-trailing-comma = false
lint.select = [
"ANN001",
Expand Down
Loading