-
Notifications
You must be signed in to change notification settings - Fork 379
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
Detection status #724
Conversation
8b0b361
to
cb00d86
Compare
def handle_results(self, client=None): | ||
return report_ids | ||
|
||
def handle_results(self, client): | ||
""" | ||
Send the plist content to the database. | ||
Server API calls should be used in one connection. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same one connection thing pointed out by @dkrupp earlier is here. We should clarify this, somehow.
libcodechecker/orm_model.py
Outdated
detection_status = Column(Enum('new', | ||
'unresolved', | ||
'resolved', | ||
'reopened')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So after all, should we keep the reopened
status?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we keep reopened
. Moreover in the latest implementation a report stays reopened unit it becomes resolved again.
libcodechecker/libhandlers/store.py
Outdated
|
||
|
||
def consumed_results(client, run_id): | ||
def markFixed(l): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Let's keep not introducing style warnings and keep to the Pythonic nomenclature, mark_fixed
. Also comment below is not a full sentence. I'm Vice Xazax now! 😛 )
//--- Details ---// | ||
|
||
this.addChild(new Button({ | ||
label : 'Details', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this is that ugly window of #566. Good riddance, I think. I'm okay with losing this information, didn't seem too useful in the first place. If analysing a file failed, where could have the user click Details
to find the failure output and such in the first place?
libcodechecker/libhandlers/server.py
Outdated
i['workspace']) == | ||
os.path.abspath( | ||
args.config_directory))): | ||
args.stop and not (i['port'] == args.view_port and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is not relevant.
Doxyfile.in
Outdated
@@ -34,7 +34,7 @@ PROJECT_NAME = "CodeChecker" | |||
# This could be handy for archiving the generated documentation or | |||
# if some version control system is used. | |||
|
|||
PROJECT_NUMBER = 5.9.1 | |||
PROJECT_NUMBER = 6.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is not relevant.
cb00d86
to
fc57e7c
Compare
84b58f9
to
a46ae01
Compare
bf31491
to
613897c
Compare
d47cf59
to
6c167b7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rebase the topic branch, a lot of commits already in Ericsson/version6
are duplicated.
a130824
to
3501d3c
Compare
6be5d63
to
3f576c0
Compare
1ca8382
to
c78983a
Compare
@@ -50,6 +50,10 @@ function (locale, dom, style) { | |||
return key.toLowerCase(); | |||
}, | |||
|
|||
detectionStatusToString : function (detectionStatus) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears to be an unused method.
from libtest import env | ||
|
||
|
||
class TestSkeleton(unittest.TestCase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test class uses template name.
|
||
def _create_source_file(self, version): | ||
if version == 1: | ||
source = """ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we could put the later hardcoded bug hashes here at least as a comment to see which means which bug in the code.
def unzip(b64zip): | ||
""" | ||
This function unzips the base64 encoded zip file which should contain | ||
exactly one directory. This directory is extracted to the given workspace. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method no longer uses a "workspace", the docstring should reflect that.
@@ -20,6 +27,10 @@ | |||
from codeCheckerDBAccess import constants | |||
from codeCheckerDBAccess.ttypes import * | |||
|
|||
from libcodechecker import generic_package_context | |||
from libcodechecker import suppress_handler | |||
from libcodechecker.analyze import plist_parser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment at the .analyze
import
# TODO: Cross-subpackage import here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. But what's this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Back when the subcommands and the whole of libcodechecker
was split and reorganised, imports which violated subcommand boundaries (such as server
depending on a class defined in analyze
) were marked with the same(-esque) TODO.
It's a marker for us that there are architectural mishaps in CodeChecker. It's not a problem as long as CodeChecker is a single and whole being in itself, but the moment we want to create separate builds from CodeChecker, e.g. one that can only log and analyze, or one that is only a webserver, these imports make easy creation of such packages problematic, and these markers show us that "Yeah, there should one day be a refactoring here!". (There were discussion about this package separation around 7-9 months ago, but that discussion died due to the plethora of other features to be made.)
import tempfile | ||
import zlib | ||
|
||
import shared |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import order is: systemwide, external, API, internal, local.
So:
import zlib
- (empty line)
import sqlalchemy
- (empty line)
import shared
from codeCheckerDBAcess...
api/report_server.thrift
Outdated
bool setRunDuration(1: i64 run_id, | ||
2: i64 duration) | ||
throws (1: shared.RequestFailed requestError), | ||
|
||
bool stopServer() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is absolutely not used anywhere in the code. We should remove it too, if we are already throwing out a big hunk here.
c78983a
to
b8b108f
Compare
'hello', | ||
self._test_dir) | ||
|
||
def test_skel(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is template text
|
||
def test_skel(self): | ||
""" | ||
Test some feature. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a text from the test template
|
||
def setUp(self): | ||
""" | ||
WARNING!!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This text is from the test template
|
||
""" detection_status function test. | ||
|
||
WARNING!!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test remained here from the test template
|
||
"""Setup for the test package detection_status. | ||
|
||
WARNING!!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This text remained here from the test template
@@ -15,9 +15,10 @@ define([ | |||
'dijit/form/TextBox', | |||
'dijit/layout/BorderContainer', | |||
'dijit/layout/ContentPane', | |||
'dojox/grid/DataGrid'], | |||
'dojox/grid/DataGrid', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should keep an import order in the JS code too: dijit/form/...
, dijit/grid/...
, dijit/layout/...
.
Don't forget to align the variable names in the function decl below!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is dojox/grid
, not dijit/grid
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is my bad, then. 😇
b8b108f
to
43f3b8d
Compare
|
||
events = filter(lambda i: i.get('kind') == 'event', report.bug_path) | ||
|
||
# TODO: skip handling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now the idea is that skip handling will be done after the analysis so the storage does not have to skip the results.
@@ -823,6 +1007,9 @@ def __queryDiffResults(self, | |||
.outerjoin(File, Report.file_id == File.id) \ | |||
.outerjoin(ReviewStatus, | |||
ReviewStatus.bug_hash == Report.bug_id) \ | |||
.outerjoin(SuppressBug, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't we remove the SuppressBug
table?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We did, in #768.
|
||
# Get the CodeChecker cmd if needed for the tests. | ||
self._codechecker_cmd = env.codechecker_cmd() | ||
self._test_dir = os.path.join(os.path.dirname(__file__), 'test_files') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend to use the workspace created for the tests to generate test files. Not to the test file directory.
@@ -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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from the inline comments, considering that we are only packaging in store, the --jobs
argument is irrelevant. It should be removed.
It's argument forwarding in the wrapper check
should also be removed.
libcodechecker/libhandlers/store.py
Outdated
|
||
shutil.copyfile(f, target_file) | ||
|
||
zipf = zipfile.ZipFile(zip_file, 'w') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zipfile.ZipFile
can be used as a context manager:
with zipfile.ZipFile(zip_file, 'w') as zipf:
for root, _, files in os.walk(temp_dir):
# ...
libcodechecker/libhandlers/store.py
Outdated
|
||
shutil.copyfile(f, target_file) | ||
|
||
zipf = zipfile.ZipFile(zip_file, 'w') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ZIP file in its current state does not deflate the files, only store them. If this is intended, it's allright, you create a compression later on, actually creating a .zip.gz
.
If we'd rather individually compress the files, we should add a 3rd argument to this constructor: zipfile.DEFLATED
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The .zip file is compressed later in one piece when it's already containing everything. I'm not writing the compressed file to the disk to a .zip.gz
, but I'm sending the data directly to the server.
LOG = LoggerFactory.get_new_logger('STORE HANDLER') | ||
|
||
|
||
def process_compile_db(compile_db): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a more descriptive name like make_absolute_path_compile_db
. Process is overly generic in my opinion.
if not os.path.exists(compile_db): | ||
LOG.warning("Compilation command file '" + compile_db + | ||
"' is missing.") | ||
LOG.warning("Update mode will not work, without compilation " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somewhere we should have a ticket to extend the plist with a working directory entry to overcome this issue in the long term.
metadata_dict = json.load(metadata) | ||
LOG.debug(metadata_dict) | ||
|
||
if 'command' in metadata_dict: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this code to be in the with block?
|
||
with open(metadata_file, 'r') as metadata: | ||
metadata_dict = json.load(metadata) | ||
LOG.debug(metadata_dict) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to dump the content of this file?
start2_line, | ||
start2_col, | ||
file_ids[source_file_path])) | ||
except IndexError: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this worth a comment what kind of lookups do we expect to fail and why.
try: | ||
LOG.debug("adding checker run") | ||
|
||
run = session.query(Run).filter(Run.name == name).first() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we use one_or_none
to enforce that there are no multiple runs with the same name?
1de081b
to
ef70176
Compare
Store detection status for the reports in the database.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Please clean up the naming in the API and add a few more test cases.
9: ReviewData review // bug review status informations. | ||
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 |
There was a problem hiding this comment.
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...
api/report_server.thrift
Outdated
// The "version" parameter is the used CodeChecker version which checked this | ||
// run. | ||
// The "force" parameter removes existing analysis results for a run. | ||
i64 storeZip( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry a naming comment again: Please rename this function: storeRun(...)
or maybe massStoreRun()
to better express the functionality.
Because that's what this function is really functionally doing.
Requiring zip format is an accidental design choice, it could have been rar as well, but still the function stores a run...
api/report_server.thrift
Outdated
1: string run_name, | ||
2: string version, | ||
3: string zipfile, | ||
4: bool force) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe clean
is a better name as it expresses that previous results will be cleaned for this run.
|
||
int* p = 0; | ||
|
||
i = *p + 42; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add a version 4 of the file where you insert 2 blank lines after int main(){ to test if the bugs are not duplicated with line shift.
shared.ttypes.DetectionStatus.REOPENED) | ||
elif report.bugHash == 'ac147b31a745d91be093bd70bbc5567c': | ||
self.assertEqual(report.detectionStatus, | ||
shared.ttypes.DetectionStatus.RESOLVED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please also verify the source file content referred to by the bug.
for the resolved bug (i.e. i=1/0 we should see version 2) we should see the last version where the bug occurred, for new, unresolved, and reopened, we should always see the latest file content.
99d53ad
to
859844b
Compare
f8da1a5
to
73aad57
Compare
"analyze", | ||
"asd.json"], | ||
"failed": {}, | ||
"working_directory": "/home/etibbru/CodeCompass/projects/hello", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this work for other users?
"failed": {}, | ||
"working_directory": "/home/etibbru/CodeCompass/projects/hello", | ||
"timestamps": {"begin": 1502964665.566252, "end": 1502964665.777198}, | ||
"output_path": "/home/etibbru/.codechecker/reports"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A user-related path is added here too.
73aad57
to
77601a7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's roll this at this point. Some issues remain, they will be fixed later on.
#709 should be merged first!