Ejemplo n.º 1
0
    def _create_diag(message, fmap, files):
        """
        Creates a new plist diagnostic from a single clang-tidy message.
        """

        diag = {
            'location': PListConverter._create_location(message, fmap),
            'check_name': message.checker,
            'description': message.message,
            'category': PListConverter._get_checker_category(message.checker),
            'type': 'clang-tidy',
            'path': []
        }

        PListConverter._add_fixits(diag, message, fmap)
        PListConverter._add_notes(diag, message, fmap)

        # The original message should be the last part of the path. This is
        # displayed by quick check, and this is the main event displayed by
        # the web interface. FIXME: notes and fixits should not be events.
        diag['path'].append(
            PListConverter._create_event_from_note(message, fmap))

        diag['issue_hash_content_of_line_in_context'] \
            = generate_report_hash(diag['path'],
                                   files[diag['location']['file']],
                                   message.checker)

        return diag
Ejemplo n.º 2
0
    def _create_diag(message, fmap, files):
        """
        Creates a new plist diagnostic from a single clang-tidy message.
        """

        diag = {'location': PListConverter._create_location(message, fmap),
                'check_name': message.checker,
                'description': message.message,
                'category': PListConverter._get_checker_category(
                    message.checker),
                'type': 'clang-tidy',
                'path': []}

        PListConverter._add_fixits(diag, message, fmap)
        PListConverter._add_notes(diag, message, fmap)

        # The original message should be the last part of the path. This is
        # displayed by quick check, and this is the main event displayed by
        # the web interface. FIXME: notes and fixits should not be events.
        diag['path'].append(PListConverter._create_event_from_note(message,
                                                                   fmap))

        diag['issue_hash_content_of_line_in_context'] \
            = generate_report_hash(diag['path'],
                                   files[diag['location']['file']],
                                   message.checker)

        return diag
Ejemplo n.º 3
0
def get_report_hash(diagnostic, source_file):
    """
    Check if checker name is available in the report.
    Checker hash was not available in older clang versions before 3.8.
    """

    report_hash = diagnostic.get('issue_hash_content_of_line_in_context')
    if not report_hash:
        # Generate hash value if it is missing from the report.
        report_hash \
            = generate_report_hash(diagnostic['path'],
                                   source_file,
                                   get_checker_name(diagnostic))
    return report_hash
Ejemplo n.º 4
0
def get_report_hash(diagnostic, source_file):
    """
    Check if checker name is available in the report.
    Checker hash was not available in older clang versions before 3.8.
    """

    report_hash = diagnostic.get('issue_hash_content_of_line_in_context')
    if not report_hash:
        # Generate hash value if it is missing from the report.
        report_hash \
            = generate_report_hash(diagnostic['path'],
                                   source_file,
                                   get_checker_name(diagnostic))
    return report_hash