def concatenate_comments(tidy_advice: list, format_advice: list) -> list:
    """Concatenate comments made to the same line of the same file."""
    # traverse comments from clang-format
    for index, comment_body in enumerate(format_advice):
        # check for comments from clang-tidy on the same line
        comment_index = None
        for i, payload in enumerate(tidy_advice):
            if (
                payload["line"] == comment_body["line"]
                and payload["path"] == comment_body["path"]
            ):
                comment_index = i  # mark this comment for concatenation
                break
        if comment_index is not None:
            # append clang-format advice to clang-tidy output/suggestion
            tidy_advice[comment_index]["body"] += "\n" + comment_body["body"]
            del format_advice[index]  # remove duplicate comment
    return tidy_advice + format_advice