Example #1
0
        print(out.banner(out.red('FIND BUGS TARGET FAILED')))

    if not styleChecked:
        print(out.banner(out.red('CHECK STYLE TARGET FAILED')))

    if not pmdRan:
        print(out.banner(out.red('PMD TARGET FAILED')))

    if not dupChecked:
        print(out.banner(out.red('CODE DUPLICATION TARGET FAILED')))

    if not any([bugFound, styleChecked, pmdRan, dupChecked]):
        sys.exit()

    problems = itertools.chain(findbugs.bugsFound() if bugFound else [],
                               checkstyle.checkstyleProblems() if styleChecked else [],
                               pmd.pmdViolations() if pmdRan else [],
                               cpd.duplications() if dupChecked else [])

    noProblems = True
    for srcFile, problemgroup in itertools.groupby(sorted(problems), lambda x: x[0]):
        out.printlns('', os.path.relpath(srcFile), '-' * 79)
        for _, line, message in problemgroup:
            line = str(line)
            print(out.red(line), '-', message)

        noProblems = False

    if noProblems:
        print(out.banner(out.green('NO STATIC ANALYSIS PROBLEMS')))
Example #2
0
    if os.path.exists(reportDirectory):
        shutil.rmtree(reportDirectory)
    os.system(target)
    if not os.path.exists(reportDirectory):
        sys.exit()

    print()
    print()

    lastFixture = ''
    noFailures = True
    putNewlineBefore = False
    for test, fixture, problem, cause in failedTests(reportDirectory):
        if fixture != lastFixture:
            out.printlns('', fixture, '-' * 79)
            lastFixture = fixture
            putNewlineBefore = False

        if problem == FAILED:
            if putNewlineBefore:
                print()
            out.printlns(out.red(test), cause, '')
            noFailures = False;
            putNewlineBefore = False
        elif problem == SKIPPED:
            print(out.yellow(test))
            putNewlineBefore = True

    if noFailures:
        out.printlns('', out.banner(out.green('ALL TESTS SUCCESSFUL')))
Example #3
0
        yield fileone.getAttribute('path'), int(fileone.getAttribute('line')), dupmsg(duplication, fileone, filetwo)

def runTarget(cpdFile='target/site/cpd.xml'):
    if os.path.exists(cpdFile):
        os.remove(cpdFile)
    os.system('mvn pmd:cpd')
    return os.path.exists(cpdFile)

if __name__ == '__main__':
    import sys

    if not runTarget():
        sys.exit()

    print()
    print()

    lastFile = ''
    noDups = True
    for srcFile, line, message in duplications():
        if (srcFile != lastFile):
            out.printlns('', os.path.relpath(srcFile), '-' * 79)
            lastFile = srcFile

        line = str(line)
        print(out.red(line), '-', message)
        noDups = False

    if noDups:
        print(out.banner(out.green('NO DUPLICATE CODE')))
Example #4
0
            yield srcFile.getAttribute('name'), int(violation.getAttribute('beginline')), text(violation).strip()

def runTarget(pmdFile='target/site/pmd.xml'):
    if os.path.exists(pmdFile):
        os.remove(pmdFile)
    os.system('mvn pmd:pmd')
    return os.path.exists(pmdFile)

if __name__ == '__main__':
    import sys

    if not runTarget():
        sys.exit()

    print()
    print()

    lastFile = ''
    noFailures = True
    for srcFile, line, message in pmdViolations():
        if srcFile != lastFile:
            out.printlns('', os.path.relpath(srcFile), '-' * 79)
            lastFile = srcFile

        line = str(line)
        print(out.red(line), '-', message)
        noFailures = False

    if noFailures:
        print(out.banner(out.green('PMD PASSED')))
Example #5
0
                yield srcFile.getAttribute('name'), int(err.getAttribute('line')), err.getAttribute('message')

def runTarget(checkstyleFile='target/checkstyle-result.xml'):
    if os.path.exists(checkstyleFile):
        os.remove(checkstyleFile)
    os.system('mvn checkstyle:checkstyle')
    return os.path.exists(checkstyleFile)

if __name__ == '__main__':
    import sys

    if not runTarget():
        sys.exit()

    print()
    print()

    lastFile = ''
    noFailures = True
    for srcFile, line, message in checkstyleProblems():
        if srcFile != lastFile:
            out.printlns('', os.path.relpath(srcFile), '-' * 79)
            lastFile = srcFile

        line = str(line)
        print(out.red(line), '-', message)
        noFailures = False

    if noFailures:
        print(out.banner(out.green('CHECKSTYLE PASSED')))
Example #6
0
        yield os.path.join(srcdir, fileName(bug)), int(lineNumber(bug)), message(bug)

def runTarget(findbugsFile='target/findbugsXml.xml'):
    if os.path.exists(findbugsFile):
        os.remove(findbugsFile)
    os.system('mvn findbugs:findbugs')
    return os.path.exists(findbugsFile)

if __name__ == '__main__':
    import sys

    if not runTarget():
        sys.exit()

    print()
    print()

    lastFile = ''
    noFailures = True
    for srcFile, line, msg in bugsFound():
        if srcFile != lastFile:
            out.printlns('', os.path.relpath(srcFile), '-' * 79)
            lastFile = srcFile

        line = str(line)
        print(out.red(line), '-', msg)
        noFailures = False

    if noFailures:
        print(out.banner(out.green('FIND BUGS PASSED')))