Skip to content

Commit

Permalink
Switch formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
hynek committed Sep 18, 2024
1 parent cd38a81 commit 6c63404
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ You will find the built documentation in `docs/_build/html`.
- If you add or change public APIs, tag the docstring using `.. versionadded:: 24.1.0 WHAT` or `.. versionchanged:: 24.1.0 WHAT`.
We follow CalVer, so the next version will be the current with with the middle number incremented (for example, `24.1.0` -> `24.2.0`).

- We use [Ruff](https://ruff.rs/) to sort our imports, and we follow the [Black](https://github.com/psf/black) code style with a line length of 79 characters.
- We use [Ruff](https://ruff.rs/) to sort our imports and format our code with a line length of 79 characters.
As long as you run our full *tox* suite before committing, or install our [*pre-commit*](https://pre-commit.com/) hooks (ideally you'll do both -- see [*Local Development Environment*](#local-development-environment) above), you won't have to spend any time on formatting your code at all.
If you don't, CI will catch it for you -- but that seems like a waste of your time!

Expand Down
6 changes: 1 addition & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@ 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
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format

- repo: https://github.com/econchick/interrogate
rev: 1.7.0
Expand Down
4 changes: 1 addition & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ def docs(session: nox.Session) -> None:

for cmd in cmds:
session.run(
# fmt: off
"python", "-Im", "sphinx",
"-T", "-E",
"-W", "--keep-going",
Expand All @@ -144,5 +143,4 @@ def docs(session: nox.Session) -> None:
"-n",
"docs",
"docs/_build/html",
# fmt: on
)
) # fmt: skip
10 changes: 4 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -160,25 +160,23 @@ module = "noxfile"
disallow_untyped_decorators = false


[tool.black]
line-length = 79


[tool.ruff]
src = ["src", "tests", "noxfile.py", "docs/conf.py"]
line-length = 79

[tool.ruff.lint]
select = ["ALL"]
ignore = [
"A001", # shadowing is fine
"ANN", # Mypy is better at this
"ARG001", # unused arguments are normal when implementing interfaces
"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
"FBT", # we have one function that takes one bool; c'mon!
"FIX", # Yes, we want XXX as a marker.
"INP001", # sometimes we want Python files outside of packages
"ISC001", # conflicts with formatter
"PLR0913", # yes, many arguments, but most have defaults
"PLR2004", # numbers are sometimes fine
"SLF001", # private members are accessed by friendly functions
Expand Down
2 changes: 1 addition & 1 deletion src/stamina/instrumentation/_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


def init_hooks(
maybe_delayed: tuple[RetryHook | RetryHookFactory, ...]
maybe_delayed: tuple[RetryHook | RetryHookFactory, ...],
) -> tuple[RetryHook, ...]:
"""
Execute delayed hook factories and return a tuple of finalized hooks.
Expand Down

0 comments on commit 6c63404

Please sign in to comment.