diff --git a/tools/report-converter/codechecker_report_converter/analyzers/clang_tidy_yaml/__init__.py b/tools/report-converter/codechecker_report_converter/analyzers/clang_tidy_yaml/__init__.py new file mode 100644 index 0000000000..4259749345 --- /dev/null +++ b/tools/report-converter/codechecker_report_converter/analyzers/clang_tidy_yaml/__init__.py @@ -0,0 +1,7 @@ +# ------------------------------------------------------------------------- +# +# Part of the CodeChecker project, under the Apache License v2.0 with +# LLVM Exceptions. See LICENSE for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +# ------------------------------------------------------------------------- diff --git a/tools/report-converter/codechecker_report_converter/analyzers/clang_tidy_yaml/analyzer_result.py b/tools/report-converter/codechecker_report_converter/analyzers/clang_tidy_yaml/analyzer_result.py new file mode 100644 index 0000000000..5df954eacd --- /dev/null +++ b/tools/report-converter/codechecker_report_converter/analyzers/clang_tidy_yaml/analyzer_result.py @@ -0,0 +1,26 @@ +# ------------------------------------------------------------------------- +# +# Part of the CodeChecker project, under the Apache License v2.0 with +# LLVM Exceptions. See LICENSE for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +# ------------------------------------------------------------------------- + +from typing import List + +from codechecker_report_converter.report import Report + +from ..analyzer_result import AnalyzerResultBase +from .parser import Parser + + +class AnalyzerResult(AnalyzerResultBase): + """ Transform analyzer result of Clang Tidy. """ + + TOOL_NAME = 'clang-tidy-yaml' + NAME = 'Clang Tidy' + URL = 'https://clang.llvm.org/extra/clang-tidy' + + def get_reports(self, file_path: str) -> List[Report]: + """ Get reports from the given analyzer result. """ + return Parser().get_reports(file_path) diff --git a/tools/report-converter/codechecker_report_converter/analyzers/clang_tidy_yaml/parser.py b/tools/report-converter/codechecker_report_converter/analyzers/clang_tidy_yaml/parser.py new file mode 100644 index 0000000000..5fe3af0e2d --- /dev/null +++ b/tools/report-converter/codechecker_report_converter/analyzers/clang_tidy_yaml/parser.py @@ -0,0 +1,125 @@ +# ------------------------------------------------------------------------- +# +# Part of the CodeChecker project, under the Apache License v2.0 with +# LLVM Exceptions. See LICENSE for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +# ------------------------------------------------------------------------- + +import os +import yaml +import logging +from typing import Iterator, List, Tuple + +from codechecker_report_converter.report import BugPathEvent, \ + get_or_create_file, Report + +from ..parser import BaseParser + +LOG = logging.getLogger('report-converter') + + +def get_location_by_offset(filename, offset): + """ + This function returns the line and column number in the given file which + is located at the given offset (i.e. number of characters including new + line characters). None returns when the offset is greater than the file + length. + """ + with open(filename, encoding='utf-8', errors='ignore', newline='') as f: + for row, line in enumerate(f, 1): + length = len(line) + if length < offset: + offset -= length + else: + return row, offset + 1 + + return None + + +class Parser(BaseParser): + """Parser for clang-tidy YAML output.""" + + def get_reports(self, file_path: str) -> List[Report]: + """Parse Clang-Tidy's YAML output file.""" + with open(file_path, 'r', encoding='utf-8') as file: + data = yaml.safe_load(file) + + reports = [] + if data: + for diagnostic in data['Diagnostics']: + report = self._parse_diagnostic(diagnostic) + reports.append(report) + return reports + + def _parse_diagnostic(self, diagnostic: dict) -> Report: + """Parse a Clang-Tidy diagnostic.""" + checker_name = diagnostic['DiagnosticName'] + diagnostic_message = diagnostic['DiagnosticMessage'] + 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']) + + report = Report( + file=file_obj, + line=line, + column=col, + message=diagnostic_message['Message'].strip(), + checker_name=checker_name, + category=self._get_category(checker_name), + bug_path_events=[] + ) + + # Parse replacements (fixits) (if any) + for replacement in diagnostic_message.get('Replacements', []): + replacement_path = os.path.abspath(replacement['FilePath']) + replacement_file_obj = get_or_create_file(replacement_path, + self._file_cache) + fixit_line, fixit_col = get_location_by_offset( + replacement_path, replacement['Offset']) + report.notes.append( + BugPathEvent( + f"{replacement['ReplacementText']} (fixit)", + replacement_file_obj, + fixit_line, + fixit_col + ) + ) + + # Parse notes (if any) + for note in diagnostic.get('Notes', []): + if note['FilePath'] != '': + note_path = os.path.abspath(note['FilePath']) + note_line, note_col = get_location_by_offset( + note_path, note['FileOffset']) + note_file_obj = get_or_create_file(note_path, self._file_cache) + report.bug_path_events.append( + BugPathEvent( + note['Message'].strip(), + note_file_obj, + note_line, + note_col + ) + ) + + report.bug_path_events.append(BugPathEvent( + report.message, + report.file, + report.line, + report.column)) + + return report + + def _get_category(self, checker_name: str) -> str: + """ Get category for Clang-Tidy checker. """ + parts = checker_name.split('-') + return parts[0] if parts else 'unknown' + + def _parse_line(self, it: Iterator[str], line: str) -> Tuple[ + List[Report], str]: + # FIXME: This method is a placeholder to allow instantiation of the + # Parser class. + # The _parse_line method is required because Parser is an abstract + # class that expects this method to be implemented in subclasses. + return [], "" diff --git a/tools/report-converter/requirements_py/dev/requirements.txt b/tools/report-converter/requirements_py/dev/requirements.txt index 187a14503d..dc39b57aa1 100644 --- a/tools/report-converter/requirements_py/dev/requirements.txt +++ b/tools/report-converter/requirements_py/dev/requirements.txt @@ -4,3 +4,6 @@ pycodestyle==2.12.0 pylint==3.2.4 portalocker==2.2.1 mypy==1.7.1 +setuptools==70.2.0 +PyYAML==6.0.1 +types-PyYAML==6.0.12 diff --git a/tools/report-converter/tests/unit/analyzers/test_clang_tidy_yaml_parser.py b/tools/report-converter/tests/unit/analyzers/test_clang_tidy_yaml_parser.py new file mode 100644 index 0000000000..555863f59b --- /dev/null +++ b/tools/report-converter/tests/unit/analyzers/test_clang_tidy_yaml_parser.py @@ -0,0 +1,115 @@ +# ------------------------------------------------------------------------- +# +# Part of the CodeChecker project, under the Apache License v2.0 with +# LLVM Exceptions. See LICENSE for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +# ------------------------------------------------------------------------- + +""" +This module tests the correctness of the OutputParser and PListConverter, which +used in sequence transform a Clang Tidy output file to a plist file. +""" + + +import os +import plistlib +import shutil +import tempfile +import unittest + +from codechecker_report_converter.analyzers.clang_tidy_yaml import ( + analyzer_result) +from codechecker_report_converter.report.parser import plist + + +OLD_PWD = None + + +def setup_module(): + """Setup the test tidy reprs for the test classes in the module.""" + global OLD_PWD + OLD_PWD = os.getcwd() + os.chdir(os.path.join(os.path.dirname(__file__), + 'tidy_yaml_output_test_files')) + + +def teardown_module(): + """Restore environment after tests have ran.""" + global OLD_PWD + os.chdir(OLD_PWD) + + +class ClangTidyYamlAnalyzerResultTestCase(unittest.TestCase): + """ Test the output of the ClangTidyYamlAnalyzerResult. """ + + def setUp(self): + """ Setup the test. """ + self.analyzer_result = analyzer_result.AnalyzerResult() + self.cc_result_dir = tempfile.mkdtemp() + + def tearDown(self): + """ Clean temporary directory. """ + shutil.rmtree(self.cc_result_dir) + + def __check_analyzer_result(self, analyzer_result, analyzer_result_plist, + source_files, expected_plist): + """ Check the result of the analyzer transformation. """ + self.analyzer_result.transform( + [analyzer_result], self.cc_result_dir, plist.EXTENSION, + file_name="{source_file}_{analyzer}") + + plist_file = os.path.join(self.cc_result_dir, analyzer_result_plist) + with open(plist_file, mode='rb') as pfile: + res = plistlib.load(pfile) + + # Use relative path for this test. + res['files'] = source_files + print("res") + print(res) + + with open(expected_plist, mode='rb') as pfile: + exp = plistlib.load(pfile) + + self.assertTrue(res['metadata']['generated_by']['version']) + res['metadata']['generated_by']['version'] = "x.y.z" + print("exp") + print(exp) + + self.assertEqual(res, exp) + + def test_empty1(self): + """ Test for empty Messages. """ + ret = self.analyzer_result.transform( + ['empty1.out'], self.cc_result_dir, plist.EXTENSION) + self.assertFalse(ret) + + def test_empty2(self): + """ Test for empty Messages with multiple line. """ + ret = self.analyzer_result.transform( + ['empty2.out'], self.cc_result_dir, plist.EXTENSION) + self.assertFalse(ret) + + def test_tidy1(self): + """ Test for the tidy1.plist file. """ + self.__check_analyzer_result('tidy1.out', + 'test.cpp_clang-tidy-yaml.plist', + ['files/test.cpp'], 'tidy1.plist') + + def test_tidy2(self): + """ Test for the tidy2.plist file. """ + self.__check_analyzer_result('tidy2.out', + 'test2.cpp_clang-tidy-yaml.plist', + ['files/test2.cpp'], 'tidy2.plist') + + def test_tidy3(self): + """ Test for the tidy3.plist file. """ + self.__check_analyzer_result('tidy3.out', + 'test3.cpp_clang-tidy-yaml.plist', + ['files/test3.cpp'], + 'tidy3_cpp.plist') + + self.__check_analyzer_result('tidy3.out', + 'test3.hh_clang-tidy-yaml.plist', + ['files/test3.cpp', 'files/test3.hh'], + 'tidy3_hh.plist') diff --git a/tools/report-converter/tests/unit/analyzers/tidy_output_test_files/tidy3_cpp.plist b/tools/report-converter/tests/unit/analyzers/tidy_output_test_files/tidy3_cpp.plist index 8d1478c7ca..41f463c357 100644 --- a/tools/report-converter/tests/unit/analyzers/tidy_output_test_files/tidy3_cpp.plist +++ b/tools/report-converter/tests/unit/analyzers/tidy_output_test_files/tidy3_cpp.plist @@ -25,14 +25,14 @@ notes - location - - col - 12 - file - 0 - line - 4 + location + + col + 12 + file + 0 + line + 4 message nullptr (fixit) @@ -82,4 +82,4 @@ - \ No newline at end of file + diff --git a/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/empty.plist b/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/empty.plist new file mode 100644 index 0000000000..07829d9191 --- /dev/null +++ b/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/empty.plist @@ -0,0 +1,12 @@ + + + + + diagnostics + + + files + + + + diff --git a/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/empty1.out b/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/empty1.out new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/empty2.out b/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/empty2.out new file mode 100644 index 0000000000..384ee9a889 --- /dev/null +++ b/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/empty2.out @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/files/Makefile b/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/files/Makefile new file mode 100644 index 0000000000..d764acea8c --- /dev/null +++ b/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/files/Makefile @@ -0,0 +1,9 @@ + +tidy1: + clang-tidy -checks='-*,clang-diagnostic-*,clang-analyzer-*' test.cpp + +tidy2: + clang-tidy -checks='-*,clang-diagnostic-*,clang-analyzer-*' test2.cpp + +tidy3: + clang-tidy -checks='-*,clang-diagnostic-*,clang-analyzer-*,modernize-use-nullptr' test3.cpp -- -I. diff --git a/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/files/test.cpp b/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/files/test.cpp new file mode 100644 index 0000000000..029b87fed0 --- /dev/null +++ b/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/files/test.cpp @@ -0,0 +1,9 @@ +#include + +int main() { + int x; + + std::cin >> x; + + return x % 0; +} diff --git a/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/files/test2.cpp b/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/files/test2.cpp new file mode 100644 index 0000000000..e1133349eb --- /dev/null +++ b/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/files/test2.cpp @@ -0,0 +1,14 @@ +#include + +int main() { + int x; + int y; + + std::cin >> x; + + if (false || x) { + return 42; + } + + return x % 0; +} diff --git a/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/files/test3.cpp b/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/files/test3.cpp new file mode 100644 index 0000000000..580218cac1 --- /dev/null +++ b/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/files/test3.cpp @@ -0,0 +1,30 @@ +#include "test3.hh" +#include +#include + +int main(int argc, const char** /*argv*/) { + int* x = nullptr; // Using nullptr instead of 0 for better clarity + + // Unused variable and uninitialized variable + int y; + int z = y + 10; // `y` is uninitialized + + // Unnecessary copy of a vector + std::vector numbers = {1, 2, 3, 4, 5}; + std::vector numbers_copy = numbers; // This copy can be avoided + + if (foo(argc > 3)) { + bar(x); + } + + // Missing check before dereferencing pointer + int* p = nullptr; + *p = 10; // Dereferencing a null pointer + + // Redundant check and potential null dereference + if (x != nullptr) { + std::cout << *x << std::endl; // x is null but it's checked only after dereferencing in `bar` + } + + return 0; +} diff --git a/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/files/test3.hh b/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/files/test3.hh new file mode 100644 index 0000000000..f83b07103b --- /dev/null +++ b/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/files/test3.hh @@ -0,0 +1,26 @@ +inline bool foo(bool arg) { + // Unnecessary use of the conditional operator, this can be simplified + return arg ? true : false; +} + +inline void bar(int* x) { + if (x == nullptr) { + // Improperly using x without proper null check, potential crash + *x = 0; + } else { + *x = 42; + } +} + +// Function with a non-const reference parameter that can lead to unintended side effects +inline void increment(int& value) { + value++; // Potential unintended modification of the input argument +} + +// Unused function declaration, which may raise a warning +inline void unused_function(int value) { + value = value * 2; // No-op, function does nothing meaningful +} + +// Example of a global variable, which is generally discouraged +inline int global_variable = 100; // Global variable can cause issues in large projects diff --git a/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/tidy1.out b/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/tidy1.out new file mode 100644 index 0000000000..6b239b9e51 --- /dev/null +++ b/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/tidy1.out @@ -0,0 +1,16 @@ +--- +MainSourceFile: 'files/test.cpp' +Diagnostics: + - DiagnosticName: clang-diagnostic-division-by-zero + DiagnosticMessage: + Message: remainder by zero is undefined + FilePath: 'files/test.cpp' + FileOffset: 73 + Replacements: [] + Ranges: + - FilePath: 'files/test.cpp' + FileOffset: 75 + Length: 1 + Level: Warning + BuildDirectory: 'files' +... diff --git a/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/tidy1.plist b/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/tidy1.plist new file mode 100644 index 0000000000..18a28a14ef --- /dev/null +++ b/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/tidy1.plist @@ -0,0 +1,69 @@ + + + + + diagnostics + + + category + clang + check_name + clang-diagnostic-division-by-zero + description + remainder by zero is undefined + issue_hash_content_of_line_in_context + 5a0fa223fabaf319bc0ec3731e27d45a + location + + col + 12 + file + 0 + line + 8 + + path + + + depth + 0 + kind + event + location + + col + 12 + file + 0 + line + 8 + + message + remainder by zero is undefined + + + type + clang-tidy-yaml + + + files + + files/test.cpp + + metadata + + analyzer + + name + clang-tidy-yaml + + generated_by + + name + report-converter + version + x.y.z + + + + diff --git a/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/tidy2.out b/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/tidy2.out new file mode 100644 index 0000000000..3ce2fd8c8b --- /dev/null +++ b/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/tidy2.out @@ -0,0 +1,28 @@ +--- +MainSourceFile: 'files/test2.cpp' +Diagnostics: + - DiagnosticName: clang-diagnostic-unused-variable + DiagnosticMessage: + Message: 'unused variable ''y''' + FilePath: 'files/test2.cpp' + FileOffset: 49 + Replacements: [] + Ranges: + - FilePath: 'files/test2.cpp' + FileOffset: 49 + Length: 1 + Level: Warning + BuildDirectory: 'files' + - DiagnosticName: clang-diagnostic-division-by-zero + DiagnosticMessage: + Message: remainder by zero is undefined + FilePath: 'files/test2.cpp' + FileOffset: 122 + Replacements: [] + Ranges: + - FilePath: 'files/test2.cpp' + FileOffset: 124 + Length: 1 + Level: Warning + BuildDirectory: 'files' +... diff --git a/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/tidy2.plist b/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/tidy2.plist new file mode 100644 index 0000000000..e5d64de3e9 --- /dev/null +++ b/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/tidy2.plist @@ -0,0 +1,110 @@ + + + + + diagnostics + + + category + clang + check_name + clang-diagnostic-unused-variable + description + unused variable 'y' + issue_hash_content_of_line_in_context + 9f5469099db1a2765912c8254b32e90b + location + + col + 7 + file + 0 + line + 5 + + path + + + depth + 0 + kind + event + location + + col + 7 + file + 0 + line + 5 + + message + unused variable 'y' + + + type + clang-tidy-yaml + + + category + clang + check_name + clang-diagnostic-division-by-zero + description + remainder by zero is undefined + issue_hash_content_of_line_in_context + 0758808c01c22b4a346799d1156c13a5 + location + + col + 12 + file + 0 + line + 13 + + path + + + depth + 0 + kind + event + location + + col + 12 + file + 0 + line + 13 + + message + remainder by zero is undefined + + + type + clang-tidy-yaml + + + files + + files/test2.cpp + + metadata + + analyzer + + name + clang-tidy-yaml + + generated_by + + name + report-converter + version + x.y.z + + + + diff --git a/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/tidy3.out b/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/tidy3.out new file mode 100644 index 0000000000..20b46bc021 --- /dev/null +++ b/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/tidy3.out @@ -0,0 +1,81 @@ +--- +MainSourceFile: 'files/test3.cpp' +Diagnostics: + - DiagnosticName: clang-analyzer-deadcode.DeadStores + DiagnosticMessage: + Message: 'Value stored to ''z'' during its initialization is never read' + FilePath: 'files/test3.cpp' + FileOffset: 236 + Replacements: [] + Ranges: + - FilePath: 'files/test3.cpp' + FileOffset: 236 + Length: 1 + - FilePath: 'files/test3.cpp' + FileOffset: 240 + Length: 6 + Notes: + - Message: 'Value stored to ''z'' during its initialization is never read' + FilePath: 'files/test3.cpp' + FileOffset: 236 + Replacements: [] + Ranges: + - FilePath: 'files/test3.cpp' + FileOffset: 236 + Length: 1 + - FilePath: 'files/test3.cpp' + FileOffset: 240 + Length: 6 + Level: Warning + BuildDirectory: 'files' + - DiagnosticName: clang-analyzer-core.UndefinedBinaryOperatorResult + DiagnosticMessage: + Message: 'The left operand of ''+'' is a garbage value' + FilePath: 'files/test3.cpp' + FileOffset: 242 + Replacements: [] + Ranges: + - FilePath: 'files/test3.cpp' + FileOffset: 240 + Length: 1 + Notes: + - Message: '''y'' declared without an initial value' + FilePath: 'files/test3.cpp' + FileOffset: 223 + Replacements: [] + Ranges: + - FilePath: 'files/test3.cpp' + FileOffset: 223 + Length: 5 + - Message: 'The left operand of ''+'' is a garbage value' + FilePath: 'files/test3.cpp' + FileOffset: 242 + Replacements: [] + Ranges: + - FilePath: 'files/test3.cpp' + FileOffset: 240 + Length: 1 + Level: Warning + BuildDirectory: 'files' + - DiagnosticName: clang-analyzer-deadcode.DeadStores + DiagnosticMessage: + Message: 'Value stored to ''value'' is never read' + FilePath: 'files/test3.hh' + FileOffset: 593 + Replacements: [] + Ranges: + - FilePath: 'files/test3.hh' + FileOffset: 601 + Length: 9 + Notes: + - Message: 'Value stored to ''value'' is never read' + FilePath: 'files/test3.hh' + FileOffset: 593 + Replacements: [] + Ranges: + - FilePath: 'files/test3.hh' + FileOffset: 601 + Length: 9 + Level: Warning + BuildDirectory: 'files' +... diff --git a/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/tidy3_cpp.plist b/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/tidy3_cpp.plist new file mode 100644 index 0000000000..a6c6929ad0 --- /dev/null +++ b/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/tidy3_cpp.plist @@ -0,0 +1,208 @@ + + + + + diagnostics + + + category + clang + check_name + clang-analyzer-deadcode.DeadStores + description + Value stored to 'z' during its initialization is never read + issue_hash_content_of_line_in_context + 8c72757a10cc820f64f58b6bf3a0f84f + location + + col + 7 + file + 0 + line + 10 + + path + + + depth + 0 + kind + event + location + + col + 7 + file + 0 + line + 10 + + message + Value stored to 'z' during its initialization is never read + + + depth + 0 + kind + event + location + + col + 7 + file + 0 + line + 10 + + message + Value stored to 'z' during its initialization is never read + + + type + clang-tidy-yaml + + + category + clang + check_name + clang-analyzer-core.UndefinedBinaryOperatorResult + description + The left operand of '+' is a garbage value + issue_hash_content_of_line_in_context + 8a8408703fdb972336eb5eb90b6f02f0 + location + + col + 13 + file + 0 + line + 10 + + path + + + edges + + + end + + + col + 13 + file + 0 + line + 10 + + + col + 13 + file + 0 + line + 10 + + + start + + + col + 3 + file + 0 + line + 9 + + + col + 3 + file + 0 + line + 9 + + + + + kind + control + + + depth + 0 + kind + event + location + + col + 3 + file + 0 + line + 9 + + message + 'y' declared without an initial value + + + depth + 0 + kind + event + location + + col + 13 + file + 0 + line + 10 + + message + The left operand of '+' is a garbage value + + + depth + 0 + kind + event + location + + col + 13 + file + 0 + line + 10 + + message + The left operand of '+' is a garbage value + + + type + clang-tidy-yaml + + + files + + files/test3.cpp + + metadata + + analyzer + + name + clang-tidy-yaml + + generated_by + + name + report-converter + version + x.y.z + + + + diff --git a/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/tidy3_hh.plist b/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/tidy3_hh.plist new file mode 100644 index 0000000000..1141c0a41d --- /dev/null +++ b/tools/report-converter/tests/unit/analyzers/tidy_yaml_output_test_files/tidy3_hh.plist @@ -0,0 +1,87 @@ + + + + + diagnostics + + + category + clang + check_name + clang-analyzer-deadcode.DeadStores + description + Value stored to 'value' is never read + issue_hash_content_of_line_in_context + 277ce25eef3e5dbb4c7353638a42a366 + location + + col + 3 + file + 0 + line + 22 + + path + + + depth + 0 + kind + event + location + + col + 3 + file + 0 + line + 22 + + message + Value stored to 'value' is never read + + + depth + 0 + kind + event + location + + col + 3 + file + 0 + line + 22 + + message + Value stored to 'value' is never read + + + type + clang-tidy-yaml + + + files + + files/test3.cpp + files/test3.hh + + metadata + + analyzer + + name + clang-tidy-yaml + + generated_by + + name + report-converter + version + x.y.z + + + +