Skip to content

Consider soft keywords for E27 rules - #11446

Merged
dhruvmanila merged 1 commit into
mainfrom
dhruv/e27-soft-keyword
May 20, 2024
Merged

dhruvmanila merged 1 commit into
mainfrom
dhruv/e27-soft-keyword

Conversation

@dhruvmanila

@dhruvmanila dhruvmanila commented May 16, 2024 •

Copy link
Copy Markdown
Member

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 force-pushed the dhruv/token-kind-keywords branch from bb02694 to 72e190a Compare May 16, 2024 11:40
@dhruvmanila
dhruvmanila requested a review from MichaReiser as a code owner May 16, 2024 11:40
@dhruvmanila
dhruvmanila force-pushed the dhruv/e27-soft-keyword branch from 23a938e to afe44c6 Compare May 16, 2024 11:40
@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`

@AlexWaygood AlexWaygood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice

Comment thread crates/ruff_python_parser/src/token.rs
@dhruvmanila
dhruvmanila force-pushed the dhruv/e27-soft-keyword branch from afe44c6 to 8455701 Compare May 17, 2024 12:13
@github-actions

github-actions Bot commented May 17, 2024 •

Copy link
Copy Markdown
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@dhruvmanila
dhruvmanila force-pushed the dhruv/e27-soft-keyword branch from 8455701 to ccd8538 Compare May 20, 2024 05:34
@dhruvmanila
dhruvmanila enabled auto-merge (squash) May 20, 2024 05:34
@dhruvmanila
dhruvmanila merged commit 403f0dc into main May 20, 2024
@dhruvmanila
dhruvmanila deleted the dhruv/e27-soft-keyword branch May 20, 2024 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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