Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detection status #724

Merged
merged 2 commits into from
Aug 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 38 additions & 73 deletions api/report_server.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ struct RunData{
6: string runCmd, // the used check command
7: optional bool can_delete // true if codeCheckerDBAccess::removeRunResults()
// is allowed on this run (see issue 151)
8: map<shared.DetectionStatus, i32> detectionStatusCount
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There will be a separate count api with filtering if the schema is ready. I'm not sure we should return this value here. For now we can keep it.

// this maps the detection status to its count
}
typedef list<RunData> RunDataList

Expand All @@ -43,16 +45,17 @@ struct ReviewData{

//-----------------------------------------------------------------------------
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: 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: ReviewData review // bug review status informations.
1: string checkerId, // the qualified id of the checker that reported this
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a name, not an id.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how the API was laid out originally, just Git sometimes diffs bigger hunks than what was actually changed. If this is changed, perhaps a lot of places irrelevant to this PR would need be changed too (especially on the webgui, and such)!

2: string bugHash, // This is unique id of the concrete report.
3: string checkedFile, // this is a filepath
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is checkedFile? The TU for which we run the analyzer? Or the last/uniquing position of the bug? If the later, this name is misleading. Maybe we should fix it with this patch.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment about renaming above, the same applies here. This is the file that the bug was reported in, the file that you can search on the webgui. It is labelled as sourcefile in the database, most likely it is the path that was used as a source when the analyzer was invoked.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checkedFile is confusing indeed. Maybe sourceFileName would be a better name...

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: ReviewData review // bug review status informations.
10: shared.DetectionStatus detectionStatus // state of the bug (see the enum constant values)
}
typedef list<ReportData> ReportDataList

Expand Down Expand Up @@ -144,12 +147,6 @@ enum DiffType {
UNRESOLVED
}

//-----------------------------------------------------------------------------
struct NeedFileResult {
1: bool needed;
2: i64 fileId;
}

