Skip to content

Commit

Permalink
Switch formatters
Browse files Browse the repository at this point in the history
  • Loading branch information
hynek committed Sep 18, 2024
1 parent 2c77735 commit 23e23ec
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
8 changes: 2 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@ ci:
autoupdate_schedule: monthly

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

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

This comment has been minimized.

Copy link
@trim21

trim21 Sep 18, 2024

Contributor

ruff recommend users to put ruff-format after ruff --fix, ruff --fix may change file content to un-formatted state, and in that case pre-commit need to be executed 3 times to pass.

from "failed ruff-fix, faild ruff-format, finally pass" to "failed ruff-fix and ruff-format, finally pass"

This comment has been minimized.

Copy link
@hynek

hynek Sep 18, 2024

Author Owner

right, thanks!

- id: ruff
args: [--fix, --exit-non-zero-on-fix]

Expand Down
10 changes: 4 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,9 @@ fail-under = 100
whitelist-regex = ["test_.*"]


[tool.black]
line-length = 79


[tool.ruff]
src = ["src", "tests"]
line-length = 79

[tool.ruff.lint]
select = ["ALL"]
Expand All @@ -128,13 +125,14 @@ ignore = [
"ANN", # Mypy is better at this
"ARG", # unused arguments are common w/ interfaces
"C901", # sometimes you trade complexity for performance
"COM", # Black takes care of our commas
"COM", # Formatter takes care of our commas
"D", # We prefer our own docstring style.
"E501", # leave line-length enforcement to Black
"E501", # leave line-length enforcement to formatter
"EM101", # simple strings are fine
"FBT", # bools are our friends
"FIX", # Yes, we want XXX as a marker.
"INP001", # sometimes we want Python files outside of packages
"ISC001", # conflicts with formatter
"N802", # some names are non-pep8 due to stdlib logging / Twisted
"N803", # ditto
"N806", # ditto
Expand Down
4 changes: 3 additions & 1 deletion src/structlog/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,9 @@ def bind(self, **new_values: Any) -> BindableLogger:
# Looks like Protocols ignore definitions of __init__ so we have to
# silence Mypy here.
logger = cls(
_logger, processors=procs, context=ctx # type: ignore[call-arg]
_logger,
processors=procs,
context=ctx, # type: ignore[call-arg]
)

def finalized_bind(**new_values: Any) -> BindableLogger:
Expand Down

0 comments on commit 23e23ec

Please sign in to comment.