Skip to content

Comments

[refurb] Fix false positive for float and complex numbers in FURB116#17661

Merged
MichaReiser merged 1 commit intoastral-sh:mainfrom
LaBatata101:fix-FURB116
May 3, 2025
Merged

[refurb] Fix false positive for float and complex numbers in FURB116#17661
MichaReiser merged 1 commit intoastral-sh:mainfrom
LaBatata101:fix-FURB116

Conversation

@LaBatata101
Copy link
Contributor

@LaBatata101 LaBatata101 commented Apr 27, 2025

Summary

Partially fixes #16472. Addresses the false positive for float and complex numbers.

I'm going to fix the other issues in another PR.

Test Plan

Snapshot tests.

@github-actions
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@ntBre ntBre added bug Something isn't working fixes Related to suggested fixes for violations labels Apr 28, 2025
Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@MichaReiser MichaReiser merged commit 097af06 into astral-sh:main May 3, 2025
33 checks passed
@LaBatata101 LaBatata101 deleted the fix-FURB116 branch May 3, 2025 14:00
ntBre pushed a commit that referenced this pull request May 12, 2025
…#17692)

<!--
Thank you for contributing to Ruff! To help us out with reviewing,
please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary
We can only guarantee the safety of the autofix for number literals, all
other cases may change the runtime behaviour of the program or introduce
a syntax error. For the cases reported in the issue that would result in
a syntax error, I disabled the autofix.

Follow-up of #17661. 

Fixes #16472.
<!-- What's the purpose of the change? What does it do, and why? -->

## Test Plan

Snapshot tests.
<!-- How was it tested? -->
Glyphack pushed a commit to Glyphack/ruff that referenced this pull request May 21, 2025
…astral-sh#17692)

<!--
Thank you for contributing to Ruff! To help us out with reviewing,
please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary
We can only guarantee the safety of the autofix for number literals, all
other cases may change the runtime behaviour of the program or introduce
a syntax error. For the cases reported in the issue that would result in
a syntax error, I disabled the autofix.

Follow-up of astral-sh#17661. 

Fixes astral-sh#16472.
<!-- What's the purpose of the change? What does it do, and why? -->

## Test Plan

Snapshot tests.
<!-- How was it tested? -->
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 this pull request may close these issues.

FURB116 has false positives and unsafe fixes

3 participants