[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/github/codeql/codeql-cli-2.11.3/java/ql/src/AlertSuppression.ql [Back]  [Original]

/**
 * @name Alert suppression
 * @description Generates information about alert suppressions.
 * @kind alert-suppression
 * @id java/alert-suppression
 */

import java

/**
 * An alert suppression comment.
 */
class SuppressionComment extends Javadoc {
  string annotation;

  SuppressionComment() {
    // suppression comments must be single-line
    (
      isEolComment(this)
      or
      isNormalComment(this) and exists(int line | this.hasLocationInfo(_, line, _, line, _))
    ) and
    exists(string text | text = this.getChild(0).getText() |
      // match `lgtm[...]` anywhere in the comment
      annotation = text.regexpFind("(?i)\\blgtm\\s*\\[[^\\]]*\\]", _, _)
      or
      // match `lgtm` at the start of the comment and after semicolon
      annotation = text.regexpFind("(?i)(?

Web Proxy Viewer  |  New URL  |  Original Page