B008: extend-immutable-calls does not work with imported function
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 123
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 5
Description
I have small framework, which has Depends function simialr to fastapi feature. In my projects I want flake8-bubear to ignore only this funcion, but not any other function with same name. I've tried to set full link in flake config, but it does not work.
I know that it is possible to always use full function name, but it looks dirty:
Example 1. Correct behavior - no B008
In config:
extend-immutable-calls=myapp.api.lambda_handler.depends.Depends
In code
import myapp.api.lambda_handler.depends
@app.handler
def get_data(
session: Session = myapp.api.lambda_handler.depends.Depends(),
) -> HttpResponse[ListResponse[AA]]:
Example 2. Incorrect behavior - B008
In config:
extend-immutable-calls=myapp.api.lambda_handler.depends.Depends
In code
from myapp.api.lambda_handler.depends import Depends
@app.handler
def get_data(
session: Session = Depends(),
) -> HttpResponse[ListResponse[AA]]:
Example 3. Incorrect behavior - no B008
extend-immutable-calls=Depends
from myapp.api.lambda_handler.depends import Depends
@app.handler
def get_data(
session: Session = Depends(),
) -> HttpResponse[ListResponse[AA]]:
...
def Depends():
return []
@app.handler
def put_data(
session: Session = Depends(),
) -> HttpResponse[ListResponse[AA]]:
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the three configuration and import examples from the issue, then trace the B008 handling for configured call names and imported functions. Add regression coverage showing that a fully qualified configured name matches the imported Depends call while an unrelated local Depends remains flagged; done when the examples produce the stated results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100