You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by sb...@apache.org on 2025/04/25 14:49:09 UTC
(tooling-trusted-release) branch main updated: Make bad root directories give a warning rather than an error
This is an automated email from the ASF dual-hosted git repository.
sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-release.git
The following commit(s) were added to refs/heads/main by this push:
new bf9a3ce Make bad root directories give a warning rather than an error
bf9a3ce is described below
commit bf9a3ce7a3a6183959ee4babc8505519c81d2115
Author: Sean B. Palmer <se...@miscoranda.com>
AuthorDate: Fri Apr 25 15:48:38 2025 +0100
Make bad root directories give a warning rather than an error
---
atr/tasks/checks/license.py | 13 +++++++++----
atr/tasks/checks/rat.py | 7 +++++--
atr/tasks/checks/targz.py | 2 +-
3 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/atr/tasks/checks/license.py b/atr/tasks/checks/license.py
index 29a5bdc..3277367 100644
--- a/atr/tasks/checks/license.py
+++ b/atr/tasks/checks/license.py
@@ -183,7 +183,9 @@ async def files(args: checks.FunctionArguments) -> str | None:
try:
result_data = await asyncio.to_thread(_files_check_core_logic, str(artifact_abs_path))
- if result_data.get("error"):
+ if result_data.get("warning"):
+ await recorder.warning(result_data["warning"], result_data)
+ elif result_data.get("error"):
await recorder.failure(result_data["error"], result_data)
elif result_data["license_valid"] and result_data["notice_valid"]:
await recorder.success("LICENSE and NOTICE files present and valid", result_data)
@@ -208,7 +210,9 @@ async def headers(args: checks.FunctionArguments) -> str | None:
try:
result_data = await asyncio.to_thread(_headers_check_core_logic, str(artifact_abs_path))
- if result_data.get("error_message"):
+ if result_data.get("warning_message"):
+ await recorder.warning(result_data["warning_message"], result_data)
+ elif result_data.get("error_message"):
# Handle errors during the check process itself
await recorder.failure(result_data["error_message"], result_data)
elif not result_data["valid"]:
@@ -291,7 +295,7 @@ def _files_check_core_logic(artifact_path: str) -> dict[str, Any]:
"files_found": [],
"license_valid": False,
"notice_valid": False,
- "error": f"Could not determine root directory: {e!s}",
+ "warning": f"Could not determine root directory: {e!s}",
}
# Check for license files in the root directory
@@ -408,7 +412,8 @@ def _headers_check_core_logic(artifact_path: str) -> dict[str, Any]:
"files_checked": 0,
"files_with_valid_headers": 0,
"errors": [],
- "error_message": f"Could not determine root directory: {e!s}",
+ "error_message": None,
+ "warning_message": f"Could not determine root directory: {e!s}",
"valid": False,
}
diff --git a/atr/tasks/checks/rat.py b/atr/tasks/checks/rat.py
index c87ad61..f0f7e65 100644
--- a/atr/tasks/checks/rat.py
+++ b/atr/tasks/checks/rat.py
@@ -59,7 +59,9 @@ async def check(args: checks.FunctionArguments) -> str | None:
chunk_size=args.extra_args.get("chunk_size", _CONFIG.EXTRACT_CHUNK_SIZE),
)
- if result_data.get("error"):
+ if result_data.get("warning"):
+ await recorder.warning(result_data["warning"], result_data)
+ elif result_data.get("error"):
# Handle errors from within the core logic
await recorder.failure(result_data["message"], result_data)
elif not result_data["valid"]:
@@ -155,7 +157,8 @@ def _check_core_logic(
"unknown_licenses": 0,
"unapproved_files": [],
"unknown_license_files": [],
- "errors": [error_msg or "No root directory found"],
+ "warning": error_msg or "No root directory found",
+ "errors": [],
}
extract_dir = os.path.join(temp_dir, root_dir)
diff --git a/atr/tasks/checks/targz.py b/atr/tasks/checks/targz.py
index 8566dbe..ba10bc2 100644
--- a/atr/tasks/checks/targz.py
+++ b/atr/tasks/checks/targz.py
@@ -87,7 +87,7 @@ async def structure(args: checks.FunctionArguments) -> str | None:
{"root": root, "expected": expected_root},
)
else:
- await recorder.failure(
+ await recorder.warning(
f"Root directory '{root}' does not match expected name '{expected_root}'",
{"root": root, "expected": expected_root},
)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org