Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add isort.order-by-type boolean setting
The default `isort` behavior is `order-by-type = true`. When imports are ordered by type: 1. `CONSTANT_VARIABLES` are first. 2. `CamelCaseClasses` are second. 3. `everything_else` is third. - https://pycqa.github.io/isort/docs/configuration/options.html#order-by-type When `order-by-type = false` imports are ordered alphabetically (case-insensitive). eg. `order-by-type = false` ```py import BAR import bar import FOO import foo import StringIO from module import Apple, BASIC, Class, CONSTANT, function ``` `order-by-type = true` ```py import BAR import bar import FOO import foo import StringIO from module import BASIC, CONSTANT, Apple, Class, function ```
- Loading branch information
1 parent
8d99e31
commit 86b17f7
Showing
5 changed files
with
73 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/isort/snapshots/ruff__isort__tests__order_by_type_false_order_by_type.py.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
source: src/isort/mod.rs | ||
expression: checks | ||
--- | ||
- kind: UnsortedImports | ||
location: | ||
row: 1 | ||
column: 0 | ||
end_location: | ||
row: 13 | ||
column: 0 | ||
fix: | ||
content: "import glob\nimport os\nimport shutil\nimport tempfile\nimport time\nfrom subprocess import PIPE, Popen, STDOUT\n\nimport BAR\nimport bar\nimport FOO\nimport foo\nimport StringIO\nfrom module import Apple, BASIC, Class, CONSTANT, function\n" | ||
location: | ||
row: 1 | ||
column: 0 | ||
end_location: | ||
row: 13 | ||
column: 0 | ||
parent: ~ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters