Inline suppressing of warnings with Github CodeQL

1.3k Views Asked by At

CodeQL reports some true and some false positive for a specific rule.

Is there a way to mark a Python codeline so that the check is ignored by CodeQL?

Similar, for example to # noqa for Python flake or pep-8 checks.

1

There are 1 best solutions below

0
felickz On

Check out one alternative using the open source project advanced-security/dismiss-alerts. It introduces an additional CodeQL query to extract out //codeql[py/line-too-long] or # noqa style comments in your code (see test.py). Those comments are then fed into the SARIF suppression[] object and dismissed in Code Scanning by calling the GitHub alerts api.