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


Project Search Language

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



Grammar

The project 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
  | none
  
metric-condition : metric-tag ext-operator num
                 | metric-tag operator num-range

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

property-condition : property-key operator word
                   | property-key operator quoted-string

property-key : the key of any user-assigned analysis property associated with at least one analysis on the hub 

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

field-name : ancestor 
           | autodelete_rules 
           | created 
           | parent 
           | parent_id 
           | pdesc 
           | pid 
           | project 
           | ptree_path 
           | last_address 
           | last_adesc 
           | last_analysis 
           | last_dryrun 
           | last_filecount 
           | last_finished 
           | last_install 
           | last_machine 
           | last_prjfiles 
           | last_protected 
           | last_started 
           | last_user 
           | last_warningcount
           | sql 
   

field-condition terms

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

Although metric-tag and property-key are not field-name values, we include them in this table for completeness.

field-name Contents Condition Type
ancestor Ancestors word | quoted-string, or special value none (*).
autodelete_rules Project-Wide Autodeletion? boolean
created Created date-range
metric-tag The value in Last Analysis of the analysis-granularity metric whose tag is metric-tag. See metric-condition
parent Parent Project Tree . PTree Name word | quoted-string, or special value none (*).
parent_id Parent Project Tree . PTree ID int-range
pdesc Project Description word | quoted-string, or special value none (*).
pid Project ID int-range
project Name word | quoted-string, or special value none (*).
property-key The value in Last Analysis of the user-assigned analysis property whose key is property-key.
Searching for none behaves as follows.
  • If no analysis on the hub has user-assigned property property-key, then property-key:none will not match any projects.
  • Otherwise, property-key:none will match:
    • all projects whose last analysis has user-assigned property property-key with value matching none (as described above),
      and
    • all projects whose last analysis does not have user-assigned property property-key.
word | quoted-string, or special value none (*).
ptree_path Project Path word | quoted-string, or special value none (*).
last_address Last Analysis . Analysis Launch Daemon . Address word | quoted-string, or special value none (*).
last_adesc Last Analysis . Analysis Description word | quoted-string, or special value none (*).
last_analysis Last Analysis . Analysis word | quoted-string, or special value none (*).
last_dryrun Last Analysis . Dry Run? boolean
last_filecount Last Analysis . File Count int-range
last_finished Last Analysis . Finished date-range
last_install Last Analysis . Analysis Launch Daemon . Installation word | quoted-string, or special value none (*).
last_machine Last Analysis . Analysis Launch Daemon . Machine word | quoted-string, or special value none (*).
last_prjfiles Last Analysis . Analysis Directory . prj_files Location word | quoted-string, or special value none (*).
last_protected Last Analysis . Protected? boolean
last_started Last Analysis . Started date-range
last_user Last Analysis . Analysis Launch Daemon . System User word | quoted-string, or special value none (*).
last_warningcount Last Analysis . Warning Count int-range
sql Introduces an SQL expression (see SQL Terms, below). word | quoted-string

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

Plain text search terms—word, quoted-string, and none—are compared against a subset of the fields, with substring search:

Examples

Example Explanation
ancestor:/TreeX/TreeA Find projects that have an ancestor project tree whose name begins with string TreeA, and whose parent project tree name is TreeX.
Note that this will not match a project whose name is TreeA and parent project tree name is TreeX: components in an ancestor term are matched against project tree names only. (Contrast with ptree_path example.)
autodelete_rules=false Find projects that do not currently have project-wide autodeletion enabled (and so are controlled by the hub-wide autodeletion settings).
created:9/2013..11/2013 Find projects that were created between 9/2013 and 11/2013 (inclusive).

The interpretation of 9/2013 and 11/2013 depends on your Date Parse Formats setting. By default, 9/2013 is interpreted as September 2013 and 11/2013 is interpreted as November 2013. If you want a different interpretation, change the settings in the Content tab of the Settings page.

