csgrep man page

csgrep — filter the list of defects by the specified regex-based predicates

Synopsis

csgrep [options] [file1.err [...]], where options are:

Description

--checker arg

defect matches if its checker matches the given regex (each defect has assigned exactly one checker)

--path arg

defect matches if the path of its key event matches the given regex

--event arg

defect matches if its key event matches the given regex (each defect has exactly one key event, which determines its location in the code)

--error arg

defect matches if the message of its key event matches the given regex

--msg arg

defect matches if any of its messages matches the given regex

--annot arg

defect matches if its annotation matches the given regex

--src-annot arg

defect matches if an annotation in the _source_ file matches the given regex

-U [ --embed-context ] arg

embed a number of lines of context from the source file for the key event

--prune-events arg

event is preserved if its verbosity level is below the given number

-u [ --remove-duplicates ]

remove defects that are not unique by their key event

--strip-path-prefix arg

string prefix to strip from path (applied after all filters)

-i [ --ignore-case ]

ignore case when matching regular expressions

-v [ --invert-match ]

select defects that do not match the selected criteria

-n [ --invert-regex ]

invert regular expressions in all predicates

--color

use colorized console output (default if connected to a terminal)

--no-color

do not use colorized console output

-q [ --quiet ]

do not report any parsing errors

--mode arg (=grep)

grep, json, stat, grouped, files, filestat, or dig_key_events

--help

print the usage of csgrep

--version

print the version of csgrep

Example - Checkers, Events, Messages

Error: FORWARD_NULL (CWE-476):
libhsm.c:1168: assign_zero: Assigning: key_handles = NULL.
libhsm.c:1210: var_deref_op: Dereferencing null pointer key_handles.

In the above example, FORWARD_NULL is the checker , assign_zero and var_deref_op are events , where var_deref_op is the key event and "Dereferencing null pointer key_handles." is the message associated with the key event.

Description of Available Modes

dig_key_events - for each defect, print only the checker and key event

evtstat - print overall checker/key_event statistics for the matched defects

files - print only names of error files that contain the matched defects

filestat - print statistics of matched defects per individual source files

grep - print matched defects using the same format as expected on the input

grouped - print matched defects, grouped by error files they originate from

json - print matched defects in a JSON format

stat - print overall statistics of the matched defects in given error files

Info

February 2017 csgrep 1.3.2 User Commands