Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Consider soft keywords for E27 rules #11446

Merged
merged 1 commit into from
May 20, 2024
Merged

Conversation

dhruvmanila
Copy link
Member

@dhruvmanila dhruvmanila commented May 16, 2024

Summary

This is a follow-up PR to #11445 update the E27 rules to consider soft keywords as well.

Test Plan

Add test cases consisting of soft keywords and update the snapshot.

@dhruvmanila dhruvmanila added the rule Implementing or modifying a lint rule label May 16, 2024
@dhruvmanila dhruvmanila removed the request for review from MichaReiser May 16, 2024 11:43
Base automatically changed from dhruv/token-kind-keywords to main May 17, 2024 04:56
dhruvmanila added a commit that referenced this pull request May 17, 2024
## Summary

This PR updates the `TokenKind::is_keyword` check to include soft
keywords. To account for this change, it adds a new
`is_non_soft_keyword` method.

The usage in logical line rules were updated to use the
`is_non_soft_keyword` method but it'll be updated to use `is_keyword` in
a follow-up PR (#11446).

While, the parser usages were kept as is. And because of that, the
snapshots for two test cases were updated in a better direction.

## Test Plan

`cargo insta test`
Copy link
Member

@AlexWaygood AlexWaygood 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_python_parser/src/token.rs Outdated Show resolved Hide resolved
Copy link
Contributor

github-actions bot commented May 17, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@dhruvmanila dhruvmanila enabled auto-merge (squash) May 20, 2024 05:34
@dhruvmanila dhruvmanila merged commit 403f0dc into main May 20, 2024
17 checks passed
@dhruvmanila dhruvmanila deleted the dhruv/e27-soft-keyword branch May 20, 2024 05:38
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants