-
Notifications
You must be signed in to change notification settings - Fork 388
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
Skip reports at store #1566
Skip reports at store #1566
Conversation
libcodechecker/analyze/analyzer.py
Outdated
@@ -92,7 +92,11 @@ def __get_skip_handler(args): | |||
try: | |||
if args.skipfile: | |||
LOG.debug_analyzer("Creating skiplist handler.") | |||
return skiplist_handler.SkipListHandler(args.skipfile) | |||
skip_handler = None |
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.
It can be written shorter:
with open(args.skipfile) as skip_file:
return skiplist_handler.SkipListHandler(skip_file.read())
Please also add a documentation for this function.
if line.strip() != ''] | ||
self.__skip_file_lines = [line.strip() for line | ||
in skip_file.splitlines() | ||
if line.strip() != ''] |
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.
To check if a string is empty the following syntax is better: if line.strip()
for line in skip_file | ||
if line.strip() != ''] | ||
self.__skip_file_lines = [line.strip() for line | ||
in skip_file.splitlines() |
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.
Rename this variable to skip_file_content
and modify the description of the __init__
function too.
store_handler.metadata_info(metadata_file) | ||
|
||
skiphandler = skiplist_handler.SkipListHandler("") |
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.
It is not an elegant way to pass an empty string. Instead of this we can handle the case when no parameter is given for this function.
libcodechecker/libhandlers/parse.py
Outdated
skip_handler = SkipListHandler(args.skipfile) | ||
with open(skip_file, 'r') as skip_file: | ||
skip_content = skip_file.read() | ||
skip_handler = SkipListHandler(skip_file.read()) |
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.
File read twice unnecessarily.
The skip file content was not used at store. If the same report directory is used without a skip file and with a skip file the reports which should be skipped are stored even if a skip file was used for the second analysis. This change stores the skip file content in the metadata.json so the store in the server can use this information to skip the required reports. Changes in the tests were required to create this use case. This solution still sends all the reports and files to the server and it does report skipping there. It can be improved later where we do more fine grained file detection. Right now the problematic files are mainly the header files which can belong to multiple reports (paths) and if the header file is skipped at the client side of the store the server will not be able to show the missing file when viewing the report.
The skip file content was not used at store.
If the same report directory is used without a skip file
and with a skip file the reports which should be skipped are
stored even if a skip file was used for the second analysis.
This change stores the skip file content in the metadata.json so
the store in the server can use this information to skip the
required reports.
Changes in the tests were required to create this use case.
This solution still sends all the reports and files to the
server and it does report skipping there.
It can be improved later where we do more fine grained file detection.
Right now the problematic files are mainly the header files
which can belong to multiple reports (paths) and if the
header file is skipped at the client side of the store
the server will not be able to show the missing file when viewing the report.
#948