last_address=192.0.2.7 Find projects whose last analysis was carried out on the machine with address 192.0.2.7.
last_adesc="Version 1.0 of the thingy management system" Find projects whose last analysis has exactly this description (case insensitively).
last_analysis="tms analysis 5" Find projects whose last analysis has exactly this name (case insensitive).
last_dryrun=false Find projects whose last analysis was not a dry run.
last_filecount:100.. Find projects where the number of files analyzed in the last analysis was between one and ten (inclusive).
last_finished:2013 Find projects whose last analysis finished in 2013.
last_install="C:\\Program Files\\CodeSecure\\" Find projects whose last analysis was performed using the CodeSonar installation located at c:\Program Files\CodeSecure (case-insensitive) on some machine. Note that backslashes must be escaped.
last_started:"last 30 days" Find projects whose last analysis started between thirty days ago and now. Thirty days is defined to be 30*24*60*60 seconds.
last_machine=alexmachine Find projects whose last analysis was carried out on a machine named alexmachine.
last_prjfiles:/u/csonaranalyses/ Find projects where the absolute path to the analysis directory for the last analysis contains /u/csonaranalyses/ (case-insensitive).
last_protected=false Find projects whose last analysis is not currently protected from auto-deletion.
last_user=lindsay Find projects whose last analysis was performed by username lindsay.
last_user:none Find projects for which either of the following is true.

Note that the second of these is because none is a special value.

last_warningcount=101 Find projects whose last analysis issued exactly 101 warnings.
myProperty:"urgent" Find projects whose last analysis has user-assigned property with key myProperty and value containing (case-insensitive) substring urgent.
myProperty:none If no analysis on the hub has a user-assigned property with key myProperty, the result set is empty.
Otherwise, find projects for which any of the following are true of the last analysis.
  • The analysis does not have a user-assigned property with key myProperty.
  • The analysis has a user-assigned property with key myProperty and value containing (case-insensitive) substring none.
  • The analysis has a user-assigned property with key myProperty and empty value.
parent="Team X Projects" Find projects whose parent project tree has exactly this PTree Name (case-insensitive).
parent_id=5 Find projects whose parent project tree has PTree ID 5.
pdesc="thingy management system" Find projects with exactly this description (case-insensitive).
pdesc=~super.*project Find projects whose description contains the substring 'super' and subsequently substring 'project' (case insensitive).
pdesc:none Find projects for which either of the following is true of the project description.
  • The description contains (case-insensitive) substring none.
  • The description contains no text, either because it has never been set or because it has been set and subsequently deleted.

Note that the second of these is because none is a special value.

pid:..4 Find projects whose Project ID is 4 or lower.
project:ProjectX Find projects whose name includes string ProjectX (case-insensitive).
project=~~bas%j Find projects whose name starts with 'bas' and ends with j (case-insensitive).
ptree_path:/TreeX/TreeA Find:
(Contrast with ancestor example.)
LCodeOnly≥5 Find projects whose last analysis reported a value of 5 or greater for the analysis-granularity LCodeOnly metric.

SQL Terms

The sql field-name is provided to allow extra search customization, but is not supported. It is only available to users with G_SQL_CONSOLE permission.

For a search that includes a field-condition of the form

sql:cond

CodeSonar will obtain search results by executing an SQL statement of the form

SELECT <your specified columns>
   FROM <CodeSonar-determined relation>
   WHERE <other-terms1 OP1> cond  <OP2 other-terms2>
   ORDER BY <your specified order>
  

where

<your specified columns> Depends on the set of columns you have chosen to display in the search result table.
<CodeSonar-determined relation> Depends on <your specified columns> and <other-terms1,2> but will be either cs_project or a join of cs_project and one or more other relations.
<other-terms1,2>, <OP1,2> Depend on the other terms (specified or implicit) in your search, and the operators used to combine them.
cond Is a boolean expression suitable for evaluation in the WHERE clause of this query.
your specified order Depends on the sort order(s) you have imposed on the search result table.
 

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