def test_as_text(mock_revision):
    '''
    Test text export for ClangTidyIssue
    '''
    from static_analysis_bot.clang.tidy import ClangTidyIssue
    issue = ClangTidyIssue(mock_revision, 'test.cpp', '42', '51', 'dummy-check', 'dummy message withUppercaseChars', 'error')
    issue.body = 'Dummy body withUppercaseChars'

    assert issue.as_text() == 'Error: Dummy message withUppercaseChars [clang-tidy: dummy-check]\n```\nDummy body withUppercaseChars\n```'
예제 #2
0
def test_as_markdown(mock_revision):
    '''
    Test markdown generation for ClangTidyIssue
    '''
    from static_analysis_bot.clang.tidy import ClangTidyIssue
    parts = ('test.cpp', '42', '51', 'error', 'dummy message', 'dummy-check')
    issue = ClangTidyIssue(parts, mock_revision)
    issue.body = 'Dummy body'

    assert issue.as_markdown() == '''
def test_as_markdown(mock_revision):
    '''
    Test markdown generation for ClangTidyIssue
    '''
    from static_analysis_bot.clang.tidy import ClangTidyIssue
    issue = ClangTidyIssue(mock_revision, 'test.cpp', '42', '51', 'dummy-check', 'dummy message', 'error')
    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

```
Dummy body
```


'''
    assert issue.as_phabricator_lint() == {
        'char': 51,
        'code': 'clang-tidy.dummy-check',
        'line': 42,
        'name': 'Clang-Tidy - dummy-check',
        'description': 'dummy message\n\n > Dummy body',
        'path': 'test.cpp',
        'severity': 'warning',
    }