Skip to content

Commit 429bb14

Browse files
committed
docs: add technical docstrings and harden pr-check-test-files.sh
Signed-off-by: Dominiq Barbero <mr.dom.barbero@gmail.com>
1 parent 115b21f commit 429bb14

File tree

2 files changed

+38
-3
lines changed

2 files changed

+38
-3
lines changed

.github/scripts/pr-check-test-files.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,41 @@
11
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# ======================================================================================================================================================
5+
# @file: pr-check-test-files.sh
6+
#
7+
# @Description A CI check written in bash that enforces the '_test.py' suffix to ensure Pytest can automatically discover
8+
# new or renamed test files in a Pull Request.
9+
#
10+
# @logic:
11+
# 1. Identifies files as (A) Added, (R) Renamed, or (C) Copied using 'git diff' to check
12+
# relevant filename ($file1 for added files, $file2 for renamed/copied files).
13+
# 2. Validates paths against allowed test directories (unit/integration).
14+
# 3. Excludes specific utility (ex., conftest.py, utils.py) and non-Python files.
15+
# 4. Parses tab-separated Git output via IFS=$'\t' to ensure robust filename handling.
16+
# 5. Routes files using case statement based on git status
17+
#
18+
# @types:
19+
# - String: Used for file paths and git status codes.
20+
# - Array: Used for 'TEST_DIRS', 'EXCEPTION_NAMES', and accumulating errors.
21+
#
22+
# @Parameters:
23+
# - None: This script does not accept CLI arguments. It derives the input from the current Git state compared against origin/main.
24+
#
25+
# @Dependencies:
26+
# - Git: (for diff)
27+
# - Bash: (runs the script)
28+
# - Pytest: (naming standard)
29+
#
30+
# @Permissions:
31+
# - Requires Execute permissions (chmod +x) to run. Also needs Read access to the git repository to perform the diff.
32+
#
33+
# @Return
34+
# - 0: All test files follow the naming standard.
35+
# - 1: Exits with status 1 and outputs error messages in red.
36+
# Includes a yellow instructional block providing reason why the file failed.
37+
# ======================================================================================================================================================
38+
239
RED="\033[31m"
340
YELLOW="\033[33m"
441
RESET="\033[0m"

CHANGELOG.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,13 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
8080
- Added support for include duplicates in get transaction receipt query (#1166)
8181
- Added `.github/workflows/cron-check-broken-links.yml` workflow to perform scheduled monthly Markdown link validation across the entire repository with automatic issue creation for broken links ([#1210](https://github.com/hiero-ledger/hiero-sdk-python/issues/1210))
8282
- Added `transfer_transaction_tinybar.py` example demonstrating tinybar transfers with both integer and Hbar object approaches. ([#1249](https://github.com/hiero-ledger/hiero-sdk-python/issues/1249))
83-
- Added `transfer_transaction_gigabar.py` example demonstrating `GIGABAR` unit usage for large-value transfers. ([#1249](https://github.com/hiero-ledger/hiero-sdk-python/issues/1249))
84-
- Coderabbit prompt for .github
85-
- Added convenient factory methods to `Hbar` class for easier instantiation: `from_microbars()`, `from_millibars()`, `from_hbars()`, `from_kilobars()`, `from_megabars()`, and `from_gigabars()`. [#1272](https://github.com/hiero-ledger/hiero-sdk-python/issues/1272)
8683
- Added merge conflict bot workflow (`.github/workflows/bot-merge-conflict.yml`) and helper script (`.github/scripts/bot-merge-conflict.js`) to detect and notify about PR merge conflicts, with retry logic for unknown mergeable states, idempotent commenting, and push-to-main recheck logic (#1247)
8784
- Added workflow to prevent assigning intermediate issues to contributors without prior Good First Issue completion (#1143).
8885
- Added `Client.from_env()` and network-specific factory methods (e.g., `Client.for_testnet()`) to simplify client initialization and reduce boilerplate. [[#1251](https://github.com/hiero-ledger/hiero-sdk-python/issues/1251)]
8986
- Improved unit test coverage for `TransactionId` class, covering parsing logic, hashing, and scheduled transactions.
9087
- Chained Good First Issue assignment with mentor assignment to bypass GitHub's anti-recursion protection - mentor assignment now occurs immediately after successful user assignment in the same workflow execution. (#1369)
9188
- Add GitHub Actions script and workflow for automatic spam list updates.
89+
- Added technical docstrings and hardening (set -euo pipefail) to the pr-check-test-files.sh script
9290

9391
### Changed
9492
- Added global review instructions to CodeRabbit configuration to limit reviews to issue/PR scope and prevent scope creep [#1373]

0 commit comments

Comments
 (0)