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

[Bug]: FURB111 triggers for lambdas returning constants which are not the default of the built-in #340

Open
3 tasks done
kasium opened this issue May 7, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@kasium
Copy link

kasium commented May 7, 2024

Has your issue already been fixed?

  • Have you checked to see if your issue still exists on the master branch? See the docs for instructions on how to setup a local build of Refurb.
  • Have you looked at the open/closed issues to see if anyone has already reported your issue?
  • If reporting a false positive/incorrect suggestion, have you double checked that the suggested fix changes the code semantics?

The Bug

The following code:

from typing import Callable

def func(x: Callable):
    x()
func(lambda: False)

Emits the following error:

$ refurb foo.py
[# Some error here](foo.py:5:6 [FURB111]: Replace `lambda: False` with `bool`)

But it should not be emitting an error instance because here a callable is needed

Version Info

Refurb: v2.0.0
Mypy: v1.10.0

Python Version

Python 3.12.0

Config File

# N/A

Extra Info

None

@kasium kasium added the bug Something isn't working label May 7, 2024
@kasium kasium changed the title [Bug]: [Bug]: FURB111 triggers for lambdas returning constants which are not the default of the built-in May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants