Skip to content

Commit

Permalink
Switch formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
hynek committed Nov 5, 2024
1 parent 57de35b commit 9f748ee
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
4 changes: 3 additions & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,10 @@ But it's way more comfortable to run it locally and *git* catching avoidable err
:rtype: str
"""
```

- If you add or change public APIs, tag the docstring using `.. versionadded:: 16.0.0 WHAT` or `.. versionchanged:: 16.2.0 WHAT`.
- We use [*isort*](https://github.com/PyCQA/isort) to sort our imports, and we use [*Black*](https://github.com/psf/black) with line length of 79 characters to format our code.

- 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*] 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.10.0
hooks:
- id: black

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.2
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
10 changes: 4 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ exclude_lines = [
omit = ["src/prometheus_async/types.py"]


[tool.black]
line-length = 79


[tool.interrogate]
omit-covered-files = true
verbose = 2
Expand Down Expand Up @@ -137,6 +133,7 @@ ignore_errors = true


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

[tool.ruff.lint]
Expand All @@ -146,13 +143,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

0 comments on commit 9f748ee

Please sign in to comment.