@@ -50,24 +50,29 @@ scan_test_files() {
5050
5151 # Match class-level Trait annotations (before class declaration)
5252 !in_class && /\[Trait\("Requirement", "[A-Z]+-[0-9.]+"\)/ {
53- match($0, /"([A-Z]+-[0-9.]+)"/, arr)
54- req_id = arr[1]
53+ req_id = ""
54+ if (match($0, /"[A-Z]+-[0-9.]+"/)) {
55+ req_id = substr($0, RSTART + 1, RLENGTH - 2)
56+ }
5557 if (index(req_id, prefix) == 1) {
5658 class_reqs[++class_req_count] = req_id
5759 }
5860 }
5961
6062 # Match class declaration
6163 /public class [a-zA-Z0-9_]+/ {
62- match($0, /public class ([a-zA-Z0-9_]+)/, arr)
63- class_name = arr[1]
64- in_class = 1
64+ if (match($0, /public class [a-zA-Z0-9_]+/)) {
65+ class_name = substr($0, RSTART + 13, RLENGTH - 13)
66+ in_class = 1
67+ }
6568 }
6669
6770 # Match method-level Trait annotations (inside class)
6871 in_class && /\[Trait\("Requirement", "[A-Z]+-[0-9.]+"\)/ {
69- match($0, /"([A-Z]+-[0-9.]+)"/, arr)
70- req_id = arr[1]
72+ req_id = ""
73+ if (match($0, /"[A-Z]+-[0-9.]+"/)) {
74+ req_id = substr($0, RSTART + 1, RLENGTH - 2)
75+ }
7176 if (index(req_id, prefix) == 1) {
7277 method_reqs[++method_req_count] = req_id
7378 }
@@ -80,8 +85,13 @@ scan_test_files() {
8085
8186 # Match method declaration
8287 in_class && /public (async )?(Task|void) [a-zA-Z0-9_]+\(/ {
83- match($0, /public (async )?(Task|void) ([a-zA-Z0-9_]+)\(/, arr)
84- method_name = arr[3]
88+ if (match($0, /public (async )?(Task|void) [a-zA-Z0-9_]+\(/)) {
89+ method_name = substr($0, RSTART, RLENGTH)
90+ sub(/^public (async )?(Task|void) /, "", method_name)
91+ sub(/\($/, "", method_name)
92+ } else {
93+ method_name = ""
94+ }
8595
8696 if (is_test_method) {
8797 # Use method-level requirements if available, otherwise class-level
0 commit comments