Skip to content

False positive for logging-fstring-interpolation #4984

Closed
@yegarti

Description

@yegarti

Bug description

When using f-string without arguments in a logging message, Pylint would warn me about not using lazy % formatting, even though I do use it.

a.py:

import logging
logging.error(f'Hello %s', 'World!')

output:
ERROR:root:Hello World!

Configuration

No response

Command used

pylint a.py

Pylint output

************* Module a
a.py:2:0: W1203: Use lazy % formatting in logging functions (logging-fstring-interpolation)
a.py:2:14: W1309: Using an f-string that does not have any interpolated variables (f-string-without-interpolation)

------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)

Expected behavior

Report only f-string-without-interpolation

Pylint version

pylint 2.10.2
astroid 2.7.3
Python 3.9.4 (default, Apr 30 2021, 18:51:54) 
[GCC 10.2.0]

OS / Environment

Manjaro Linux, Kernel 5.10

Additional dependencies

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    False Positive 🦟A message is emitted but nothing is wrong with the codeMinor 💅Polishing pylint is always niceNeeds PRThis issue is accepted, sufficiently specified and now needs an implementation

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions