Table of Contents

Class Suppression

Namespace
Microsoft.DevSkim
Assembly
Microsoft.DevSkim.dll

Processor for rule suppressions

public class Suppression
Inheritance
Suppression
Inherited Members

Constructors

Suppression(TextContainer, int)

public Suppression(TextContainer text, int lineNumber)

Parameters

text TextContainer
lineNumber int

Suppression(string)

Creates new instance of Supressor

public Suppression(string text)

Parameters

text string

Text to work with

Fields

KeywordAll

protected const string KeywordAll = "all"

Field Value

string

KeywordBy

protected const string KeywordBy = "by"

Field Value

string

KeywordIgnore

protected const string KeywordIgnore = "ignore"

Field Value

string

KeywordPrefix

protected const string KeywordPrefix = "DevSkim:"

Field Value

string

KeywordUntil

protected const string KeywordUntil = "until"

Field Value

string

pattern

public const string pattern = "DevSkim:\\s+ignore\\s([a-zA-Z\\d,:]+)(\\s+until\\s\\d{4}-\\d{2}-\\d{2}|)(\\s+by\\s([A-Za-z0-9_]+)|)"

Field Value

string

Properties

ExpirationDate

Suppression expiration date

public DateTime ExpirationDate { get; }

Property Value

DateTime

GetSuppressedIds

public string[] GetSuppressedIds { get; }

Property Value

string[]

Index

Suppression expresion start index on the given line

public int Index { get; }

Property Value

int

IsExpired

Check if the suppression has expired

public bool IsExpired { get; }

Property Value

bool

IsInEffect

Validity of suppression expresion

public bool IsInEffect { get; }

Property Value

bool

True if suppression is in effect

IssuesListIndex

Position of issues list

public int IssuesListIndex { get; set; }

Property Value

int

Length

Suppression expression length

public int Length { get; }

Property Value

int

Reviewer

Get the optional manual reviewer

public string Reviewer { get; }

Property Value

string

_expirationDate

protected DateTime _expirationDate { get; set; }

Property Value

DateTime

_issues

protected List<SuppressedIssue> _issues { get; set; }

Property Value

List<SuppressedIssue>

_lineNumber

protected int _lineNumber { get; set; }

Property Value

int

_lineText

protected string _lineText { get; set; }

Property Value

string

_suppressLength

protected int _suppressLength { get; set; }

Property Value

int

_suppressStart

protected int _suppressStart { get; set; }

Property Value

int

_text

protected TextContainer? _text { get; set; }

Property Value

TextContainer

reg

protected Regex reg { get; set; }

Property Value

Regex

Methods

GetIssues()

Get issue IDs for the suppression

public virtual SuppressedIssue[] GetIssues()

Returns

SuppressedIssue[]

List of issue IDs

GetSuppressedIssue(string)

Test if given rule Id is being suppressed

public SuppressedIssue? GetSuppressedIssue(string issueId)

Parameters

issueId string

Rule ID

Returns

SuppressedIssue

True if rule is suppressed

ParseLine()

protected void ParseLine()