def test_as_markdown(mock_revision): """ Test markdown generation for ClangTidyIssue """ from code_review_bot import Reliability from code_review_bot.tasks.clang_tidy import ClangTidyIssue issue = ClangTidyIssue( mock_revision, "test.cpp", "42", "51", "dummy-check", "dummy message", "error", Reliability.High, ) issue.body = "Dummy body" assert (issue.as_markdown() == """ ## clang-tidy error - **Message**: dummy message - **Location**: test.cpp:42:51 - **In patch**: no - **Clang check**: dummy-check - **Publishable check**: no - **Third Party**: no - **Expanded Macro**: no - **Publishable **: no - **Is new**: no - **Checker reliability **: high (false positive risk) ``` Dummy body ``` """) assert issue.as_phabricator_lint() == { "char": 51, "code": "clang-tidy.dummy-check", "line": 42, "name": "Clang-Tidy - dummy-check", "description": "dummy message\nChecker reliability is high, meaning that the false positive ratio is low.\n\n > Dummy body", "path": "test.cpp", "severity": "warning", }
def test_as_markdown(mock_revision, mock_task): """ Test markdown generation for ClangTidyIssue """ from code_review_bot import Level from code_review_bot import Reliability issue = ClangTidyIssue( mock_task(ClangTidyTask, "clang-tidy"), mock_revision, "test.cpp", "42", "51", "dummy-check", "dummy message", Level.Warning, Reliability.High, ) assert ( issue.as_markdown() == """ ## clang-tidy warning - **Message**: dummy message - **Location**: test.cpp:42:51 - **In patch**: no - **Clang check**: dummy-check - **Publishable check**: yes - **Expanded Macro**: no - **Publishable **: no - **Checker reliability **: high (false positive risk) """ ) assert issue.as_phabricator_lint() == { "char": 51, "code": "dummy-check", "line": 42, "name": "clang-tidy", "description": "WARNING: dummy message", "path": "test.cpp", "severity": "warning", }