JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.

If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.

If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.

CodeSonar® 9.2p0 CONFIDENTIAL CodeSecure Inc


Procedure Search Language

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

Note that procedure-domain searches are only available within the scope of a focal analysis, and the results will depend on procedure information availability.



Procedure-Specific Grammar

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

Literal strings are displayed in pink text.

T : quoted-string
  | metric-condition
  | ilike-condition
  | imatch-condition
  | field-condition
  | ( T )
  | unary T
  | T binary T
  | T T
  | word
  
metric-condition : metric-tag ext-operator num
                 | metric-tag operator num-range

metric-tag : the tag of any procedure-granularity metric class (built-in or user-defined) on the hub 

ext-operator : <
             | <=
             | >=
             | >

field-name : directory
           | file
           | language
           | path
           | procedure     

field-condition terms

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

field-name Contents Condition Type
directory Procedure File . Directory word | quoted-string
file Procedure File . File word | quoted-string
language Procedure File . Language word | quoted-string
path Procedure File . File Path word | quoted-string
procedure Procedure word | quoted-string (case-sensitive)

word and quoted-string terms

word and quoted-string search terms are compared against Procedure, with substring search:

Examples

The following table shows simple example queries using field-names and metric-conditions from the procedure search language.

example explanation
vG:100..250 Find procedures with Cyclomatic Complexity (vG) between 100 and 250 (inclusive).
  • Note that these procedures must belong to an analysis that computed vG[Procedure].
ab Find procedures whose name includes (case-sensitive) substring ab.
ab cd Find procedures whose name includes (case-sensitive) both substring ab and substring cd.
directory:module Find procedures defined in any file in a directory whose path includes (case-insensitive) substring module.
file=foo.c Find procedures defined in any file with (case-insensitive) basename foo.c.
language=C Find procedures defined in files whose language is C (not C++).
path:src/mod1/bar.c Find procedures defined in any file whose absolute name contains (case-insensitive) substring src/mod1/bar.c.
procedure:print Find procedures whose name contains (case-sensitive) substring print.
procedure=FF Find procedures whose name is (case-sensitive) FF.
procedure=~book.*open Find procedures whose name contains the string 'book' and subsequently substring 'open' (case insensitive).
procedure=~~p%epd Find procedures whose name starts with 'p' and ends with 'epd' (case insensitive).
 

To report problems with this documentation, please visit https://support.codesecure.com/.