How to deserialize the issue.pb in scanner-report?

AFAIK, The last step of sonar-scanner is uploading the overall report to the central server, beacuse of the speed’s need, we want to remove the step. Up to now, we export the result from the server, i.e. uploadToSonarServer -> exportFromSonarServer. Now we just want to uploadToOurServer directly. I try to parse the issues-.pb by myself from sonar-report report directory, but it doesn’t work. I think I found the wrong .proto file : ws-issues.proto, could you help me out of this. How could I parse the issue detail from the issue-.pb by myself?

I think I found the key position, the scanner-report’s corresponding pb file is here: sonar_report_issue
But when I use this proto to generate the library code and using the generated library code to parse the issues-*.pb report file, it yields some errors:

    Traceback (most recent call last):
  File ".\read_ws_issue.py", line 20, in <module>
    issue.ParseFromString(f.read())
  File "D:\Python27\lib\site-packages\google\protobuf\message.py", line 199, in ParseFromString
    return self.MergeFromString(serialized)
  File "D:\Python27\lib\site-packages\google\protobuf\internal\python_message.py", line 1145, in MergeFromString
    if self._InternalParse(serialized, 0, length) != length:
  File "D:\Python27\lib\site-packages\google\protobuf\internal\python_message.py", line 1195, in InternalParse
    raise message_mod.DecodeError('Field number 0 is illegal.')
google.protobuf.message.DecodeError: Field number 0 is illegal.

hmmmm, Could you help me work it out now~?

Aha… I found the solution by calling ScannerReportReader. Thanks:-#

1 Like

@Dreaminplus I’m running into very same issue. can you please share the code you used to parse SQ report?
Thanks in advance