Warning Category Search Language

The CodeSonar warning category search language allows you to specify search conditions based on various warning category properties, and provides basic logical operators for combining multiple conditions. It can be used both to specify and to refine searches.



Warning Category-Specific Grammar

The warning category search language grammar is based on the standard CodeSonar search grammar, with several extensions:

Literal strings are displayed in pink text.

T : quoted-string
  | ilike-condition
  | imatch-condition
  | field-condition
  | ( T )
  | unary T
  | T binary T
  | T T
  | word

field-name : name
           | taxonomy

field-condition terms

The following table shows the relationship between the warning category-specific field-name values and the properties of a warning category, along with the expected type of the condition part of a field-condition.

field-name Contents Condition Type
name Name word | quoted-string
taxonomy Taxonomy word | quoted-string

Plain text terms: word, quoted-string, and none

Plain text search terms—word and quoted-string—are compared against the following fields, with substring search.

Examples

The following table shows simple example queries using field-names from the warning category search language.

Note that search results will only include categories that have appeared in analysis results submitted to the hub.

example explanation
name="CWE:122" Find the category with exactly this name.
name=~~"CWE:1_2" Find categories whose name has the form 'CWE:1c2', where c is a single character.
For example, this will match 'CWE:122' but not 'CWE:1002'.
taxonomy="CERT-C" Find all categories in taxonomies whose names is 'CERT-C' (case-insensitive).
This will include any categories in the built-in CERT-C taxonomy.
taxonomy:CERT Find all categories in taxonomies whose names contain the (case-insensitive) substring 'CERT'.
This will include any categories in built-in taxonomies CERT-C, CERT-CPP, and CERT-Java.
taxonomy=~"c.*t" Find all categories in taxonomies whose names contain substring 'c' and subsequently substring 't' (case insensitively). This will include any categories in built-in taxonomies CERT-C, CERT-CPP, CERT-Java, and typescript-eslint.