PyCQA / flake8

flake8 is a python tool that glues together pycodestyle, pyflakes, mccabe, and third-party plugins to check the style and quality of some python code.

Home Page:https://flake8.pycqa.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Concatenated f-string does not issue F541 ("f-string is missing placeholders")

flaviovs opened this issue · comments

how did you install flake8?

pip install flake8

unmodified output of flake8 --bug-report

{
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.9.2",
    "system": "Linux"
  },
  "plugins": [
    {
      "plugin": "flake8-bugbear",
      "version": "23.2.13"
    },
    {
      "plugin": "flake8-builtins",
      "version": "2.1.0"
    },
    {
      "plugin": "flake8-docstrings",
      "version": "1.7.0"
    },
    {
      "plugin": "flake8-eradicate",
      "version": "1.4.0"
    },
    {
      "plugin": "flake8-tidy-imports",
      "version": "4.8.0"
    },
    {
      "plugin": "mccabe",
      "version": "0.7.0"
    },
    {
      "plugin": "pycodestyle",
      "version": "2.9.1"
    },
    {
      "plugin": "pyflakes",
      "version": "2.5.0"
    }
  ],
  "version": "5.0.4"
}

describe the problem

what I expected to happen

A F541 (f-string is missing placeholders) warning, even for f-string missing placeholders that are concatenated with others f-strings that have them.

sample code

foo = 'bar'

print(f'{foo}' f'foo')

commands ran

$ flake8 t.py

Note: command gives no output.

Notes

If the first string is not a f-string, then the warning is correctly issued:

foo = 'bar'

print('foo' f'foo')
$ flake8
./t.py:3:7: F541 f-string is missing placeholders

please read the issue template, as well as the prompts before the issue template