You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
frommypackage.subpackage2import ( # long comment that seems to be a problema_long_variable_name_that_causes_problems,
item2,
)
Doing some bisection, it works in 0.0.255 and hangs in 0.0.256 onwards.
Probably related to #3530? But it happens regardless of the combine-as-imports setting
In the newer versions, it seems to get stuck in an infinite loop
[2023-04-21][20:08:42][ruff_cli::commands::run][DEBUG] Identified files to lint in: 521.625µs
[2023-04-21][20:08:42][ruff_cli::diagnostics][DEBUG] Checking: /Users/pstjohn/Misc/ruff_issue/test.py
[2023-04-21][20:08:42][ruff::rules::isort::categorize][DEBUG] Categorized 'mypackage' as ThirdParty (NoMatch)
[2023-04-21][20:08:42][ruff::rules::isort::categorize][DEBUG] Categorized 'mypackage' as ThirdParty (NoMatch)
[2023-04-21][20:08:42][ruff::rules::isort::categorize][DEBUG] Categorized 'mypackage' as ThirdParty (NoMatch)
[2023-04-21][20:08:42][ruff::rules::isort::categorize][DEBUG] Categorized 'mypackage' as ThirdParty (NoMatch)
[2023-04-21][20:08:42][ruff::rules::isort::categorize][DEBUG] Categorized 'mypackage' as ThirdParty (NoMatch)
[2023-04-21][20:08:42][ruff::rules::isort::categorize][DEBUG] Categorized 'mypackage' as ThirdParty (NoMatch)
[2023-04-21][20:08:42][ruff::rules::isort::categorize][DEBUG] Categorized 'mypackage' as ThirdParty (NoMatch)
[2023-04-21][20:08:42][ruff::rules::isort::categorize][DEBUG] Categorized 'mypackage' as ThirdParty (NoMatch)
[2023-04-21][20:08:42][ruff::rules::isort::categorize][DEBUG] Categorized 'mypackage' as ThirdParty (NoMatch)
[2023-04-21][20:08:42][ruff::rules::isort::categorize][DEBUG] Categorized 'mypackage' as ThirdParty (NoMatch)
[2023-04-21][20:08:42][ruff::rules::isort::categorize][DEBUG] Categorized 'mypackage' as ThirdParty (NoMatch)
[2023-04-21][20:08:42][ruff::rules::isort::categorize][DEBUG] Categorized 'mypackage' as ThirdParty (NoMatch)
[2023-04-21][20:08:42][ruff::rules::isort::categorize][DEBUG] Categorized 'mypackage' as ThirdParty (NoMatch)
[2023-04-21][20:08:42][ruff::rules::isort::categorize][DEBUG] Categorized 'mypackage' as ThirdParty (NoMatch)
[2023-04-21][20:08:42][ruff::rules::isort::categorize][DEBUG] Categorized 'mypackage' as ThirdParty (NoMatch)
[2023-04-21][20:08:42][ruff::rules::isort::categorize][DEBUG] Categorized 'mypackage' as ThirdParty (NoMatch)
The older versions run through twice
[2023-04-21][20:15:05][ruff_cli::commands::run][DEBUG] Identified files to lint in: 381.25µs
[2023-04-21][20:15:05][ruff::rules::isort::categorize][DEBUG] Categorized 'mypackage' as ThirdParty (NoMatch)
[2023-04-21][20:15:05][ruff::rules::isort::categorize][DEBUG] Categorized 'mypackage' as ThirdParty (NoMatch)
[2023-04-21][20:15:05][ruff_cli::commands::run][DEBUG] Checked 1 files in: 1.910292ms
Found 1 error (1 fixed, 0 remaining).
resulting in this formatted import
frommypackage.subpackage2import ( # long comment that seems to be a problema_long_variable_name_that_causes_problems,
)
frommypackage.subpackage2importitem2
The text was updated successfully, but these errors were encountered:
pstjohn
changed the title
Ruff hangs when sorting imports with long variable names / comments
Infinite loop in for long variable names with force-single-line in ruff >= 0.0.256
Apr 22, 2023
pstjohn
changed the title
Infinite loop in for long variable names with force-single-line in ruff >= 0.0.256
Infinite loop in import sorting for long variable names with force-single-line in ruff >= 0.0.256
Apr 22, 2023
pstjohn
changed the title
Infinite loop in import sorting for long variable names with force-single-line in ruff >= 0.0.256
Infinite loop in import sorting for long variable names with force-single-line (ruff >= 0.0.256)
Apr 22, 2023
I've identified the issue (introduced in #3521), which is that we're duplicating the comment with an exponential blowup. Figuring out a proper fix, if I can't fix it properly I'll revert that change prior to the next release.
The following code snippet causes
ruff
to hang for ruff >= 0.0.256.pyproject.toml
test.py
Doing some bisection, it works in 0.0.255 and hangs in 0.0.256 onwards.
Probably related to #3530? But it happens regardless of the
combine-as-imports
settingIn the newer versions, it seems to get stuck in an infinite loop
The older versions run through twice
resulting in this formatted import
The text was updated successfully, but these errors were encountered: