Skip to content

Conversation

@qequ
Copy link
Contributor

@qequ qequ commented Nov 25, 2025

Type of Changes

Type
βœ“ πŸ› Bug fix
✨ New feature
πŸ”¨ Refactoring
πŸ“œ Docs

Description

This PR fixes a false positive in the logging-unsupported-format checker when logging statements contain format-like strings but no arguments are supplied.

Closes #10752

@codecov
Copy link

codecov bot commented Nov 25, 2025

Codecov Report

βœ… All modified and coverable lines are covered by tests.
βœ… Project coverage is 95.98%. Comparing base (6f7f8db) to head (3c1b8ec).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #10758   +/-   ##
=======================================
  Coverage   95.98%   95.98%           
=======================================
  Files         176      176           
  Lines       19540    19561   +21     
=======================================
+ Hits        18755    18776   +21     
  Misses        785      785           
Files with missing lines Coverage Ξ”
pylint/checkers/logging.py 94.80% <100.00%> (+0.03%) ⬆️

... and 2 files with indirect coverage changes

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

This comment has been minimized.

Copy link
Collaborator

@DanielNoord DanielNoord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a functional test for this behaviour? :)

@Pierre-Sassoulas
Copy link
Member

I think there's a decision to take here because 'fixing' this might make the checker useless (it won't detect % when one wanted to do %d or it won't detect %test). I.e. it's possible that this checker cannot work without some false positives. I was absolutely sure that the original issue was a duplicate but I haven't been able to find another issue talking about it (Maybe #9999 ?), so there's already a MR for this (which isn't nice if we're going to reject in the end)

@jacobtylerwalls
Copy link
Member

@Pierre-Sassoulas I think treating %s differently from %foo as proposed makes sense. I didn't quite follow your doubt.

@Pierre-Sassoulas Pierre-Sassoulas added False Positive 🦟 A message is emitted but nothing is wrong with the code backport maintenance/4.0.x labels Nov 30, 2025
@Pierre-Sassoulas Pierre-Sassoulas added this to the 4.0.4 milestone Nov 30, 2025
@Pierre-Sassoulas
Copy link
Member

My point was that there's classes of issues that pylint won't warn about anymore, like missing specifier after a %, but I missed that there have to be two mistakes from the user for them to be an actual error, so I agree with you now.

Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qequ sorry for the noise, do you mind adding functional test like Daniel suggested ?

@jacobtylerwalls jacobtylerwalls modified the milestones: 4.0.4, 4.0.5 Nov 30, 2025
Signed-off-by: Alvaro Frias <alvaro.frias@eclypsium.com>
@github-actions

This comment has been minimized.

Copy link
Member

@jacobtylerwalls jacobtylerwalls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signed-off-by: Alvaro Frias <alvaro.frias@eclypsium.com>
@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2025

πŸ€– According to the primer, this change has no effect on the checked open source code. πŸ€–πŸŽ‰

This comment was generated for commit 3c1b8ec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport maintenance/4.0.x False Positive 🦟 A message is emitted but nothing is wrong with the code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[logging-unsupported-format] false negative if no logging args are supplied

4 participants