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

[flake8-unused-arguments] Add fixes for ARG001->ARG005 #10321

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

GtrMo
Copy link
Contributor

@GtrMo GtrMo commented Mar 10, 2024

Summary

This PR adds fixes for unused-arguments rules.
The fix removes the unused arguments from the function/method definition.
The fix is marked as unsafe as removing a parameter changes the function definition, and we cannot access call sites to also remove the argument there.

The remove_parameter function, analog to remove_argument was added. It is tested through the fix.

The rule was a bit refactored: the function, method and call functions were merged in a single check function

Test Plan

New test cases were added to test with all parameter kinds.

Copy link

codspeed-hq bot commented Mar 10, 2024

CodSpeed Performance Report

Merging #10321 will not alter performance

Comparing GtrMo:new_fix_unused_parameters (ec08118) with main (8619986)

Summary

✅ 30 untouched benchmarks

Copy link
Contributor

github-actions bot commented Mar 10, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

/// Generic function to remove parameters in functions, methods or lambdas definitions.
///
/// Supports the removal of parentheses when this is the only parameter left.
pub(crate) fn remove_parameter(
Copy link
Member

Choose a reason for hiding this comment

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

How does this differ from remove_argument?

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