Skip to content

Commit

Permalink
The store command sends the analysis results in a .zip file to the se…
Browse files Browse the repository at this point in the history
…rver
  • Loading branch information
bruntib committed Aug 18, 2017
1 parent a112911 commit 99d53ad
Show file tree
Hide file tree
Showing 25 changed files with 1,695 additions and 1,130 deletions.
94 changes: 27 additions & 67 deletions api/report_server.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ 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<string, i32> detectionStatusCount
8: map<shared.DetectionStatus, i32> detectionStatusCount
// this maps the detection status to its count
}
typedef list<RunData> RunDataList
Expand All @@ -55,7 +55,7 @@ struct ReportData{
// execution step list.
8: shared.Severity severity // checker severity
9: ReviewData review // bug review status informations.
10: string detectionStatus // 'new', 'resolved', 'unresolved', 'reopened'
10: shared.DetectionStatus detectionStatus // state of the bug (see the enum constant values)
}
typedef list<ReportData> ReportDataList

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

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

//-----------------------------------------------------------------------------
struct CommentData {
1: i64 id,
Expand Down Expand Up @@ -306,69 +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 storeZip() 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 storeZip(
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,
3: i64 run_id)
throws (1: shared.RequestFailed requestError),

bool addFileContent(
1: string content_hash,
2: string file_content,
3: optional Encoding encoding,
4: i64 run_id)
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
}
74 changes: 0 additions & 74 deletions db_migrate/versions/41c3d07202db_detection_status.py

This file was deleted.

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

0 comments on commit 99d53ad

Please sign in to comment.