Skip to content

Commit

Permalink
ci+pre-commit changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonGrace2282 committed May 15, 2024
1 parent c4f0b79 commit 2c0d5de
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ jobs:
pipenv install --dev --deploy
- name: Check formatting with format.sh
run: pipenv run ./scripts/format.sh && test -z "$(git status --porcelain=v1 .)"
run: pipenv run pre-commit run --all-files
33 changes: 24 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
exclude: ^tin/static/.*vendor
files: ^tin/.*
exclude: ^tin/(static/.*vendor|.*migrations)

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand All @@ -9,17 +10,31 @@ repos:
- id: trailing-whitespace
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: local
hooks:
- id: format
name: format
entry: ./scripts/format.sh && test -z "$(git status --porcelain=v1 .)"
language: system
types: [python]
pass_filenames: false
- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
hooks:
- id: codespell
files: ^.*\.(py|md|rst)$
args: ["-L", "num,ans", "-w"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.5
hooks:
- id: ruff
args: [ "--fix", "--exit-non-zero-on-fix" ]
name: ruff lint
- id: ruff-format
# - repo: https://github.com/psf/black
# rev: 24.4.2
# hooks:
# - id: black
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
- id: isort
name: isort (cython)
types: [cython]
- id: isort
name: isort (pyi)
types: [pyi]
76 changes: 76 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,79 @@ exclude = '''
)/
'''

[tool.ruff]
exclude = [
"migrations",
"Ion.egg-info",
".eggs",
".git",
".github",
".hg",
".mypy_cache",
".tox",
".venv",
".env",
"venv",
"env",
"secret.",
"build",
]

# show fixes made in stdout
# show-fixes = true

line-length = 100

target-version = "py38"

[tool.ruff.lint]
select = [
# flake8-bugbear
"B",
# flake8-comprehensions
"C4",
# flake8-django
"DJ",
# pycodestyle
"E",
# Pyflakes
"F",
# flake8-no-pep420
"INP",
# Pylint
"PL",
# ruff
"RUF",
# pyupgrade
"UP",
]
ignore = [
# default arguments for timezone.now()
"B008",
# null=True on CharField/TextField
"DJ001",
# No __str__ method on Model
"DJ008",
# Django order of model methods
"DJ012",
# ambiguous variable name
"E741",
# branching
"PLR09",
# avoid magic numbers
"PLR2004",
# loop variables overwritten by assignment
"PLW2901",
# Use ternary operator (x if cond else y)
"RUF005",
# mutable class attrs annotated as typing.ClassVar
"RUF012",
# implicit Optional
"RUF013",
# use format specifiers instead of percent format
"UP031",
]

[tool.ruff.format]
docstring-code-format = true
line-ending = "lf"

0 comments on commit 2c0d5de

Please sign in to comment.