Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

noraz31
Copy link
Collaborator

@noraz31 noraz31 commented Sep 2, 2024

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.

@noraz31 noraz31 force-pushed the clang_tidy_yaml branch 6 times, most recently from bfc6fc9 to 4ce83eb Compare September 3, 2024 13:01
@bruntib bruntib marked this pull request as draft September 17, 2024 17:20
@noraz31 noraz31 force-pushed the clang_tidy_yaml branch 2 times, most recently from 8ed6250 to c4e8a95 Compare September 19, 2024 13:51
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.
@noraz31 noraz31 marked this pull request as ready for review September 24, 2024 12:15
@dkrupp dkrupp added this to the release 6.25.0 milestone Nov 5, 2024
@dkrupp dkrupp requested a review from cservakt November 5, 2024 14:22

reports = []
if data:
for diagnostic in data['Diagnostics']:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for diagnostic in data['Diagnostics']:
for diagnostic in data.get("Diagnostics", []):

Comment on lines +57 to +59
checker_name = diagnostic['DiagnosticName']
diagnostic_message = diagnostic['DiagnosticMessage']
file_path = os.path.abspath(diagnostic_message['FilePath'])
Copy link
Collaborator

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'])
Copy link
Collaborator

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(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here

Comment on lines +68 to +69
print("res")
print(res)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these prints necessary?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants