Skip to content

Commit 2ce8e6e

Browse files
committed
docs: add comprehensive docstring to pr-check script
Signed-off-by: Dominiq Barbero <mr.dom.barbero@gmail.com>
1 parent 7f35aef commit 2ce8e6e

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

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

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

0 commit comments

Comments
 (0)