예제 #1
0
def cppcheck(dsc, analysis):
    run_command(["dpkg-source", "-x", dsc, "source"])
    with cd('source'):
        out, err, ret = run_command(['cppcheck', '--enable=all', '.', '--xml'])

        xmlbytes = err.encode()

        failed = False
        if err.strip() == '':
            return (analysis, err, failed)

        for issue in parse_cppcheck(xmlbytes):
            analysis.results.append(issue)
            if not failed and issue.severity in [
                    'performance', 'portability', 'error', 'warning'
            ]:
                failed = True

        return (analysis, err, failed)
예제 #2
0
파일: cppcheck.py 프로젝트: paultag/ethel
def cppcheck(dsc, analysis):
    run_command(["dpkg-source", "-x", dsc, "source"])
    with cd('source'):
        out, err, ret = run_command([
            'cppcheck', '--enable=all', '.', '--xml'
        ])

        xmlbytes = err.encode()

        failed = False
        if err.strip() == '':
            return (analysis, err, failed)

        for issue in parse_cppcheck(xmlbytes):
            analysis.results.append(issue)
            if not failed and issue.severity in [
                'performance', 'portability', 'error', 'warning'
            ]:
                failed = True

        return (analysis, err, failed)
예제 #3
0
def test_xml_parse():
    for issue in parse_cppcheck(DATA):
        assert issue.testid == 'unusedFunction'