Skip to content

Commit

Permalink
Review status of issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
csordasmarton committed Aug 8, 2017
1 parent 83de267 commit f4f60cb
Show file tree
Hide file tree
Showing 31 changed files with 638 additions and 1,108 deletions.
59 changes: 18 additions & 41 deletions api/report_server.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ typedef list<RunData> RunDataList

//-----------------------------------------------------------------------------
struct ReportData{
1: string checkerId, // the qualified id of the checker that reported this
2: string bugHash, // This is unique id of the concrete report.
3: string checkedFile, // this is a filepath
4: string checkerMsg, // description of the bug report
5: i64 reportId, // id of the report in the current run in the db
6: bool suppressed, // true if the bug is suppressed
7: i64 fileId, // unique id of the file the report refers to
8: shared.BugPathEvent lastBugPosition // This contains the range and message of the last item in the symbolic
// execution step list.
9: shared.Severity severity // checker severity
10: optional string suppressComment // suppress commment if report is suppressed
1: string checkerId, // the qualified id of the checker that reported this
2: string bugHash, // This is unique id of the concrete report.
3: string checkedFile, // this is a filepath
4: string checkerMsg, // description of the bug report
5: i64 reportId, // id of the report in the current run in the db
6: i64 fileId, // unique id of the file the report refers to
7: shared.BugPathEvent lastBugPosition // This contains the range and message of the last item in the symbolic
// execution step list.
8: shared.Severity severity // checker severity
9: shared.ReviewStatus reviewStatus // bug review status.
10: string reviewComment // review commment if review status is changed.
}
typedef list<ReportData> ReportDataList

Expand All @@ -61,8 +61,7 @@ struct ReportFilter{
3: optional shared.Severity severity,
4: optional string checkerId, // should filter in the fully qualified checker id name such as alpha.core.
// the analyzed system. Projects can optionally use this concept.
5: optional bool suppressed = false, // if the bug state is suppressed
6: optional string bugHash
5: optional string bugHash
}

