astral-sh / ruff-lsp

A Language Server Protocol implementation for Ruff.
Other
1.33k stars 46 forks source link

List comprehension in Parameter default value: Name is not defined #513

Open routerdieb opened 1 hour ago

routerdieb commented 1 hour ago

Version from pip install: python-lsp-black 2.0.0 python-lsp-isort 0.2.0 python-lsp-jsonrpc 1.1.2 python-lsp-ruff 2.2.2 python-lsp-server 1.12.0

ruff-version => 0.7.4

image

Code snippet: `ith_parameters_and_values( parameter_one=1, parameter_two="a string with a lot of characters just to make this longer", parameter_three=[i2 for i in range(1000)], parameter_four={"key1": "value1", "key2": "value2", "key3": "value3"}, parameter_five=(x for x in range(1000000)), parameter_six=lambda x: x2 if x % 2 == 0 else x*3, args, **kwargs, ): test = [i for i in range(1000)] print(test) return ( parameter_one

The issue is, that in fact the variables are know.

routerdieb commented 1 hour ago

I was testing if ruff was enabled, and asked ChatGPT to generate a long line of code, so that i could test if the formatter was enabled.