Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repos:
hooks:
- id: check-pre-commit-ci-config
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.3
rev: v0.4.4
hooks:
- id: ruff
args: ['--fix', '--exit-non-zero-on-fix']
Expand Down
88 changes: 24 additions & 64 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -173,64 +173,6 @@ exclude_dirs = ['node_modules']
skips = ['*/*_test.py', '*/test_*.py']

[tool.ruff]
# This is a slight customisation of the default rules
# 1. Funnel still targets Python 3.7 pending an upgrade of production environment
# 2. Rule E402 (module-level import not top-level) is disabled as isort handles it
# 3. Rule E501 (line too long) is left to Black; some strings are worse for wrapping

# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
lint.select = ["E", "F"]
lint.ignore = ["E402", "E501"]

# Allow autofix for all enabled rules (when `--fix`) is provided.
lint.fixable = [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"I",
"N",
"Q",
"S",
"T",
"W",
"ANN",
"ARG",
"BLE",
"COM",
"DJ",
"DTZ",
"EM",
"ERA",
"EXE",
"FBT",
"ICN",
"INP",
"ISC",
"NPY",
"PD",
"PGH",
"PIE",
"PL",
"PT",
"PTH",
"PYI",
"RET",
"RSE",
"RUF",
"SIM",
"SLF",
"TCH",
"TID",
"TRY",
"UP",
"YTT",
]
lint.unfixable = []

# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
Expand Down Expand Up @@ -258,15 +200,30 @@ exclude = [
# Same as Black.
line-length = 88

# Allow unused variables when underscore-prefixed.
lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

# Target Python 3.9
target-version = "py39"

[tool.ruff.lint.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10
[tool.ruff.format]
docstring-code-format = true
quote-style = "preserve"

[tool.ruff.lint]
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
select = ["E", "F"]
ignore = ["E402", "E501"]

# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []

[tool.ruff.lint.extend-per-file-ignores]
"__init__.py" = ["E402"] # Allow non-top-level imports
"tests/**.py" = [
"S101", # Allow assert
"ANN001", # Args don't need types (usually fixtures)
"N802", # Fixture returning a class may be named per class name convention
"N803", # Args don't require naming convention (fixture could be a class)
]

[tool.ruff.lint.isort]
# These config options should match isort config above under [tool.isort]
Expand All @@ -290,3 +247,6 @@ repo = ['baseframe']
[tool.ruff.lint.flake8-pytest-style]
fixture-parentheses = false
mark-parentheses = false

[tool.ruff.lint.pyupgrade]
keep-runtime-typing = true
3 changes: 1 addition & 2 deletions src/baseframe/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
from pytz import utc
from wtforms import Field as WTField

from coaster.gfm import markdown
from coaster.utils import compress_whitespace, md5sum, text_blocks
from coaster.utils import compress_whitespace, markdown, md5sum, text_blocks

from .blueprint import baseframe
from .extensions import DEFAULT_LOCALE, _, cache, get_timezone
Expand Down