There was a previously introduced bug where the curr_state variable in
the classify_review function would be potentially uninitialized. This
would cause the script to crash when the variable was used during the
analysis of the AI review text.
This patch fixes the bug by initializing the variable before it is used
during the parsing of the AI review text.
Fixes: 18b85df67daa ("devtools: fix AI review result classification")
Signed-off-by: Matthew Gee <[email protected]>
---
devtools/ai/review-patch.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/devtools/ai/review-patch.py b/devtools/ai/review-patch.py
index 3705ca8209..5f8d9ed772 100755
--- a/devtools/ai/review-patch.py
+++ b/devtools/ai/review-patch.py
@@ -159,6 +159,7 @@ def classify_review(review_text: str, output_format: str)
-> int:
rgx_header_match: str = r"(#+\s)?(\*+)?(<h[1-3]>)?{err_or_warn}"
# Matches against observed filler text
rgx_filler_match: str = r"(none(.)?$|\(must fix\)$|$)"
+ curr_state: ReviewParseState = ReviewParseState.NORMAL
curr_line: str
for curr_line in review_text.splitlines():
--
2.54.0