-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[isort
] Add support for length-sort settings
#8841
Merged
Merged
Conversation
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
The `UnicodeWidthStr` trait yields "displayed width of Unicode strings". Some tests with non-ASCII characters were added.
- Makes more sense to have force_to_top first - Allows to place maybe_length after force_to_top but before distance
The name does not contain the dots for relative imports so the number of dots has to be added
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
ANN001 | 5 | 0 | 5 | 0 | 0 |
ANN201 | 5 | 0 | 5 | 0 | 0 |
E402 | 4 | 0 | 4 | 0 | 0 |
Q000 | 2 | 0 | 2 | 0 | 0 |
D210 | 2 | 0 | 2 | 0 | 0 |
D300 | 2 | 0 | 2 | 0 | 0 |
D400 | 2 | 0 | 2 | 0 | 0 |
D415 | 2 | 0 | 2 | 0 | 0 |
Q002 | 2 | 0 | 2 | 0 | 0 |
ARG002 | 2 | 0 | 2 | 0 | 0 |
COM812 | 1 | 0 | 1 | 0 | 0 |
DTZ001 | 1 | 0 | 1 | 0 | 0 |
T201 | 1 | 0 | 1 | 0 | 0 |
D200 | 1 | 0 | 1 | 0 | 0 |
D102 | 1 | 0 | 1 | 0 | 0 |
ANN101 | 1 | 0 | 1 | 0 | 0 |
ANN002 | 1 | 0 | 1 | 0 | 0 |
ANN003 | 1 | 0 | 1 | 0 | 0 |
C408 | 1 | 0 | 1 | 0 | 0 |
D205 | 1 | 0 | 1 | 0 | 0 |
D208 | 1 | 0 | 1 | 0 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+0 -57 violations, +0 -0 fixes in 41 projects)
apache/airflow (+0 -13 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --preview --select ALL
- tests/system/providers/amazon/aws/example_hive_to_dynamodb.py:103:31: ANN001 Missing type annotation for function argument `connection_id` - tests/system/providers/amazon/aws/example_hive_to_dynamodb.py:103:46: ANN001 Missing type annotation for function argument `hostname` - tests/system/providers/amazon/aws/example_hive_to_dynamodb.py:103:5: ANN201 Missing return type annotation for public function `configure_hive_connection` - tests/system/providers/amazon/aws/example_hive_to_dynamodb.py:110:10: COM812 [*] Trailing comma missing - tests/system/providers/amazon/aws/example_hive_to_dynamodb.py:117:16: DTZ001 The use of `datetime.datetime()` without `tzinfo` argument is not allowed - tests/system/providers/amazon/aws/example_hive_to_dynamodb.py:1:1: CPY001 Missing copyright notice at top of file - tests/system/providers/amazon/aws/example_hive_to_dynamodb.py:52:27: ANN001 Missing type annotation for function argument `table_name` - tests/system/providers/amazon/aws/example_hive_to_dynamodb.py:52:5: ANN201 Missing return type annotation for public function `create_dynamodb_table` - tests/system/providers/amazon/aws/example_hive_to_dynamodb.py:72:29: ANN001 Missing type annotation for function argument `table_name` - tests/system/providers/amazon/aws/example_hive_to_dynamodb.py:72:5: ANN201 Missing return type annotation for public function `get_dynamodb_item_count` - tests/system/providers/amazon/aws/example_hive_to_dynamodb.py:86:5: T201 `print` found ... 2 additional changes omitted for project
bokeh/bokeh (+0 -44 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --preview --select ALL
- src/bokeh/server/views/metadata_handler.py:12:1: E265 Block comment should start with `# ` - src/bokeh/server/views/metadata_handler.py:14:1: E265 Block comment should start with `# ` - src/bokeh/server/views/metadata_handler.py:17:15: E261 [*] Insert at least two spaces before an inline comment - src/bokeh/server/views/metadata_handler.py:1:1: E265 Block comment should start with `# ` - src/bokeh/server/views/metadata_handler.py:20:1: E265 Block comment should start with `# ` - src/bokeh/server/views/metadata_handler.py:22:1: E265 Block comment should start with `# ` - src/bokeh/server/views/metadata_handler.py:25:1: E402 Module level import not at top of file - src/bokeh/server/views/metadata_handler.py:28:1: E402 Module level import not at top of file - src/bokeh/server/views/metadata_handler.py:31:1: E402 Module level import not at top of file - src/bokeh/server/views/metadata_handler.py:32:1: E402 Module level import not at top of file - src/bokeh/server/views/metadata_handler.py:34:1: E265 Block comment should start with `# ` ... 11 additional changes omitted for rule E265 - src/bokeh/server/views/metadata_handler.py:39:5: Q000 [*] Single quotes found but double quotes preferred - src/bokeh/server/views/metadata_handler.py:51:5: D200 One-line docstring should fit on one line - src/bokeh/server/views/metadata_handler.py:51:5: D210 [*] No whitespaces allowed surrounding docstring text - src/bokeh/server/views/metadata_handler.py:51:5: D300 [*] Use triple double quotes `"""` - src/bokeh/server/views/metadata_handler.py:51:5: D400 First line should end with a period - src/bokeh/server/views/metadata_handler.py:51:5: D415 First line should end with a period, question mark, or exclamation point - src/bokeh/server/views/metadata_handler.py:51:5: Q002 [*] Single quote docstring found but double quotes preferred - src/bokeh/server/views/metadata_handler.py:56:15: ANN201 Missing return type annotation for public function `get` - src/bokeh/server/views/metadata_handler.py:56:15: D102 Missing docstring in public method - src/bokeh/server/views/metadata_handler.py:56:19: ANN101 Missing type annotation for `self` in method - src/bokeh/server/views/metadata_handler.py:56:26: ANN002 Missing type annotation for `*args` - src/bokeh/server/views/metadata_handler.py:56:26: ARG002 Unused method argument: `args` - src/bokeh/server/views/metadata_handler.py:56:34: ANN003 Missing type annotation for `**kwargs` - src/bokeh/server/views/metadata_handler.py:56:34: ARG002 Unused method argument: `kwargs` - src/bokeh/server/views/metadata_handler.py:64:20: C408 Unnecessary `dict` call (rewrite as a literal) - src/bokeh/server/views/metadata_handler.py:66:41: Q000 [*] Single quotes found but double quotes preferred - src/bokeh/server/views/metadata_handler.py:7:1: D205 1 blank line required between summary line and description - src/bokeh/server/views/metadata_handler.py:7:1: D210 [*] No whitespaces allowed surrounding docstring text - src/bokeh/server/views/metadata_handler.py:7:1: D300 [*] Use triple double quotes `"""` - src/bokeh/server/views/metadata_handler.py:7:1: D400 First line should end with a period - src/bokeh/server/views/metadata_handler.py:7:1: D415 First line should end with a period, question mark, or exclamation point - src/bokeh/server/views/metadata_handler.py:7:1: Q002 [*] Single quote docstring found but double quotes preferred - src/bokeh/server/views/metadata_handler.py:8:1: D208 [*] Docstring is over-indented ... 10 additional changes omitted for project
Changes by rule (24 rules affected)
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
E265 | 16 | 0 | 16 | 0 | 0 |
ANN001 | 5 | 0 | 5 | 0 | 0 |
ANN201 | 5 | 0 | 5 | 0 | 0 |
E402 | 4 | 0 | 4 | 0 | 0 |
Q000 | 2 | 0 | 2 | 0 | 0 |
D210 | 2 | 0 | 2 | 0 | 0 |
D300 | 2 | 0 | 2 | 0 | 0 |
D400 | 2 | 0 | 2 | 0 | 0 |
D415 | 2 | 0 | 2 | 0 | 0 |
Q002 | 2 | 0 | 2 | 0 | 0 |
ARG002 | 2 | 0 | 2 | 0 | 0 |
COM812 | 1 | 0 | 1 | 0 | 0 |
DTZ001 | 1 | 0 | 1 | 0 | 0 |
CPY001 | 1 | 0 | 1 | 0 | 0 |
T201 | 1 | 0 | 1 | 0 | 0 |
E261 | 1 | 0 | 1 | 0 | 0 |
D200 | 1 | 0 | 1 | 0 | 0 |
D102 | 1 | 0 | 1 | 0 | 0 |
ANN101 | 1 | 0 | 1 | 0 | 0 |
ANN002 | 1 | 0 | 1 | 0 | 0 |
ANN003 | 1 | 0 | 1 | 0 | 0 |
C408 | 1 | 0 | 1 | 0 | 0 |
D205 | 1 | 0 | 1 | 0 | 0 |
D208 | 1 | 0 | 1 | 0 | 0 |
charliermarsh
approved these changes
Nov 28, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks!
charliermarsh
changed the title
[isort] Length sort settings
[Nov 28, 2023
isort
] Add support for length-sort settings
charliermarsh
force-pushed
the
length-sort-option
branch
from
November 28, 2023 05:54
ed7f36b
to
61c0b88
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Closes #1567.
Add both
length-sort
andlength-sort-straight
settings for isort.Here are a few notable points:
unicode_width
crate, i.e. we are talking about displayed length (this is explicitly mentioned in the description of the setting)force_to_top
field is now the first one)Test Plan
I added tests for the following cases: