CodeQL library for Java/Kotlin
codeql/java-all 4.1.1 (changelog, source)
Search

Predicate restrictAlertsTo

Restricts alerts to a specific location in specific files.

If this predicate is empty, accept all alerts. Otherwise, accept alerts only at the specified locations. Note that alert restrictions apply only to the start line of an alert (even if the alert location spans multiple lines) because alerts are displayed on their start lines.

  • filePath: Absolute path of the file to restrict alerts to.
  • startLine: Start line number (starting with 1, inclusive) to restrict alerts to.
  • endLine: End line number (starting with 1, inclusive) to restrict alerts to.

If startLine and endLine are both 0, accept alerts anywhere in the file.

Import path

import codeql.util.AlertFiltering
predicate restrictAlertsTo(string filePath, int startLine, int endLine)