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-boolean-trap.extend-allowed-calls don't resolve class types #11264

Open
clara-bordes opened this issue May 3, 2024 · 2 comments
Open
Labels
type-inference Requires more advanced type inference.

Comments

@clara-bordes
Copy link

I am actually working on fixing the rule boolean-positional-value-in-call (FBT003) on a code repository.

I need to allow this rule for some functions. For that, at the end of my config file "pyproject.toml", I have added:

[lint.flake8-boolean-trap]
extend-allowed-calls = ["LibName.className.functionName"]

My issue here is that in my code repository, we call the function "LibName.className.functionName" through a variable, as following:

from LibName import ClassName

with ClassName("[Description]") as variable:
       variable.functionName(...)

On such code, the rule FBT003 is still applied in spite of the "extend-allowed-calls" option.

Is the "extend-allowed-calls" option only works for direct function calls?

@charliermarsh
Copy link
Member

Yes, that setting doesn't support resolution to the base type. It won't trace variable back to LibName.ClassName.

@charliermarsh charliermarsh added the type-inference Requires more advanced type inference. label May 4, 2024
@charliermarsh charliermarsh changed the title "flake8-boolean-trap.extend-allowed-calls" option does not work in my case flake8-boolean-trap.extend-allowed-calls don't resolve class types May 4, 2024
@charliermarsh
Copy link
Member

I'd suggest just disabling the rule, but we'll probably support this at some point in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-inference Requires more advanced type inference.
Projects
None yet
Development

No branches or pull requests

2 participants