import findbugs import checkstyle import pmd import cpd import out import itertools import os.path if __name__ == '__main__': import sys bugFound, styleChecked, pmdRan, dupChecked = findbugs.runTarget(), checkstyle.runTarget(), \ pmd.runTarget(), cpd.runTarget() out.printlns('', '') if not bugFound: 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()
# If the compile fails, we don't want to look at old test reports. 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')))