Skip to content

Commit c469eae

Browse files
committed
Chore: Suppress unqualified CodeQL admonitions
GitHub's CodeQL flags [1] those spots with "Unused global variable" [2]. Based on a suggestion [3], this patch attempts to use the `advanced-security/dismiss-alerts` [4] GitHub Action recipe to provide measures to suppress CodeQL flagging by using inline code annotations. [1] https://github.com/crate/crate-python/security/code-scanning [2] https://codeql.github.com/codeql-query-help/python/py-unused-global-variable/ [3] github/codeql#11427 (comment) [4] https://github.com/advanced-security/dismiss-alerts
1 parent 313dd6f commit c469eae

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

.github/workflows/codeql.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,19 @@ jobs:
6363
6464
- name: Perform CodeQL Analysis
6565
uses: github/codeql-action/analyze@v3
66+
with:
67+
category: "/language:${{matrix.language}}"
68+
# define the output folder for SARIF files
69+
output: sarif-results
70+
71+
# Unlock inline mechanism to suppress CodeQL warnings.
72+
# https://github.com/github/codeql/issues/11427#issuecomment-1721059096
73+
- name: Dismiss alerts
74+
if: github.ref == 'refs/heads/main'
75+
uses: advanced-security/dismiss-alerts@v1
76+
with:
77+
# specify a 'sarif-id' and 'sarif-file'
78+
sarif-id: ${{ steps.analyze.outputs.sarif-id }}
79+
sarif-file: sarif-results/${{ matrix.language }}.sarif
80+
env:
81+
GITHUB_TOKEN: ${{ github.token }}

src/crate/client/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@
3131
# regex!
3232
__version__ = "1.0.0"
3333

34-
apilevel = "2.0"
35-
threadsafety = 1
36-
paramstyle = "qmark"
34+
apilevel = "2.0" # codeql[py/unused-global-variable]
35+
threadsafety = 1 # codeql[py/unused-global-variable]
36+
paramstyle = "qmark" # codeql[py/unused-global-variable]

0 commit comments

Comments
 (0)