Closed ColinHarrington closed 4 days ago
Thanks for the report, but this was a false negative fixed. Now the f-string behaves the same way as regular strings. They each need to conform to your configured naming style.
Thanks for the report, but this was a false negative fixed. Now the f-string behaves the same way as regular strings. They each need to conform to your configured naming style.
Then why are the f-strings linted differently within a function vs in the script/global scope in for-loop? Please look at the example for reference.
Am I missing some new configuration here or how do we explain the change in linting behavior?
There are different naming styles for functions versus global/script scope. This has always been the case for strings, f-strings are consistent with that now. The naming style config is explained in detail here.
You may find further behavior differences for type-annotated module constants, but we're addressing that in a future version: #9771.
Bug description
It appears that fstrings in the script scope (not in a function anyway) are being identified as constants and linted inconsistently.
These are new findings in our codebases in the 3.3.x line
Configuration
No response
Command used
I also ran some combinations in docker to reproduce the issue:
And then I tested multiple versions of pylint with this script:
I also has similar results with Several versions of python (3.9, 3.10, 3.11, 3.12, etc)
Pylint output
I also tested versions 3.0, 3.1, 3.2 3.3.0 and 3.3.1 with this result:
Expected behavior
I expect that an fstring in the script scope would not result in a pylint error
C0103
congruent with the behavior prior to 3.3.0Pylint version
Also from docker python alpine image:
OS / Environment
Darwin(intel x64), reproducible in Docker
Additional dependencies
No response