Skip to content

Commit

Permalink
Use ruff format (#831)
Browse files Browse the repository at this point in the history
* Use ruff format instead of black

* Update scripts/check

* Keep the 120 line limit

* Simplify ruff format

* Update scripts/lint

* Update pyproject.toml

Co-authored-by: T-256 <132141463+T-256@users.noreply.github.com>

* Revert "Update pyproject.toml"

This reverts commit fd0ef87.

---------

Co-authored-by: T-256 <132141463+T-256@users.noreply.github.com>
  • Loading branch information
karpetrosyan and T-256 committed Dec 4, 2023
1 parent ef610e2 commit 6633b9f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,16 @@ exclude = [
"httpcore/_sync",
"tests/_sync",
]
line-length = 120
line-length = 88
select = [
"E",
"F",
"W",
"I"
]

[tool.ruff.pycodestyle]
max-line-length = 120

[tool.ruff.isort]
combine-as-imports = true
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ build==1.0.3
twine

# Tests & Linting
black==23.11.0
coverage[toml]==7.3.2
ruff==0.1.3
mypy==1.7.1
Expand Down
2 changes: 1 addition & 1 deletion scripts/check
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ export SOURCE_FILES="httpcore tests"
set -x

${PREFIX}ruff check --show-source $SOURCE_FILES
${PREFIX}black --exclude '/(_sync|sync_tests)/' --check --diff $SOURCE_FILES
${PREFIX}ruff format $SOURCE_FILES --diff
${PREFIX}mypy $SOURCE_FILES
scripts/unasync --check
2 changes: 1 addition & 1 deletion scripts/lint
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export SOURCE_FILES="httpcore tests"
set -x

${PREFIX}ruff --fix $SOURCE_FILES
${PREFIX}black --exclude '/(_sync|sync_tests)/' $SOURCE_FILES
${PREFIX}ruff format $SOURCE_FILES

# Run unasync last because its `--check` mode is not aware of code formatters.
# (This means sync code isn't prettified, and that's mostly okay.)
Expand Down

0 comments on commit 6633b9f

Please sign in to comment.