Skip to content

Avoid running logical line rule logic if not enabled#11951

Merged
dhruvmanila merged 2 commits intomainfrom
dhruv/logical-line-rules
Jun 20, 2024
Merged

Avoid running logical line rule logic if not enabled#11951
dhruvmanila merged 2 commits intomainfrom
dhruv/logical-line-rules

Conversation

@dhruvmanila
Copy link
Copy Markdown
Member

Summary

This PR updates the logical line rules entry-point function to only run the logic if any of the rules within that group is enabled.

Although this shouldn't really give any performance improvements, it's better not to do additional work if we can. This is also consistent with how other rules are run.

Test Plan

cargo insta test

@dhruvmanila dhruvmanila added the internal An internal refactor or improvement label Jun 20, 2024
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 20, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Copy link
Copy Markdown
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.

Thanks for doing this. This might improve performance, it just won't show in our benchmarks because we either run all or no logical line rules.

Comment thread crates/ruff_linter/src/checkers/logical_lines.rs Outdated
@dhruvmanila dhruvmanila enabled auto-merge (squash) June 20, 2024 16:25
@dhruvmanila dhruvmanila merged commit 3f884b4 into main Jun 20, 2024
@dhruvmanila dhruvmanila deleted the dhruv/logical-line-rules branch June 20, 2024 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal An internal refactor or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants