mirror of
https://github.com/vale981/apheleia
synced 2025-03-04 17:11:40 -05:00
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:
parent
1d6f821784
commit
96a9805ecb
5 changed files with 56 additions and 0 deletions
|
@ -25,6 +25,7 @@ The format is based on [Keep a Changelog].
|
||||||
for JSON ([#257]).
|
for JSON ([#257]).
|
||||||
* [`robotidy`](https://robotidy.readthedocs.io) for Robot Framework files
|
* [`robotidy`](https://robotidy.readthedocs.io) for Robot Framework files
|
||||||
([#263]).
|
([#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
|
* [denofmt](https://docs.deno.com/runtime/manual/tools/formatter) for
|
||||||
js, jsx, ts, tsx, json, jsonc, md files. ([#264])
|
js, jsx, ts, tsx, json, jsonc, md files. ([#264])
|
||||||
* [docformatter](https://github.com/PyCQA/docformatter) for Python docstrings ([#267])
|
* [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
|
[#271]: https://github.com/radian-software/apheleia/pull/271
|
||||||
[#274]: https://github.com/radian-software/apheleia/issues/274
|
[#274]: https://github.com/radian-software/apheleia/issues/274
|
||||||
[#275]: https://github.com/radian-software/apheleia/pull/275
|
[#275]: https://github.com/radian-software/apheleia/pull/275
|
||||||
|
[#279]: https://github.com/radian-software/apheleia/pull/279
|
||||||
|
|
||||||
## 4.0 (released 2023-11-23)
|
## 4.0 (released 2023-11-23)
|
||||||
### Breaking changes
|
### Breaking changes
|
||||||
|
|
|
@ -167,6 +167,12 @@
|
||||||
(apheleia-formatters-fill-column "--line-length")
|
(apheleia-formatters-fill-column "--line-length")
|
||||||
"--stdin-filename" filepath
|
"--stdin-filename" filepath
|
||||||
"-"))
|
"-"))
|
||||||
|
(ruff-isort . ("ruff" "check"
|
||||||
|
"-n"
|
||||||
|
"--select" "I"
|
||||||
|
"--fix" "--fix-only"
|
||||||
|
"--stdin-filename" filepath
|
||||||
|
"-"))
|
||||||
(shfmt . ("shfmt"
|
(shfmt . ("shfmt"
|
||||||
"-filename" filepath
|
"-filename" filepath
|
||||||
"-ln" (cl-case (bound-and-true-p sh-shell)
|
"-ln" (cl-case (bound-and-true-p sh-shell)
|
||||||
|
|
2
test/formatters/installers/ruff-isort.bash
Normal file
2
test/formatters/installers/ruff-isort.bash
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
apt-get install -y python3-pip
|
||||||
|
pip install ruff
|
20
test/formatters/samplecode/ruff-isort/in.py
Normal file
20
test/formatters/samplecode/ruff-isort/in.py
Normal 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")
|
26
test/formatters/samplecode/ruff-isort/out.py
Normal file
26
test/formatters/samplecode/ruff-isort/out.py
Normal 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")
|
Loading…
Add table
Reference in a new issue