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

Handle kwargs passed as positional arguments #2

Open
mschwager opened this issue Jan 10, 2020 · 0 comments
Open

Handle kwargs passed as positional arguments #2

mschwager opened this issue Jan 10, 2020 · 0 comments

Comments

@mschwager
Copy link
Contributor

In the BadKwargUseLinter helper we can observe the following behavior:

def func(a, b='foo'):
    # ...
    return a * b

func(1, b='bar')  # Caught with BadKwargUseLinter
func(2, 'bar')  # Uncaught with BadKwargUseLinter

That is, kwargs passed as positional arguments will not be caught by BadKwargUseLinter. We could remedy this by supporting an additional piece of configuration in the BadKwargUseLinter.kwargs property. If we took another, optional configuration option like position we could detect this behavior.

This is somewhat of a fringe use-case. It may not be worth it to try and maintain the position of function kwargs since they could easily change out from underneath us.

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

No branches or pull requests

1 participant