Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions powershell/ql/src/AlertSuppression.ql
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* @name Alert suppression
* @description Generates information about alert suppressions.
* @kind alert-suppression
* @id powershell/alert-suppression
*/

private import codeql.util.suppression.AlertSuppression as AS
private import powershell as P

class AstNode extends P::Ast {
predicate hasLocationInfo(
string filepath, int startline, int startcolumn, int endline, int endcolumn
) {
this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
}
}

class SingleLineComment extends P::SingleLineComment {
private string text;

SingleLineComment() {
// Strip the leading '#' from single-line PowerShell comments
text = this.getCommentContents().getValue().suffix(1)
}

predicate hasLocationInfo(
string filepath, int startline, int startcolumn, int endline, int endcolumn
) {
this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
}

string getText() { result = text }
}

import AS::Make<AstNode, SingleLineComment>
Loading