/**
Expand Down Expand Up @@ -193,20 +192,11 @@ service codeCheckerDBAccess {
3: optional Encoding encoding)
throws (1: shared.RequestFailed requestError),

// suppress the bug
bool suppressBug(1: list<i64> runIds,
2: i64 reportId,
3: string comment)
throws (1: shared.RequestFailed requestError),

// unsuppress the bug
bool unSuppressBug(1: list<i64> runIds,
2: i64 reportId)
throws (1: shared.RequestFailed requestError),

// get suppressed bugs in a run
shared.SuppressBugList getSuppressedBugs(1: i64 run_id)
throws(1: shared.RequestFailed requestError),
// change review status of a bug.
bool changeReviewStatus(1: i64 reportId,
2: shared.ReviewStatus status,
3: string message)
throws (1: shared.RequestFailed requestError),

// get comments for a bug
CommentDataList getComments(1: i64 reportId)
Expand Down Expand Up @@ -322,18 +312,6 @@ service codeCheckerDBAccess {
2: shared.CheckerConfigList values)
throws (1: shared.RequestFailed requestError),

bool addSuppressBug(
1: i64 run_id,
2: shared.SuppressBugList bugsToSuppress
)
throws (1: shared.RequestFailed requestError),

# remove all suppress information from the database
bool cleanSuppressData(
1: i64 run_id,
)
throws (1: shared.RequestFailed requestError),

# the map contains a path and a comment (can be empty)
bool addSkipPath(
1: i64 run_id,
Expand All @@ -353,8 +331,7 @@ service codeCheckerDBAccess {
7: string checker_id,
8: string checker_cat,
9: string bug_type,
10: shared.Severity severity,
11: bool suppress)
10: shared.Severity severity)
throws (1: shared.RequestFailed requestError),


Expand Down
7 changes: 7 additions & 0 deletions api/shared.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,10 @@ exception RequestFailed {
2: string message
}

enum ReviewStatus {
UNREVIEWED, // Nobody has seen this bug.
CONFIRMED, // This is really bug.
FALSE_POSITIVE, // This is not a bug.
WONT_FIX // This is a bug but we don't want to fix it.
}

123 changes: 19 additions & 104 deletions docs/user_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ usage: CodeChecker check [-h] [--keep-tmp] [-c] [--update] -n NAME
[--saargs CLANGSA_ARGS_CFG_FILE]
[--tidyargs TIDY_ARGS_CFG_FILE]
[-e checker/checker-group] [-d checker/checker-group]
[-u SUPPRESS] [--host HOST] [-p PORT]
[--host HOST] [-p PORT]
[--verbose {info,debug,debug_analyzer}]
Run analysis for a project with storing results in the database. Check only
Expand All @@ -148,7 +148,6 @@ optional arguments:
data, such as intermediate result files and the
database. (default: /home/<username>/.codechecker)
-f, --force
-u SUPPRESS, --suppress SUPPRESS
--verbose {info,debug,debug_analyzer}
Set verbosity level. (default: info)
Expand Down Expand Up @@ -228,7 +227,7 @@ usage: CodeChecker quickcheck [-h] [-q] (-b COMMAND | -l LOGFILE)
[--saargs CLANGSA_ARGS_CFG_FILE]
[--tidyargs TIDY_ARGS_CFG_FILE]
[-e checker/checker-group]
[-d checker/checker-group] [-u SUPPRESS] [-s]
[-d checker/checker-group] [-s]
[--verbose {info,debug,debug_analyzer}]
Run analysis for a project with printing results immediately on the standard
Expand Down Expand Up @@ -262,7 +261,6 @@ checker configuration:
output arguments:
-u SUPPRESS, --suppress SUPPRESS
-s, --steps, --print-steps
~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -629,33 +627,6 @@ then the results of the analysis can be printed with
CodeChecker parse ./my_plists
~~~~

### _Suppress_ file

~~~~~~~~~~~~~~~~~~~~~
--suppress SUPPRESS Path of the suppress file to use. Records in the
suppress file are used to suppress the display of
certain results when parsing the analyses' report.
NOTE: The suppress file relies on the "bug
identifier" generated by the analyzers which is
experimental, take care when relying on it.
~~~~~~~~~~~~~~~~~~~~~

Certain defects reported by the analyzers might only cause clutter in the
output, e.g. because they are false positive results, or some other reason why
we don't want to show them, such as the bug not being relevant to your project
as it happens in a library you use. (In case of false positives, please report
the false positive to us and/or the LLVM community so that the checker which
reported it could be investigated and fixed!)

Suppress files contain information about suppressed analysis reports in an
internal format, and a suppressed report will not be shown in the output by
default. Suppress files should not be edited manually, instead, a CodeChecker
viewer server should manage them, but the suppress file could be committed
into the source code repository for distribution to teammates.

If `--suppress` is specified, `parse` will use the given suppress file and
will not show reports on the standard output which are marked as suppressed.

### Suppression in the source code

Suppress comments can be used in the source files to suppress specific or all
Expand Down Expand Up @@ -701,18 +672,7 @@ void test() {
--export-source-suppress
Write suppress data from the suppression annotations
found in the source files that were analyzed earlier
that created the results. The suppression information
will be written to the parameter of '--suppress'.
~~~~~~~~~~~~~~~~~~~~~

Using `CodeChecker parse`, you can automatically generate a suppress file
(compatible with `parse`, `store` and `server`) from suppressions found in the
source code, by specifying `--export-source-suppress` along with a file path in
`--suppress`.

In case the file given as `--suppress` already exists, it will be extended with
the results, otherwise, a new file will be created.

that created the results.
~~~~
CodeChecker parse ./my_plists --suppress generated.suppress --export-source-suppress
~~~~
Expand All @@ -728,7 +688,7 @@ to the database.
~~~~~~~~~~~~~~~~~~~~~
usage: CodeChecker store [-h] [-t {plist}] [-j JOBS] [-n NAME]
[--suppress SUPPRESS] [-f] [--host HOST] [-p PORT]
[-f] [--host HOST] [-p PORT]
[--verbose {info,debug,debug_analyzer}]
[file/folder [file/folder ...]]

Expand All @@ -752,14 +712,6 @@ optional arguments:
reports to the database. If not specified, the '--
name' parameter given to 'codechecker-analyze' will be
used, if exists.
--suppress SUPPRESS Path of the suppress file to use. Records in the
suppress file are used to mark certain stored analysis
results as 'suppressed'. (Reports to an analysis
result can also be suppressed in the source code --
please consult the manual on how to do so.) NOTE: The
suppress file relies on the "bug identifier" generated
by the analyzers which is experimental, take care when
relying on it.
-f, --force Delete analysis results stored in the database for the
current analysis run's name and store only the results
reported in the 'input' files. (By default,
Expand Down Expand Up @@ -976,7 +928,7 @@ or via the `CodeChecker cmd` command-line client.
~~~~~~~~~~~~~~~~~~~~~
usage: CodeChecker server [-h] [-w WORKSPACE] [-f CONFIG_DIRECTORY]
[--host LISTEN_ADDRESS] [-v PORT] [--not-host-only]
[-u SUPPRESS] [--sqlite SQLITE_FILE | --postgresql]
[--sqlite SQLITE_FILE | --postgresql]
[--dbaddress DBADDRESS] [--dbport DBPORT]
[--dbusername DBUSERNAME] [--dbname DBNAME]
[-l | -s | --stop-all]
Expand Down Expand Up @@ -1009,14 +961,6 @@ optional arguments:
locally, but to everyone, who can access the server
over the Internet. (Equivalent to specifying '--host
""'.) (default: False)
-u SUPPRESS, --suppress SUPPRESS
Path of the suppress file to use. The suppress file is
used to store which analysis results are marked
'suppressed', which is a distinct category on the
result viewing interface. NOTE: The suppress file
relies on the "bug identifier" generated by the
analyzers which is experimental, take care when
relying on it.
--verbose {info,debug,debug_analyzer}
Set verbosity level. (default: info)

Expand Down Expand Up @@ -1321,75 +1265,46 @@ optional arguments:
### Manage and export/import suppressions (`suppress`)
~~~~~~~~~~~~~~~~~~~~~
usage: CodeChecker cmd suppress [-h] -n RUN_NAME [-f]
(-e SUPPRESS_FILE | -i SUPPRESS_FILE | --bugid BUGID)
[--file FILE] [-x] [-c COMMENT] [--host HOST]
[-p PORT]
usage: CodeChecker cmd suppress [-h] -n RUN_NAME [-f] -i SUPPRESS_FILE
[--host HOST] [-p PORT]
[--verbose {info,debug,debug_analyzer}]

Exports or imports suppressions from a CodeChecker server from/to a suppress
file, and is also used (if '--bugid' is specified) to (un)suppress reports.
Imports suppressions from a suppress file to a CodeChecker server.

optional arguments:
-h, --help show this help message and exit
-n RUN_NAME, --name RUN_NAME
Name of the analysis run to suppress or unsuppress a
report in.
-f, --force Enable suppression of already suppressed reports.
-e SUPPRESS_FILE, --export SUPPRESS_FILE
Export into a suppress file from suppressions in the
server's database.
-i SUPPRESS_FILE, --import SUPPRESS_FILE
Import suppression from the suppress file into the
database.
--bugid BUGID Manage suppression of the defect report based on its
ID.
per-report arguments:
Options here are only applicable is '--bugid' is specified!
server arguments:
Specifies a 'CodeChecker server' instance which will be used to store the
results. This server must be running and listening prior to the 'store'
command being ran.

--file FILE Suppress/unsuppress the given report ONLY in the
specified file, instead of every occurrence of it.
-x, --unsuppress Unsuppress the specified report. (If not given,
default action is to suppress a report.)
-c COMMENT, --comment COMMENT
Specify the (optional) comment which explains why the
given report is suppressed.
--host HOST The IP address or hostname of the CodeChecker server.
(default: localhost)
-p PORT, --port PORT The port of the server to use for storing. (default:
8001)
--verbose {info,debug,debug_analyzer}
Set verbosity level. (default: info)
~~~~~~~~~~~~~~~~~~~~~
#### Export/import suppressions between server and suppress file
#### Import suppressions between server and suppress file
~~~~~~~~~~~~~~~~~~~~~
-e SUPPRESS_FILE, --export SUPPRESS_FILE
Export into a suppress file from suppressions in the
server's database.
-i SUPPRESS_FILE, --import SUPPRESS_FILE
Import suppression from the suppress file into the
database.
~~~~~~~~~~~~~~~~~~~~~
`--export` can be used to create a suppress file from the suppressions
stored in the database for a given run.

`--import` **appends** the suppressions found in the given suppress file to
the database on the server.
#### Suppress or unsuppress a particular bug report

~~~~~~~~~~~~~~~~~~~~~
--bugid BUGID Manage suppression of the defect report based on its
ID.
--file FILE Suppress/unsuppress the given report ONLY in the
specified file, instead of every occurrence of it.
-x, --unsuppress Unsuppress the specified report. (If not given,
default action is to suppress a report.)
-c COMMENT, --comment COMMENT
Specify the (optional) comment which explains why the
given report is suppressed.
~~~~~~~~~~~~~~~~~~~~~

### Authenticate to the server (`login`)
~~~~~~~~~~~~~~~~~~~~~
Expand Down
19 changes: 8 additions & 11 deletions libcodechecker/analyze/analyzers/result_handler_plist_to_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,6 @@ def __store_bugs(self, files, reports, client):
report_hash,
checker_name)

# Check for suppress comment.
supp = sp_handler.get_suppressed()
if supp:
bhash, fname, comment = supp
suppress_data = shared.ttypes.SuppressBugData(bhash,
fname,
comment)
client.addSuppressBug(self.__run_id, [suppress_data])

LOG.debug('Storing check results to the database.')

fpath = files[report.main['location']['file']]
Expand All @@ -180,12 +171,18 @@ def __store_bugs(self, files, reports, client):
checker_name,
category,
type,
severity,
supp is not None)
severity)

LOG.debug("Storing done for report " + str(report_id))
report_ids.append(report_id)

# Check for suppress comment.
supp = sp_handler.get_suppressed()
if supp:
bhash, fname, comment = supp
status = shared.ttypes.ReviewStatus.UNREVIEWED
client.changeReviewStatus(report_id, status, comment)

def handle_results(self, client=None):
"""
Send the plist content to the database.
Expand Down
Loading

0 comments on commit f4f60cb

Please sign in to comment.