You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.php 3.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?PHP
  2. define('NOINT', true); define('PREFIX', 'http://www.dmdirc.com/'); define('SUBPAGE', 'reports'); define('PAGE', 'dev');
  3. define('TITLE', 'Reports');
  4. require_once('/home/dmdirc/www/inc/header.php');
  5. ?>
  6. <style type="text/css">
  7. table { border-collapse: collapse; width: 100%; }
  8. td, th { border: 1px solid black; padding: 3px; }
  9. tr.good td.result { background-color: #0a0; color: white; }
  10. tr.bad td.result { background-color: #a00; color: white; }
  11. </style>
  12. <div class="content">
  13. <p>
  14. We use a variety of tools for testing DMDirc. The output of these tools is
  15. summarised below.
  16. </p>
  17. <table>
  18. <tr><th>Tool</th><th>Information</th><th>Results</th></tr>
  19. <?PHP
  20. function showTool($link, $name, $desc, $result, $status = 'unknown') {
  21. echo '<tr class="', $status, '"><td><a href="', $link, '">', $name, '</a></td>';
  22. echo '<td>', $desc, '</td>';
  23. echo '<td class="result">', $result, '</td></tr>';
  24. }
  25. /** Junit **/
  26. $data = @file_get_contents('/home/dmdirc/www/junit/overview-summary.html');
  27. preg_match('#href="all-tests.html">([0-9]+)</a>#i', $data, $tests);
  28. preg_match('#href="alltests-fails.html">([0-9]+)</a>#i', $data, $fails);
  29. preg_match('#href="alltests-errors.html">([0-9]+)</a>#i', $data, $errors);
  30. $result = $tests[1] . ' tests, ' . $fails[1] . ' failure(s), ' . $errors[1] . ' error(s)';
  31. $status = ($fails[1] + $errors[1] == 0) ? 'good' : 'bad';
  32. showTool('frame-junit.html', 'JUnit', 'Unit test framework', $result, $status);
  33. /** Clover **/
  34. $data = @file_get_contents('clover/dashboard.html');
  35. preg_match('#\s*<table><tr><td>([0-9.]+)%\s*$#im', $data, $cover);
  36. showTool('frame-clover.html', 'Clover', 'Unit test coverage analyser', $cover[1] . '% coverage', (double) $cover[1] < 25 ? 'bad' : 'good');
  37. /** CPD **/
  38. $data = @file_get_contents('report-cpd.html');
  39. preg_match('#^<td class="SummaryNumber">([0-9]+)</td>#im', $data, $cpd);
  40. showTool('frame-cpd.html', 'Copy &amp; Paste Detection', 'Detects repeated code that may be better off refactored', $cpd[1] . ' duplications', $cpd[1] > 100 ? 'bad' : 'good');
  41. /** PMD **/
  42. $data = @file_get_contents('report-pmd.html');
  43. preg_match('#^<td>([0-9]+)</td><td>$#im', $data, $pmd);
  44. showTool('frame-pmd.html', 'PMD', 'Detects potential problems with code', $pmd[1] . ' violations', $pmd[1] > 2600 ? 'bad' : 'good');
  45. /** Checkstyle **/
  46. function showCheckstyle($title, $page, $target = 100) {
  47. $data = @file_get_contents('report-'.$page);
  48. preg_match('#^<td>([0-9]+)</td><td>([0-9]+)</td>$#im', $data, $cs);
  49. showTool('frame-checkstyle-'.$page, 'Checkstyle', 'Detects style errors (scope: ' . $title . ')', $cs[2] . ' errors', $cs[2] > $target ? 'bad' : 'good');
  50. }
  51. showCheckstyle('whole project', 'all.html', 750);
  52. showCheckstyle('actions', 'actions.html');
  53. showCheckstyle('command parser', 'commandparser.html');
  54. showCheckstyle('core', 'core.html');
  55. showCheckstyle('config', 'config.html');
  56. showCheckstyle('logger', 'logger.html');
  57. showCheckstyle('IRC parser', 'parser.html');
  58. showCheckstyle('Plugins', 'plugins.html');
  59. showCheckstyle('UI', 'ui.html');
  60. ?>
  61. </table>
  62. <h2>Findbugs report</h2>
  63. <ul>
  64. <li><a href="frame-findbugs.html" title="Findbugs report">Findbugs Report</a></li>
  65. </ul>
  66. <h2>Doc Check report</h2>
  67. <ul>
  68. <li><a href="frame-doccheck.html" title="DocCheck">Doc Check report</a></li>
  69. </ul>
  70. </div>
  71. <div id="footer">
  72. </div>
  73. </div>
  74. </body>
  75. </html>