Repository navigation
[server] Add blame information to the execution path - #5207
gulyasgergely902 wants to merge 2 commits into
Conversation
b06c615 to
afdadac
Compare
| @thrift_client_call | ||
| def getRunResults(self, runIds, limit, offset, sortType, reportFilter, | ||
| cmpData, getDetails): | ||
| cmpData, getDetails, extendedBlameInfo=None): |
There was a problem hiding this comment.
I think we shouldn't add default parameters for this function.
Similarly the optional getDetails parameter also has no default value.
| compare_data, | ||
| query_report_details): | ||
| query_report_details, | ||
| extended_blame_info=False): |
There was a problem hiding this comment.
I would also remove the default parameter as False from here.
| query_report_details = 'details' in args and args.details and \ | ||
| args.output_format == 'json' | ||
|
|
||
| extended_blame_info = 'extended_blame_info' in args and \ |
There was a problem hiding this comment.
If you drop default=argparse.SUPPRESS from the argparse section, it is no longer needed to check 'extended_blame_info' in args
| def getRunResults(self, run_ids, limit, offset, sort_types, | ||
| report_filter, cmp_data, get_details): | ||
| report_filter, cmp_data, get_details, | ||
| extended_blame_info=False): |
There was a problem hiding this comment.
Similarly, I would drop the default parameter.
| report.runName = run_id2name[report.runId] | ||
|
|
||
| # The object blameInfo is coming from the server regardless of | ||
| # the state of the argument --extended-blame-info. This is a |
There was a problem hiding this comment.
The object blameInfo is coming from the server regardless of the state of the argument --extended-blame-info
Is this comment accurate? On the server side, I see if extended_blame_info: checks.
Can you explain why is the code below needed?
There was a problem hiding this comment.
The struct is set by the thrift generated python class and inside the blameInfo field is set to None. If the server does not send the blameInfo, it stays null and it is displayed in the returned JSON object. I've used this workaround to omit it if the user wants no extended blame info. I can leave the None there as it is for fixedAt right now for example, just thought it is cleaner not having it at all.
| extended_blame_info = 'extended_blame_info' in args and \ | ||
| args.extended_blame_info | ||
|
|
||
| if extended_blame_info and not query_report_details: |
There was a problem hiding this comment.
query_report_details is only true if the output format was set to JSON.
Do we not plan to add extended blame info to the regular output?
Regardless, there error message "The --extended-blame-info option can be used only together with --details." is therefore misleading
There was a problem hiding this comment.
I was debating on this but for now I think only JSON should have the feature but later on we can implement it into other formats as well.
I've modified the error message to include ".. and the output format set to JSON.
| # Get report details if it is required. | ||
| report_details = {} | ||
| blame_infos = {} | ||
| blame_cache = {} |
There was a problem hiding this comment.
Why was another blame_cache added here? There is already one defined on line 2316.
There was a problem hiding this comment.
Good call, I've moved it along with blame_infos and report_details out of the if/else so it is not duplicated.
| for r in query_result: | ||
| report_ids.append(r[0].id) | ||
| blame_infos[r[0].id] = self.getBlameInfo(r[0].file_id) | ||
| blame_infos[r[0].id] = self.__get_cached_blame_info( |
There was a problem hiding this comment.
This piece of code seems duplicated and was added to two different places.
I see that the surrounding code is also duplicated, but I think this code duplication should be fixed and not increased further.
I know it is generally out-of-scope of this PR, but I suggest adding a shared function that removes this entire duplicated part.
afdadac to
32f5f62
Compare
Previously blame information was only available at the end of the execution path. This change adds the blame info for every execution points.
32f5f62 to
605d7c4
Compare
c6b5bb3 to
2093295
Compare
fixes CODECHKR-7084
Previously blame information was only available at the end of the execution path.
This change adds an optional BlameInfo to both BugPathEvent and BugPathPos in the Thrift file which is populated
by the report server if the user asks for extended blame info via the
--extended-blame-infotoggle.