Skip to content

False positive logging-format-truncated using percentage in the message without args #10458

@moylop260

Description

@moylop260

Bug description

import logging

logging.info('Good percent %')

Configuration

Command used

pylint --logging-format-style=old -d all -e logging-format-truncated --rcfile=/dev/null my_file.py

NOTE: Using --logging-format-style=new format is not reproduced

Pylint output

E1201: Logging format string ends in middle of conversion specifier (logging-format-truncated)

Expected behavior

The percentage value is valid and it doesn't need to be scaped if there are not args to parse in the string

Notice the following example where the value is showed correctly without scaping vs scaping the value:

  • Image

Pylint version

pylint 4.0.0-dev0
astroid 4.0.0a0
Python 3.12.11 (main, Jun  3 2025, 15:41:47) [Clang 17.0.0 (clang-1700.0.13.3)]

OS / Environment

MacOSX

Additional dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs PRThis issue is accepted, sufficiently specified and now needs an implementationNeeds decision 🔒Needs a decision before implemention or rejection

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions