This is an automated email from the ASF dual-hosted git repository.
sbp pushed a commit to branch sbp
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
The following commit(s) were added to refs/heads/sbp by this push:
new 55b2da8 Convert all check warnings to errors
55b2da8 is described below
commit 55b2da82832fca1b88e11d9ff095fffb4637200b
Author: Sean B. Palmer <[email protected]>
AuthorDate: Thu Feb 5 20:06:26 2026 +0000
Convert all check warnings to errors
---
atr/tasks/checks/paths.py | 8 ++++----
atr/tasks/checks/targz.py | 10 +++++-----
atr/tasks/checks/zipformat.py | 6 +++---
tests/unit/test_archive_root_variants.py | 28 ++++++++++++++--------------
4 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/atr/tasks/checks/paths.py b/atr/tasks/checks/paths.py
index b1a5a62..98e96e8 100644
--- a/atr/tasks/checks/paths.py
+++ b/atr/tasks/checks/paths.py
@@ -143,10 +143,10 @@ async def _check_metadata_rules(
errors.append("The use of .md5 is forbidden, please use .sha512")
if ".sha1" in suffixes:
# Deprecated by RDP
- warnings.append("The use of .sha1 is deprecated, please use .sha512")
+ errors.append("The use of .sha1 is deprecated, please use .sha512")
if ".sha" in suffixes:
# Discouraged by RDP
- warnings.append("The use of .sha is discouraged, please use .sha512")
+ errors.append("The use of .sha is discouraged, please use .sha512")
if ".sig" in suffixes:
# Forbidden by RCP, forbidden by RDP
errors.append("Binary signature files (.sig) are forbidden, please use
.asc")
@@ -156,7 +156,7 @@ async def _check_metadata_rules(
# Also .mds is allowed, but we'll ignore that for now
# TODO: Is .mds supported in analysis.METADATA_SUFFIXES?
if ext_metadata not in {".asc", ".cdx.json", ".sha256", ".sha512", ".md5",
".sha", ".sha1"}:
- warnings.append("The use of this metadata file is discouraged")
+ errors.append("The use of this metadata file is discouraged")
# Check whether the corresponding artifact exists
artifact_path_base = str(relative_path).removesuffix(ext_metadata)
@@ -212,7 +212,7 @@ async def _check_path_process_single(
else:
log.info(f"Checking general rules for {full_path}")
if (relative_path.parent == pathlib.Path(".")) and (relative_path.name
not in allowed_top_level):
- warnings.append(f"Unknown top level file: {relative_path.name}")
+ errors.append(f"Unknown top level file: {relative_path.name}")
await _record(
recorder_errors,
diff --git a/atr/tasks/checks/targz.py b/atr/tasks/checks/targz.py
index f3583b1..ffe22b3 100644
--- a/atr/tasks/checks/targz.py
+++ b/atr/tasks/checks/targz.py
@@ -125,7 +125,7 @@ async def structure(args: checks.FunctionArguments) ->
results.Results | None:
"filename_match": npm_info.filename_match,
}
if npm_info.filename_match is False:
- await recorder.warning(
+ await recorder.failure(
"npm pack layout detected but filename does not
match package.json", data
)
else:
@@ -133,21 +133,21 @@ async def structure(args: checks.FunctionArguments) ->
results.Results | None:
else:
if npm_error is not None:
data["npm_pack_error"] = npm_error
- await recorder.warning(
+ await recorder.failure(
f"Root directory '{root}' does not match expected
names '{expected_roots_display}'", data
)
else:
- await recorder.warning(
+ await recorder.failure(
f"Root directory '{root}' does not match expected names
'{expected_roots_display}'", data
)
else:
- await recorder.warning(
+ await recorder.failure(
f"Root directory '{root}' does not match expected names
'{expected_roots_display}'", data
)
except tarzip.ArchiveMemberLimitExceededError as e:
await recorder.failure(f"Archive has too many members: {e}", {"error":
str(e)})
except RootDirectoryError as e:
- await recorder.warning("Could not get the root directory of the
archive", {"error": str(e)})
+ await recorder.failure("Could not get the root directory of the
archive", {"error": str(e)})
except Exception as e:
await recorder.failure("Unable to verify archive structure", {"error":
str(e)})
return None
diff --git a/atr/tasks/checks/zipformat.py b/atr/tasks/checks/zipformat.py
index 6cfb0b5..d188873 100644
--- a/atr/tasks/checks/zipformat.py
+++ b/atr/tasks/checks/zipformat.py
@@ -63,7 +63,7 @@ async def structure(args: checks.FunctionArguments) ->
results.Results | None:
result_data = await asyncio.to_thread(_structure_check_core_logic,
str(artifact_abs_path))
if result_data.get("warning"):
- await recorder.warning(result_data["warning"], result_data)
+ await recorder.failure(result_data["warning"], result_data)
elif result_data.get("error"):
await recorder.failure(result_data["error"], result_data)
else:
@@ -140,11 +140,11 @@ def _structure_check_core_logic(artifact_path: str) ->
dict[str, Any]: # noqa:
},
}
if npm_info.filename_match is False:
- npm_data["warning"] = "npm pack layout detected
but filename does not match package.json"
+ npm_data["error"] = "npm pack layout detected but
filename does not match package.json"
return npm_data
result_data: dict[str, Any] = {"expected_roots":
expected_roots}
if error_msg.startswith("Root directory mismatch"):
- result_data["warning"] = error_msg
+ result_data["error"] = error_msg
else:
result_data["error"] = error_msg
return result_data
diff --git a/tests/unit/test_archive_root_variants.py
b/tests/unit/test_archive_root_variants.py
index 36ec86b..23f4ba6 100644
--- a/tests/unit/test_archive_root_variants.py
+++ b/tests/unit/test_archive_root_variants.py
@@ -119,7 +119,7 @@ async def
test_targz_structure_rejects_package_root_without_package_json(tmp_pat
await targz.structure(args)
- assert any(status == sql.CheckResultStatus.WARNING.value for status, _, _
in recorder.messages)
+ assert any(status == sql.CheckResultStatus.FAILURE.value for status, _, _
in recorder.messages)
@pytest.mark.asyncio
@@ -139,7 +139,7 @@ async def
test_targz_structure_rejects_source_root_when_filename_has_no_suffix(t
await targz.structure(args)
- assert any(status == sql.CheckResultStatus.WARNING.value for status, _, _
in recorder.messages)
+ assert any(status == sql.CheckResultStatus.FAILURE.value for status, _, _
in recorder.messages)
@pytest.mark.asyncio
@@ -159,7 +159,7 @@ async def
test_targz_structure_rejects_source_root_when_filename_has_src_suffix(
await targz.structure(args)
- assert any(status == sql.CheckResultStatus.WARNING.value for status, _, _
in recorder.messages)
+ assert any(status == sql.CheckResultStatus.FAILURE.value for status, _, _
in recorder.messages)
@pytest.mark.asyncio
@@ -179,7 +179,7 @@ async def
test_targz_structure_rejects_src_root_when_filename_has_no_suffix(tmp_
await targz.structure(args)
- assert any(status == sql.CheckResultStatus.WARNING.value for status, _, _
in recorder.messages)
+ assert any(status == sql.CheckResultStatus.FAILURE.value for status, _, _
in recorder.messages)
@pytest.mark.asyncio
@@ -199,11 +199,11 @@ async def
test_targz_structure_rejects_src_root_when_filename_has_source_suffix(
await targz.structure(args)
- assert any(status == sql.CheckResultStatus.WARNING.value for status, _, _
in recorder.messages)
+ assert any(status == sql.CheckResultStatus.FAILURE.value for status, _, _
in recorder.messages)
@pytest.mark.asyncio
-async def test_targz_structure_warns_on_npm_pack_filename_mismatch(tmp_path:
pathlib.Path) -> None:
+async def test_targz_structure_rejects_npm_pack_filename_mismatch(tmp_path:
pathlib.Path) -> None:
archive_path = tmp_path / "example-1.2.3.tgz"
_make_tar_gz_with_contents(
archive_path,
@@ -225,7 +225,7 @@ async def
test_targz_structure_warns_on_npm_pack_filename_mismatch(tmp_path: pat
await targz.structure(args)
- assert any(status == sql.CheckResultStatus.WARNING.value for status, _, _
in recorder.messages)
+ assert any(status == sql.CheckResultStatus.FAILURE.value for status, _, _
in recorder.messages)
assert any("npm pack layout detected" in message for _, message, _ in
recorder.messages)
@@ -263,8 +263,8 @@ def
test_zipformat_structure_rejects_dated_src_suffix(tmp_path: pathlib.Path) ->
result = zipformat._structure_check_core_logic(str(archive_path))
- assert "warning" in result
- assert "Root directory mismatch" in result["warning"]
+ assert "error" in result
+ assert "Root directory mismatch" in result["error"]
def
test_zipformat_structure_rejects_package_root_without_package_json(tmp_path:
pathlib.Path) -> None:
@@ -278,11 +278,11 @@ def
test_zipformat_structure_rejects_package_root_without_package_json(tmp_path:
result = zipformat._structure_check_core_logic(str(archive_path))
- assert result.get("warning") is not None
- assert "Root directory mismatch" in result["warning"]
+ assert result.get("error") is not None
+ assert "Root directory mismatch" in result["error"]
-def test_zipformat_structure_warns_on_npm_pack_filename_mismatch(tmp_path:
pathlib.Path) -> None:
+def test_zipformat_structure_rejects_npm_pack_filename_mismatch(tmp_path:
pathlib.Path) -> None:
archive_path = tmp_path / "example-1.2.3.zip"
_make_zip_with_contents(
archive_path,
@@ -294,8 +294,8 @@ def
test_zipformat_structure_warns_on_npm_pack_filename_mismatch(tmp_path: pathl
result = zipformat._structure_check_core_logic(str(archive_path))
- assert result.get("warning") is not None
- assert "npm pack layout detected" in result["warning"]
+ assert result.get("error") is not None
+ assert "npm pack layout detected" in result["error"]
assert result.get("root_dir") == "package"
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]