| 61 | |
| 62 | @dataclass |
| 63 | class Comment: |
| 64 | id: int |
| 65 | author: str |
| 66 | body: str |
| 67 | path: str |
| 68 | line: Optional[int] |
| 69 | in_reply_to: Optional[int] |
| 70 | |
| 71 | @property |
| 72 | def classification(self) -> str: |
| 73 | body_lower = self.body.lower() |
| 74 | for kw in SECURITY_KEYWORDS: |
| 75 | if kw in body_lower: |
| 76 | return "security-flag" |
| 77 | if re.search(r"```suggestion", self.body): |
| 78 | return "valid-fix" |
| 79 | for kw in STYLE_KEYWORDS: |
| 80 | if kw in body_lower: |
| 81 | return "style" |
| 82 | if any( |
| 83 | tok in body_lower |
| 84 | for tok in ( |
| 85 | "should be", |
| 86 | "bug:", |
| 87 | "error:", |
| 88 | "issue:", |
| 89 | "missing ", |
| 90 | "incorrect", |
| 91 | ) |
| 92 | ): |
| 93 | return "valid-fix" |
| 94 | return "false-positive" |
| 95 | |
| 96 | |
| 97 | def _run_gh(args: list[str]) -> str: |