Add ruff-isort formatter (#279)

`ruff` doesn't run isort as part of its format, so to maintain parity
with the sort rules that black/isort offer, this is the ruff isort.

---------

Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
This commit is contained in:
Chris Rose 2024-01-12 11:23:26 -08:00 committed by GitHub
parent 1d6f821784
commit 96a9805ecb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 56 additions and 0 deletions

View file

@ -25,6 +25,7 @@ The format is based on [Keep a Changelog].
for JSON ([#257]).
* [`robotidy`](https://robotidy.readthedocs.io) for Robot Framework files
([#263]).
* [`ruff-isort`](https://github.com/astral-sh/ruff) for [Python](https://python.org) imports using ruff ([#279]).
* [denofmt](https://docs.deno.com/runtime/manual/tools/formatter) for
js, jsx, ts, tsx, json, jsonc, md files. ([#264])
* [docformatter](https://github.com/PyCQA/docformatter) for Python docstrings ([#267])
@ -51,6 +52,7 @@ The format is based on [Keep a Changelog].
[#271]: https://github.com/radian-software/apheleia/pull/271
[#274]: https://github.com/radian-software/apheleia/issues/274
[#275]: https://github.com/radian-software/apheleia/pull/275
[#279]: https://github.com/radian-software/apheleia/pull/279
## 4.0 (released 2023-11-23)
### Breaking changes

View file

@ -167,6 +167,12 @@
(apheleia-formatters-fill-column "--line-length")
"--stdin-filename" filepath
"-"))
(ruff-isort . ("ruff" "check"
"-n"
"--select" "I"
"--fix" "--fix-only"
"--stdin-filename" filepath
"-"))
(shfmt . ("shfmt"
"-filename" filepath
"-ln" (cl-case (bound-and-true-p sh-shell)

View file

@ -0,0 +1,2 @@
apt-get install -y python3-pip
pip install ruff

View file

@ -0,0 +1,20 @@
from my_lib import Object
import os
from my_lib import Object3
from my_lib import Object2
import sys
from third_party import lib15, lib1, lib2, lib3, lib4, lib5, lib6, lib7, lib8, lib9, lib10, lib11, lib12, lib13, lib14
import sys
from __future__ import absolute_import
from third_party import lib3
print("Hey")
print("yo")

View file

@ -0,0 +1,26 @@
from __future__ import absolute_import
import os
import sys
from my_lib import Object, Object2, Object3
from third_party import (
lib1,
lib2,
lib3,
lib4,
lib5,
lib6,
lib7,
lib8,
lib9,
lib10,
lib11,
lib12,
lib13,
lib14,
lib15,
)
print("Hey")
print("yo")