Skip to content

Commit

Permalink
Use ruff and update black
Browse files Browse the repository at this point in the history
  • Loading branch information
zerolab committed Oct 1, 2023
1 parent 6bb7015 commit 2fdabfe
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 39 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ __pycache__/
.fleet

.DS_Store
.ruff_cache
30 changes: 11 additions & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ default_language_version:
python: python3.8
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
rev: v4.4.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -14,23 +14,20 @@ repos:
args: ['--unsafe']
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 22.3.0
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.9.1
hooks:
- id: black
- repo: https://github.com/pycqa/isort
# isort config is in setup.cfg
rev: 5.12.0
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.16.0
hooks:
- id: isort
- repo: https://github.com/pycqa/flake8
# flake8 config is in setup.cfg
rev: 4.0.1
- id: blacken-docs
additional_dependencies: [black==23.9.1]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.0.291'
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
- flake8-comprehensions
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: 'v2.7.1'
hooks:
Expand All @@ -51,8 +48,3 @@ repos:
- [email protected]
- '@typescript-eslint/[email protected]'
- '@typescript-eslint/[email protected]'
- repo: https://github.com/asottile/blacken-docs
rev: v1.12.1
hooks:
- id: blacken-docs
additional_dependencies: [black==22.3.0]
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down Expand Up @@ -44,7 +43,7 @@ testing = [
"freezegun==1.1.0",
"django-rq>=2.5,<3.0",
"google-cloud-translate>=3.0.0",
"pre-commit>=2.21.0,<3.0"
"pre-commit>=3.4,<4"
]
documentation = [
"mkdocs==1.4.3",
Expand Down
34 changes: 34 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
target-version = "py38"

exclude = ["dist","build","venv",".venv",".tox",".git", "__pycache__", "node_modules", "LC_MESSAGES", "locale"]

select = [
"B", # flake8-bugbear
"BLE", # flake8-blind-except
"C4", # flake8-comprehensions
"DJ", # flake8-django
"E", # pycodestyle errors
"F", # pyflakes
"I", # isort
"PGH", # pygrep-hooks
"RUF100", # unused noqa
"S", # flake8-bandit
"T20", # flake8-print
"UP", # pyupgrade
"W", # pycodestyle warnings
"YTT", # flake8-2020
]

fixable = ["C4", "E", "F", "I", "UP"]

# E501: Line too long
ignore = ["E501","B028"]

[per-file-ignores]
"tests/**.py" = ["DJ008"]
"**/report_nightly_build_failure.py" = ["T201"]

[isort]
known-first-party = ["wagtail_localize"]
lines-between-types = 1
lines-after-imports = 2
12 changes: 0 additions & 12 deletions setup.cfg

This file was deleted.

6 changes: 0 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ DATABASE =
postgres: postgres
sqlite: sqlite

[flake8]
# E501: Line too long
# W503: line break before binary operator (superseded by W504 line break after binary operator)
ignore = E501,W503
exclude = migrations,node_modules

[testenv]
pass_env =
FORCE_COLOR
Expand Down

0 comments on commit 2fdabfe

Please sign in to comment.