Cppcheck
Classes | Public Member Functions | Private Attributes
Suppressions Class Reference

class for handling suppressions More...

#include <suppressions.h>

List of all members.

Classes

class  FileMatcher
struct  SuppressionEntry

Public Member Functions

std::string parseFile (std::istream &istr)
 Don't show errors listed in the file.
std::string addSuppressionLine (const std::string &line)
 Don't show the given error.
std::string addSuppression (const std::string &errorId, const std::string &file="", unsigned int line=0)
 Don't show this error.
bool isSuppressed (const std::string &errorId, const std::string &file, unsigned int line)
 Returns true if this message should not be shown to the user.
bool isSuppressedLocal (const std::string &errorId, const std::string &file, unsigned int line)
 Returns true if this message should not be shown to the user (explicit files only, not glob patterns).
std::list< SuppressionEntrygetUnmatchedLocalSuppressions (const std::string &file) const
 Returns list of unmatched local (per-file) suppressions.
std::list< SuppressionEntrygetUnmatchedGlobalSuppressions () const
 Returns list of unmatched global (glob pattern) suppressions.

Private Attributes

std::map< std::string,
FileMatcher
_suppressions
 List of error which the user doesn't want to see.

Detailed Description

class for handling suppressions

Definition at line 32 of file suppressions.h.


Member Function Documentation

std::string Suppressions::addSuppression ( const std::string &  errorId,
const std::string &  file = "",
unsigned int  line = 0 
)

Don't show this error.

File and/or line are optional. In which case the errorId alone is used for filtering.

Parameters:
errorIdthe id for the error, e.g. "arrayIndexOutOfBounds"
fileFile name with the path, e.g. "src/main.cpp"
linenumber, e.g. "123"
Returns:
error message. empty upon success

Definition at line 219 of file suppressions.cpp.

References _suppressions.

Referenced by addSuppressionLine(), and Preprocessor::removeComments().

std::string Suppressions::addSuppressionLine ( const std::string &  line)

Don't show the given error.

Parameters:
lineDescription of error to suppress (in id:file:line format).
Returns:
error message. empty upon success

Definition at line 56 of file suppressions.cpp.

References addSuppression(), and Path::fromNativeSeparators().

Referenced by parseFile(), and CmdLineParser::ParseFromArgs().

Returns list of unmatched global (glob pattern) suppressions.

Returns:
list of unmatched suppressions

Definition at line 287 of file suppressions.cpp.

References _suppressions.

Referenced by CppCheckExecutor::check().

std::list< Suppressions::SuppressionEntry > Suppressions::getUnmatchedLocalSuppressions ( const std::string &  file) const

Returns list of unmatched local (per-file) suppressions.

Returns:
list of unmatched suppressions

Definition at line 268 of file suppressions.cpp.

References _suppressions.

Referenced by CppCheck::processFile().

bool Suppressions::isSuppressed ( const std::string &  errorId,
const std::string &  file,
unsigned int  line 
)

Returns true if this message should not be shown to the user.

Parameters:
errorIdthe id for the error, e.g. "arrayIndexOutOfBounds"
fileFile name with the path, e.g. "src/main.cpp"
linenumber, e.g. "123"
Returns:
true if this error is suppressed.

Definition at line 244 of file suppressions.cpp.

References _suppressions.

Referenced by Preprocessor::missingInclude(), CppCheck::reportErr(), and CppCheck::reportInfo().

bool Suppressions::isSuppressedLocal ( const std::string &  errorId,
const std::string &  file,
unsigned int  line 
)

Returns true if this message should not be shown to the user (explicit files only, not glob patterns).

Parameters:
errorIdthe id for the error, e.g. "arrayIndexOutOfBounds"
fileFile name with the path, e.g. "src/main.cpp"
linenumber, e.g. "123"
Returns:
true if this error is suppressed.

Definition at line 256 of file suppressions.cpp.

References _suppressions.

Referenced by Suppressions::FileMatcher::isSuppressed(), CppCheck::reportErr(), and CppCheck::reportInfo().

std::string Suppressions::parseFile ( std::istream &  istr)

Don't show errors listed in the file.

Parameters:
istrOpen file stream where errors can be read.
Returns:
error message. empty upon success

Definition at line 28 of file suppressions.cpp.

References addSuppressionLine().

Referenced by CmdLineParser::ParseFromArgs().


Member Data Documentation

std::map<std::string, FileMatcher> Suppressions::_suppressions [private]

List of error which the user doesn't want to see.

Definition at line 77 of file suppressions.h.

Referenced by addSuppression(), getUnmatchedGlobalSuppressions(), getUnmatchedLocalSuppressions(), isSuppressed(), and isSuppressedLocal().


The documentation for this class was generated from the following files: