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-releases.git
commit 4403d940ea4e33275ee6ac6a2eaaa4fd5c982ea3 Author: Andrew Musselman <[email protected]> AuthorDate: Thu Oct 23 20:58:30 2025 -0700 Fixes #254 --- atr/docs/adding-checks.md | 67 +++++++++++++++++++++++++++++++++++++++++++ atr/docs/how-to-contribute.md | 2 +- atr/docs/index.md | 1 + 3 files changed, 69 insertions(+), 1 deletion(-) diff --git a/atr/docs/adding-checks.md b/atr/docs/adding-checks.md new file mode 100644 index 0000000..30e8d45 --- /dev/null +++ b/atr/docs/adding-checks.md @@ -0,0 +1,67 @@ +# 3.9.1. Adding checks + +**Up**: `3.` [Developer guide](developer-guide) + +**Prev**: `3.9.` [How to contribute](how-to-contribute) + +**Next**: (none) + +**Sections**: + +* [Introduction](#introduction) +* [Where to add code](#where-to-add-code) + +## Introduction + +There are several checks for correctness that are already built out, and this how-to provides pointers for developers wishing to add new checks for relevant pieces of a release. Currently as of `alpha-2` ATR has checks for the following: + +1. Correct hashing +1. Compliant license +1. File paths +1. RAT results +1. Correct signature +1. Well-formed tarballs +1. Well-formed zip files + + +## Where to add code + +### Adding your task check module + +In `atr/tasks/checks` you will find several modules that perform these check tasks, including `hashing.py`, `license.py`, etc. To write a new check task, add a module here that performs the checks needed. + +### Importing and using your module + +In `atr/tasks/__init__.py` you will see imports for existing modules where you can add an import for new check task, for example: + +```python +import atr.tasks.checks.hashing as hashing +import atr.tasks.checks.license as license +``` + +And in the `resolve` function you will see where those modules are exercised where you can add a `case` statement for the new task: + +```python +def resolve(task_type: sql.TaskType) -> Callable[..., Awaitable[results.Results | None]]: # noqa: C901 + match task_type: + case sql.TaskType.HASHING_CHECK: + return hashing.check + case sql.TaskType.KEYS_IMPORT_FILE: + return keys.import_file + case sql.TaskType.LICENSE_FILES: + return license.files + case sql.TaskType.LICENSE_HEADERS: + return license.headers +``` + +### Defining your task type + +In `atr/models/sql.py` you will find the `TaskType` class where you can add a new mapping for the task: + +```python +class TaskType(str, enum.Enum): + HASHING_CHECK = "hashing_check" + KEYS_IMPORT_FILE = "keys_import_file" + LICENSE_FILES = "license_files" + LICENSE_HEADERS = "license_headers" +``` diff --git a/atr/docs/how-to-contribute.md b/atr/docs/how-to-contribute.md index d40df40..b0ffb81 100644 --- a/atr/docs/how-to-contribute.md +++ b/atr/docs/how-to-contribute.md @@ -4,7 +4,7 @@ **Prev**: `3.8.` [Code conventions](code-conventions) -**Next**: (none) +**Next**: `3.9.1.` [Adding checks](adding-checks) **Sections**: diff --git a/atr/docs/index.md b/atr/docs/index.md index 0fd3015..5beb393 100644 --- a/atr/docs/index.md +++ b/atr/docs/index.md @@ -18,3 +18,4 @@ NOTE: This documentation is a work in progress. * `3.7.` [Running and creating tests](running-and-creating-tests) * `3.8.` [Code conventions](code-conventions) * `3.9.` [How to contribute](how-to-contribute) + * `3.9.1.` [Adding checks](adding-checks) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