//-----------------------------------------------------------------------------
struct CommentData {
1: i64 id,
Expand Down Expand Up @@ -303,67 +300,35 @@ service codeCheckerDBAccess {
// Analysis result storage related API calls.
//============================================

// store checker run related data to the database
// by default updates the results if name was already found
// using the force flag removes existing analysis results for a run
i64 addCheckerRun(
1: string command,
2: string name,
3: string version,
4: bool force)
throws (1: shared.RequestFailed requestError),
// The client can ask the server whether a file is already stored in the
// database. If it is, then it is not necessary to send it in the ZIP file
// with massStoreRun() function. This function requires a list of file hashes
// (sha256) and returns the ones which are not stored yet.
list<string> necessaryFileContents(
1: list<string> file_hashes)
throws (1: shared.RequestFailed requestError),

// This function stores an entire run encapsulated and sent in a ZIP file.
// The ZIP file has to be compressed and sent as a base64 encoded string. The
// ZIP file must contain exactly one directory which has a "reports" and an
// optional "root" sub-folder. The former one is the output of "CodeChecker
// analyze" command and the latter one contains the source files on absolute
// paths starting as if "root" was the "/" directory. The source files are
// not necessary to be wrapped in the ZIP file (see necessaryFileContents()
// function).
// The "version" parameter is the used CodeChecker version which checked this
// run.
// The "force" parameter removes existing analysis results for a run.
i64 massStoreRun(
1: string run_name,
2: string version,
3: string zipfile,
4: bool force)
throws (1: shared.RequestFailed requestError),

bool replaceConfigInfo(
1: i64 run_id,
2: shared.CheckerConfigList values)
throws (1: shared.RequestFailed requestError),

# the map contains a path and a comment (can be empty)
bool addSkipPath(
1: i64 run_id,
2: map<string, string> paths)
throws (1: shared.RequestFailed requestError),


// The next few following functions must be called via the same connection.
// =============================================================
i64 addReport(
1: i64 run_id,
2: i64 file_id,
3: string bug_hash,
4: string checker_message,
5: shared.BugPath bugpath,
6: shared.BugPathEvents events,
7: string checker_id,
8: string checker_cat,
9: string bug_type,
10: shared.Severity severity)
throws (1: shared.RequestFailed requestError),


// * If (filepath, content_hash) is in the DB return (existing fileId, false).
// * If only the content_hash matches, a (new fileId, false) is returned.
// * If the filepath matches, but content_hash not, a (new file_id, true) is returned.
// * If none of them matches a (new file_id, true) is returned.
NeedFileResult needFileContent(
1: string filepath,
2: string content_hash)
throws (1: shared.RequestFailed requestError),

bool addFileContent(
1: string content_hash,
2: string file_content,
3: optional Encoding encoding)
throws (1: shared.RequestFailed requestError),

bool finishCheckerRun(1: i64 run_id)
throws (1: shared.RequestFailed requestError),

bool setRunDuration(1: i64 run_id,
2: i64 duration)
throws (1: shared.RequestFailed requestError),

bool stopServer()
throws (1: shared.RequestFailed requestError)

}
11 changes: 11 additions & 0 deletions api/shared.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,14 @@ enum ReviewStatus {
WONT_FIX // This is a bug but we don't want to fix it.
}

// DetectionStatus is set by the storage process. When a new bug appears then
// the status is NEW. If the bug disappears during an update process in a run
// then it becomes RESOLVED. If a bug remains in an update process then it
// becomes UNRESOLVED. If a bug was RESOLVED and appears again then it becomes
// REOPENED until it disappears again.
enum DetectionStatus {
NEW,
RESOLVED,
UNRESOLVED,
REOPENED
}
15 changes: 0 additions & 15 deletions libcodechecker/analyze/analyzers/analyzer_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from libcodechecker.analyze.analyzers import config_handler_clangsa
from libcodechecker.analyze.analyzers import result_handler_base
from libcodechecker.analyze.analyzers import result_handler_clang_tidy
from libcodechecker.analyze.analyzers import result_handler_plist_to_db
from libcodechecker.analyze.analyzers import result_handler_plist_to_stdout
from libcodechecker.logger import LoggerFactory

Expand Down Expand Up @@ -401,17 +400,3 @@ def construct_parse_handler(buildaction,
res_handler.severity_map = severity_map
res_handler.suppress_handler = suppress_handler
return res_handler


def construct_store_handler(buildaction,
run_id,
severity_map):
"""
Construct a result handler for storing results in a database.
"""
res_handler = result_handler_plist_to_db.PlistToDB(
buildaction,
None,
run_id)
res_handler.severity_map = severity_map
return res_handler
18 changes: 0 additions & 18 deletions libcodechecker/analyze/analyzers/result_handler_clang_tidy.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
from libcodechecker.analyze import tidy_output_converter
from libcodechecker.analyze.analyzers.result_handler_base \
import ResultHandler
from libcodechecker.analyze.analyzers.result_handler_plist_to_db \
import PlistToDB
from libcodechecker.analyze.analyzers.result_handler_plist_to_stdout \
import PlistToStdout
from libcodechecker.logger import LoggerFactory
Expand Down Expand Up @@ -46,22 +44,6 @@ def postprocess_result(self):
generate_plist_from_tidy_result(output_file, tidy_stdout)


class ClangTidyPlistToDB(PlistToDB):
"""
Store clang tidy plist results to a database.
"""

def postprocess_result(self):
"""
Generate plist file which can be parsed and processed for
results which can be stored into the database.
"""
output_file = self.analyzer_result_file
LOG.debug_analyzer(self.analyzer_stdout)
tidy_stdout = self.analyzer_stdout.splitlines()
generate_plist_from_tidy_result(output_file, tidy_stdout)


class ClangTidyPlistToStdout(PlistToStdout):
"""
Print the clang tidy results to the standard output.
Expand Down
Loading