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

Implement C403 #335

Merged
merged 1 commit into from
Oct 6, 2022
Merged

Implement C403 #335

merged 1 commit into from
Oct 6, 2022

Conversation

harupy
Copy link
Contributor

@harupy harupy commented Oct 6, 2022

#305

> cargo run -- --select=C403 resources/test/fixtures/C403.py
resources/test/fixtures/C403.py:1:5: C403 Unnecessary list comprehension - rewrite as a set comprehension

@harupy
Copy link
Contributor Author

harupy commented Oct 6, 2022

It looks like this check is auto-fixable. I will file a follow-up PR (if this is really auto-fixable).

@charliermarsh
Copy link
Member

This looks great, thanks.

if self.settings.enabled.contains(&CheckCode::C403) {
if let Some(check) = checks::unnecessary_list_comprehension(expr, func, args) {
self.checks.push(check);
};
Copy link
Member

Choose a reason for hiding this comment

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

I'm trying to establish a pattern whereby we add new checks to plugins, and every plugin takes &mut self as its first argument. But that might be overkill for these really simple cases. (Better when there's a lot of logic around the checks:: call.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants