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

[ruff_linter] - Use LibCST in adjust_indentation for mixed whitespace #12740

Merged
merged 6 commits into from
Aug 8, 2024

Conversation

diceroll123
Copy link
Contributor

@diceroll123 diceroll123 commented Aug 8, 2024

Summary

The dedent_to function has a difficult time with mixed whitespace.

The code now conditionally uses the LibCST method if there is mixed whitespace.

Fixes #12707

Test Plan

cargo test

Copy link

codspeed-hq bot commented Aug 8, 2024

CodSpeed Performance Report

Merging #12740 will not alter performance

Comparing diceroll123:fix-RET505-indent-errors (d922997) with main (df7345e)

Summary

✅ 32 untouched benchmarks

Copy link
Contributor

github-actions bot commented Aug 8, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@MichaReiser
Copy link
Member

This seems like a pretty big regression. I think I would prefer just to disable the fix in case there's mixed-indentation than regressing performance by that much.

@diceroll123
Copy link
Contributor Author

Yeah, that is not ideal as is.

I'd like to try one more alternative approach, which does already include detecting mixed indentation.

@diceroll123 diceroll123 changed the title [ruff_linter] - Remove dedent_to usage from adjust_indentation helper [ruff_linter] - Use LibCST in adjust_indentation for mixed whitespace Aug 8, 2024
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.

Nice!

crates/ruff_linter/src/fix/edits.rs Outdated Show resolved Hide resolved
@MichaReiser MichaReiser added bug Something isn't working preview Related to preview mode features labels Aug 8, 2024
@MichaReiser MichaReiser merged commit 6d9205e into astral-sh:main Aug 8, 2024
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working preview Related to preview mode features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RET505 doesn't work with mixed space and tabs
2 participants