Skip to content

[refurb] Implement single-item-membership-test (FURB171)#7815

Merged
charliermarsh merged 4 commits intoastral-sh:mainfrom
tjkuson:single-in
Oct 8, 2023
Merged

[refurb] Implement single-item-membership-test (FURB171)#7815
charliermarsh merged 4 commits intoastral-sh:mainfrom
tjkuson:single-in

Conversation

@tjkuson
Copy link
Contributor

@tjkuson tjkuson commented Oct 4, 2023

Summary

Implement no-single-item-in as single-item-membership-test (FURB171).

Uses the helper function generate_comparison from the pycodestyle implementations; this function should probably be moved, but I am not sure where at the moment.

Update: moved it to ruff_python_ast::helpers.

Related to #1348.

Test Plan

cargo test

@github-actions
Copy link
Contributor

github-actions bot commented Oct 4, 2023

PR Check Results

Ecosystem

✅ ecosystem check detected no changes.

@tjkuson tjkuson marked this pull request as ready for review October 4, 2023 16:24
@codspeed-hq
Copy link

codspeed-hq bot commented Oct 4, 2023

CodSpeed Performance Report

Merging #7815 will not alter performance

Comparing tjkuson:single-in (a067e8e) with main (bdd925c)

Summary

✅ 25 untouched benchmarks

@charliermarsh charliermarsh added the rule Implementing or modifying a lint rule label Oct 8, 2023
@charliermarsh
Copy link
Member

Thanks, looks great.

@charliermarsh charliermarsh enabled auto-merge (squash) October 8, 2023 13:59
@charliermarsh charliermarsh merged commit 62f1ee0 into astral-sh:main Oct 8, 2023
@tjkuson tjkuson deleted the single-in branch October 8, 2023 19:41
konstin pushed a commit that referenced this pull request Oct 11, 2023
## Summary

Implement
[`no-single-item-in`](https://github.com/dosisod/refurb/blob/master/refurb/checks/iterable/no_single_item_in.py)
as `single-item-membership-test` (`FURB171`).

Uses the helper function `generate_comparison` from the `pycodestyle`
implementations; this function should probably be moved, but I am not
sure where at the moment.

Update: moved it to `ruff_python_ast::helpers`.

Related to #1348.

## Test Plan

`cargo test`
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