This is an automated email from the ASF dual-hosted git repository.

shahar1 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new dd010a09ea2 Enable ruff PLE1205 to catch logging calls with too many 
arguments (#66978)
dd010a09ea2 is described below

commit dd010a09ea2ba14ea88d830db5a864db500a78f6
Author: Shahar Epstein <[email protected]>
AuthorDate: Fri May 15 21:38:59 2026 +0300

    Enable ruff PLE1205 to catch logging calls with too many arguments (#66978)
    
    Co-authored-by: Wei Lee <[email protected]>
---
 airflow-core/src/airflow/utils/log/file_task_handler.py             | 2 +-
 .../src/airflow/providers/amazon/aws/operators/redshift_data.py     | 5 +----
 providers/amazon/src/airflow/providers/amazon/aws/sensors/ssm.py    | 6 +-----
 .../src/airflow/providers/amazon/aws/utils/task_log_fetcher.py      | 4 ++--
 .../google/src/airflow/providers/google/cloud/operators/compute.py  | 4 ++--
 providers/google/src/airflow/providers/google/suite/hooks/drive.py  | 2 +-
 .../google/tests/system/google/cloud/gcs/example_gcs_to_gdrive.py   | 2 +-
 .../google/tests/system/google/cloud/gcs/example_gdrive_to_gcs.py   | 2 +-
 .../tests/system/google/cloud/transfers/example_gdrive_to_local.py  | 2 +-
 .../google/tests/system/google/suite/example_local_to_drive.py      | 2 +-
 pyproject.toml                                                      | 1 +
 11 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/airflow-core/src/airflow/utils/log/file_task_handler.py 
b/airflow-core/src/airflow/utils/log/file_task_handler.py
index c170adc8751..e2b6bcb6165 100644
--- a/airflow-core/src/airflow/utils/log/file_task_handler.py
+++ b/airflow-core/src/airflow/utils/log/file_task_handler.py
@@ -855,7 +855,7 @@ class FileTaskHandler(logging.Handler):
             try:
                 os.chmod(full_path, new_file_permissions)
             except OSError as e:
-                logger.warning("OSError while changing ownership of the log 
file. ", e)
+                logger.warning("OSError while changing ownership of the log 
file. %s", e)
 
         return full_path
 
diff --git 
a/providers/amazon/src/airflow/providers/amazon/aws/operators/redshift_data.py 
b/providers/amazon/src/airflow/providers/amazon/aws/operators/redshift_data.py
index d92febf2e7f..3168b9f69c4 100644
--- 
a/providers/amazon/src/airflow/providers/amazon/aws/operators/redshift_data.py
+++ 
b/providers/amazon/src/airflow/providers/amazon/aws/operators/redshift_data.py
@@ -120,10 +120,7 @@ class 
RedshiftDataOperator(AwsBaseOperator[RedshiftDataHook]):
         if poll_interval > 0:
             self.poll_interval = poll_interval
         else:
-            self.log.warning(
-                "Invalid poll_interval:",
-                poll_interval,
-            )
+            self.log.warning("Invalid poll_interval: %s", poll_interval)
         self.return_sql_result = return_sql_result
         self.deferrable = deferrable
         self.session_id = session_id
diff --git a/providers/amazon/src/airflow/providers/amazon/aws/sensors/ssm.py 
b/providers/amazon/src/airflow/providers/amazon/aws/sensors/ssm.py
index 2874a553d5a..943c9608730 100644
--- a/providers/amazon/src/airflow/providers/amazon/aws/sensors/ssm.py
+++ b/providers/amazon/src/airflow/providers/amazon/aws/sensors/ssm.py
@@ -108,11 +108,7 @@ class SsmRunCommandCompletedSensor(AwsBaseSensor[SsmHook]):
         command_invocations = response.get("CommandInvocations", [])
 
         if not command_invocations:
-            self.log.info(
-                "No command invocations found",
-                "command_id=%s yet, waiting...",
-                self.command_id,
-            )
+            self.log.info("No command invocations found, command_id=%s yet, 
waiting...", self.command_id)
             return False
 
         for invocation in command_invocations:
diff --git 
a/providers/amazon/src/airflow/providers/amazon/aws/utils/task_log_fetcher.py 
b/providers/amazon/src/airflow/providers/amazon/aws/utils/task_log_fetcher.py
index 24b426a536e..c509c2a7fa7 100644
--- 
a/providers/amazon/src/airflow/providers/amazon/aws/utils/task_log_fetcher.py
+++ 
b/providers/amazon/src/airflow/providers/amazon/aws/utils/task_log_fetcher.py
@@ -84,7 +84,7 @@ class AwsTaskLogFetcher(Thread):
             )
         except ClientError as error:
             if error.response["Error"]["Code"] != "ResourceNotFoundException":
-                self.logger.warning("Error on retrieving Cloudwatch log 
events", error)
+                self.logger.warning("Error on retrieving Cloudwatch log 
events: %s", error)
             else:
                 self.logger.info(
                     "Cannot find log stream yet, it can take a couple of 
seconds to show up. "
@@ -95,7 +95,7 @@ class AwsTaskLogFetcher(Thread):
                 )
             yield from ()
         except ConnectionClosedError as error:
-            self.logger.warning("ConnectionClosedError on retrieving 
Cloudwatch log events", error)
+            self.logger.warning("ConnectionClosedError on retrieving 
Cloudwatch log events: %s", error)
             yield from ()
 
     @staticmethod
diff --git 
a/providers/google/src/airflow/providers/google/cloud/operators/compute.py 
b/providers/google/src/airflow/providers/google/cloud/operators/compute.py
index 9ae10b5c091..46d44821377 100644
--- a/providers/google/src/airflow/providers/google/cloud/operators/compute.py
+++ b/providers/google/src/airflow/providers/google/cloud/operators/compute.py
@@ -1042,7 +1042,7 @@ class 
ComputeEngineInsertInstanceTemplateOperator(ComputeEngineBaseOperator):
             request_id=self.request_id,
             project_id=self.project_id,
         )
-        self.log.info("The specified Instance Template has been created 
SUCCESSFULLY", self.body)
+        self.log.info("The specified Instance Template has been created 
SUCCESSFULLY: %s", self.body)
         new_template = hook.get_instance_template(
             resource_id=self.resource_id,
             project_id=self.project_id,
@@ -1611,7 +1611,7 @@ class 
ComputeEngineInsertInstanceGroupManagerOperator(ComputeEngineBaseOperator)
             project_id=self.project_id,
             zone=self.zone,
         )
-        self.log.info("The specified Instance Group Manager has been created 
SUCCESSFULLY", self.body)
+        self.log.info("The specified Instance Group Manager has been created 
SUCCESSFULLY: %s", self.body)
         new_instance_group_manager = hook.get_instance_group_manager(
             resource_id=self.resource_id,
             project_id=self.project_id,
diff --git a/providers/google/src/airflow/providers/google/suite/hooks/drive.py 
b/providers/google/src/airflow/providers/google/suite/hooks/drive.py
index 8f97feb76ae..7d1257cf4ed 100644
--- a/providers/google/src/airflow/providers/google/suite/hooks/drive.py
+++ b/providers/google/src/airflow/providers/google/suite/hooks/drive.py
@@ -304,7 +304,7 @@ class GoogleDriveHook(GoogleBaseHook):
             try:
                 upload_location = self._resolve_file_path(folder_id)
             except GoogleApiClientError as e:
-                self.log.warning("A problem has been encountered when trying 
to resolve file path: ", e)
+                self.log.exception("A problem has been encountered when trying 
to resolve file path: %s", e)
 
         if show_full_target_path:
             self.log.info("File %s uploaded to gdrive://%s.", local_location, 
upload_location)
diff --git 
a/providers/google/tests/system/google/cloud/gcs/example_gcs_to_gdrive.py 
b/providers/google/tests/system/google/cloud/gcs/example_gcs_to_gdrive.py
index 2fac6ccd088..270231dedf0 100644
--- a/providers/google/tests/system/google/cloud/gcs/example_gcs_to_gdrive.py
+++ b/providers/google/tests/system/google/cloud/gcs/example_gcs_to_gdrive.py
@@ -170,7 +170,7 @@ with DAG(
         if files := root_path["files"]:
             batch = service.new_batch_http_request()
             for file in files:
-                log.info("Preparing to remove file: {}", file)
+                log.info("Preparing to remove file: %s", file)
                 batch.add(service.files().delete(fileId=file["id"]))
             batch.execute()
             log.info("Selected files removed.")
diff --git 
a/providers/google/tests/system/google/cloud/gcs/example_gdrive_to_gcs.py 
b/providers/google/tests/system/google/cloud/gcs/example_gdrive_to_gcs.py
index 482d7b43003..ec5f6ab4cca 100644
--- a/providers/google/tests/system/google/cloud/gcs/example_gdrive_to_gcs.py
+++ b/providers/google/tests/system/google/cloud/gcs/example_gdrive_to_gcs.py
@@ -136,7 +136,7 @@ with DAG(
         response = service.files().list(q=f"name = 
'{DRIVE_FILE_NAME}'").execute()
         if files := response["files"]:
             file = files[0]
-            log.info("Deleting file {}...", file)
+            log.info("Deleting file %s...", file)
             service.files().delete(fileId=file["id"])
             log.info("Done.")
 
diff --git 
a/providers/google/tests/system/google/cloud/transfers/example_gdrive_to_local.py
 
b/providers/google/tests/system/google/cloud/transfers/example_gdrive_to_local.py
index 42828c20ae9..38edfa9de19 100644
--- 
a/providers/google/tests/system/google/cloud/transfers/example_gdrive_to_local.py
+++ 
b/providers/google/tests/system/google/cloud/transfers/example_gdrive_to_local.py
@@ -137,7 +137,7 @@ with DAG(
         response = service.files().list(q=f"name = 
'{DRIVE_FILE_NAME}'").execute()
         if files := response["files"]:
             file = files[0]
-            log.info("Deleting file {}...", file)
+            log.info("Deleting file %s...", file)
             service.files().delete(fileId=file["id"])
             log.info("Done.")
 
diff --git 
a/providers/google/tests/system/google/suite/example_local_to_drive.py 
b/providers/google/tests/system/google/suite/example_local_to_drive.py
index c248774423b..04a411d984c 100644
--- a/providers/google/tests/system/google/suite/example_local_to_drive.py
+++ b/providers/google/tests/system/google/suite/example_local_to_drive.py
@@ -121,7 +121,7 @@ with DAG(
         if files := root_path["files"]:
             batch = service.new_batch_http_request()
             for file in files:
-                log.info("Preparing to remove file: {}", file)
+                log.info("Preparing to remove file: %s", file)
                 batch.add(service.files().delete(fileId=file["id"]))
             batch.execute()
             log.info("Selected files removed.")
diff --git a/pyproject.toml b/pyproject.toml
index 8352ecd83b0..e7504f3e007 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -628,6 +628,7 @@ extend-select = [
     "PLW2101", # Threading lock directly created in with statement has no 
effect
     "PLW2901", # Outer {outer_kind} variable {name} overwritten by inner 
{inner_kind} target
     "PLW3301", # Nested {func} calls can be flattened
+    "PLE1205", # Logging format string has too many arguments (extra args are 
silently dropped)
     # Per rule enables
     "RUF006", # Checks for asyncio dangling task
     "RUF015", # Checks for unnecessary iterable allocation for first element

Reply via email to