Skip to content

Enable ruff PLE1205 to catch logging calls with too many arguments#66978

Merged
shahar1 merged 3 commits into
apache:mainfrom
shahar1:enable-ruff-PLE1205-logging-too-many-args
May 15, 2026
Merged

Enable ruff PLE1205 to catch logging calls with too many arguments#66978
shahar1 merged 3 commits into
apache:mainfrom
shahar1:enable-ruff-PLE1205-logging-too-many-args

Conversation

@shahar1
Copy link
Copy Markdown
Contributor

@shahar1 shahar1 commented May 15, 2026

When a logging call has more positional arguments than the format string has %-placeholders, the extra arguments are silently dropped and the intended information never appears in the log. Enable PLE1205 (logging-too-many-args) to make this a lint error, and fix all 12 existing instances.

Changes

  • `pyproject.toml`: add PLE1205 to extend-select.
  • `airflow-core` (1): add missing %s placeholder for the caught OSError in file_task_handler.py.
  • `provider:amazon` (4):
    • redshift_data.py: collapse two-string call into "Invalid poll_interval: %s", poll_interval
    • ssm.py: merge accidentally split message strings into one format string with %s
    • task_log_fetcher.py (×2): add %s for the captured exception
  • `provider:google` (7):
    • compute.py (×2): add %s so self.body is actually logged
    • drive.py: add %s for the GoogleApiClientError
    • Four system-test example files using {} placeholders (logging uses %s, not .format() syntax)

Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Sonnet 4.6)

Generated-by: Claude Code (Sonnet 4.6) following the guidelines

@shahar1 shahar1 requested a review from o-nikolas as a code owner May 15, 2026 05:14
@boring-cyborg boring-cyborg Bot added area:logging area:providers provider:amazon AWS/Amazon - related issues provider:google Google (including GCP) related issues labels May 15, 2026
Comment thread providers/amazon/src/airflow/providers/amazon/aws/sensors/ssm.py
Comment thread providers/google/src/airflow/providers/google/suite/hooks/drive.py Outdated
Copy link
Copy Markdown
Contributor

@jscheffl jscheffl left a comment

Choose a reason for hiding this comment

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

Cool!

shahar1 and others added 3 commits May 15, 2026 19:05
Extra positional arguments to logging methods are silently dropped when
the format string has no corresponding placeholder. Enable PLE1205
(logging-too-many-args) and fix all 12 existing instances:

- Add missing %s placeholders where the value was being discarded
- Merge accidentally split message strings (ssm.py)
- Replace {}-style placeholders with %s (four system test files)
…e.py

Co-authored-by: Wei Lee <weilee.rx@gmail.com>
@shahar1 shahar1 force-pushed the enable-ruff-PLE1205-logging-too-many-args branch from be1a9c3 to 4fa39e5 Compare May 15, 2026 16:05
@shahar1 shahar1 merged commit dd010a0 into apache:main May 15, 2026
292 checks passed
@shahar1 shahar1 deleted the enable-ruff-PLE1205-logging-too-many-args branch May 15, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:logging area:providers provider:amazon AWS/Amazon - related issues provider:google Google (including GCP) related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants