Commit e46e6ca
Refactor: Improve modularity and fix bugs in check_codeql_alerts.py
Refactor the `check_codeql_alerts.py` script to improve its structure and remove all uses of `locals()`.
- The large `main()` function has been broken down into smaller, more focused helper functions (`_compare_alerts_via_api` and `_build_multi_section_comment`).
- A new `APIAlertComparison` dataclass is used to provide a clear data structure for API comparison results.
- This refactoring eliminates the need for `locals()` by ensuring variables are properly initialized and passed between functions.
Fixes the following bugs introduced during the refactoring:
- A `NameError` caused by incorrect class definition order.
- A regression where matched alerts were no longer reported in the summary output.
- A regression in the logic for when to post a PR comment.1 parent 9e6e198 commit e46e6ca
1 file changed
+15
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | 18 | | |
34 | 19 | | |
35 | 20 | | |
| |||
117 | 102 | | |
118 | 103 | | |
119 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| |||
0 commit comments