-
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
Add clang-tidy yaml report converter #4335
base: master
Are you sure you want to change the base?
Conversation
bfc6fc9
to
4ce83eb
Compare
b32ed15
to
e5e990a
Compare
8ed6250
to
c4e8a95
Compare
Currently clang-tidy reports are parsed and converted to plist files from the clang-tidy standard outputs. This change adds a new report converter that uses clang-tidy's yaml outputs as inputs for parsing and creating plist files.
2c5a4ff
to
9c6e430
Compare
|
||
reports = [] | ||
if data: | ||
for diagnostic in data['Diagnostics']: |
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.
for diagnostic in data['Diagnostics']: | |
for diagnostic in data.get("Diagnostics", []): |
checker_name = diagnostic['DiagnosticName'] | ||
diagnostic_message = diagnostic['DiagnosticMessage'] | ||
file_path = os.path.abspath(diagnostic_message['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.
I think it is safer to use get()
method of diagnostic dictionary.
file_path = os.path.abspath(diagnostic_message['FilePath']) | ||
file_obj = get_or_create_file(file_path, self._file_cache) | ||
line, col = get_location_by_offset( | ||
file_path, diagnostic_message['FileOffset']) |
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.
diagnostic_message.get("FileOffset") would be better.
file=file_obj, | ||
line=line, | ||
column=col, | ||
message=diagnostic_message['Message'].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.
Also here
print("res") | ||
print(res) |
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.
Are these prints necessary?
Currently clang-tidy reports are parsed and
converted to plist files from the clang-tidy
standard outputs. This change adds a new
report converter that uses clang-tidy's yaml
outputs as inputs for parsing and
creating plist files.