Skip to content
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

FURB113 (repeated-append) autofix deletes comments #8105

Closed
tdulcet opened this issue Oct 21, 2023 · 0 comments · Fixed by #8494
Closed

FURB113 (repeated-append) autofix deletes comments #8105

tdulcet opened this issue Oct 21, 2023 · 0 comments · Fixed by #8494
Assignees
Labels
bug Something isn't working fixes Related to suggested fixes for violations

Comments

@tdulcet
Copy link

tdulcet commented Oct 21, 2023

  • A minimal code snippet that reproduces the bug.
nums = [1, 2, 3]

nums.append(4)
# Critically important comment 1
nums.append(5)
# Critically important comment 2
nums.append(6)

Result:

nums = [1, 2, 3]

nums.extend((4, 5, 6))
  • The command you invoked (e.g., ruff /path/to/file.py --fix), ideally including the --isolated flag.
ruff --select FURB113 --preview --isolated --unsafe-fixes --fix test.py
  • The current Ruff settings (any relevant sections from your pyproject.toml).
    None
  • The current Ruff version (ruff --version).
ruff 0.1.1
@zanieb zanieb added bug Something isn't working fixes Related to suggested fixes for violations labels Oct 21, 2023
@dhruvmanila dhruvmanila self-assigned this Nov 5, 2023
dhruvmanila added a commit that referenced this issue Nov 9, 2023
This PR avoids creating the fix for `FURB113` if there are comments in
between the `append` calls.

fixes: #8105
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixes Related to suggested fixes for violations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants