Skip to content

Commit

Permalink
feat: Add pre-commit & workflows --no-verify
Browse files Browse the repository at this point in the history
  • Loading branch information
BruDriguezz committed Nov 4, 2024
1 parent b8fe7c0 commit 98c6f15
Show file tree
Hide file tree
Showing 5 changed files with 213 additions and 2 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "Lint"

on:
workflow_dispatch:
push:
branches:
- master
pull_request:

jobs:
lint_test:
runs-on: ubuntu-latest
steps:
- name: "Checkout repository"
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0

- name: "Setup PDM"
uses: pdm-project/setup-pdm@568ddd69406b30de1774ec0044b73ae06e716aa4 # v4
with:
python-version: "3.12"
cache: true

- name: "Install dependencies"
run: pdm install --dev

- name: "Run precommit"
run: pdm precommit
25 changes: 25 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-case-conflict
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: check-json
- id: trailing-whitespace
args: [ --markdown-linebreak-ext=md ]
- id: mixed-line-ending
args: [ --fix=lf ]
- id: end-of-file-fixer

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.0
hooks:
- id: ruff-format
- id: ruff

- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.352
hooks:
- id: pyright
156 changes: 155 additions & 1 deletion pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,9 @@ distribution = true
[tool.pdm.dev-dependencies]
linting = [
"ruff>=0.7.2",
"pre-commit>=4.0.1",
"pyright>=1.1.387",
]

[tool.pdm.scripts]
precommit = { shell = "pre-commit run --all-files" }
2 changes: 1 addition & 1 deletion src/ao3/_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __init__(
self._session = ClientSession()
self._session.headers.update(
{
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36'
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"
}
) # TODO: This will become a centralized requester API soon-ish.

Expand Down

0 comments on commit 98c6f15

Please sign in to comment.