Tracked skipped tests in technical debt benchmark (#9206)

This commit is contained in:
Ian Hickson 2017-04-05 12:23:21 -07:00 committed by GitHub
parent a52c7b470d
commit 86a490ffe8

View File

@ -13,7 +13,8 @@ import 'package:path/path.dart' as path;
// the numbers below are odd, so that the totals don't seem round. :-)
const double todoCost = 1009.0; // about two average SWE days, in dollars
const double ignoreCost = 2003.0; // four average SWE days, in dollars
const double pythonCost = 3001.0; // six average SWE days, in dollars
const double pythonCost = 3001.0; // six average SWE days, in dollars
const double skipCost = 2473.0; // 20 hours: 5 to fix the issue we're ignoring, 15 to fix the bugs we missed because the test was off
final RegExp todoPattern = new RegExp(r'(?://|#) *TODO');
final RegExp ignorePattern = new RegExp(r'// *ignore:');
@ -25,12 +26,15 @@ Future<double> findCostsForFile(File file) async {
path.extension(file.path) != '.yaml' &&
path.extension(file.path) != '.sh')
return 0.0;
final bool isTest = file.path.endsWith('_test.dart');
double total = 0.0;
for (String line in await file.readAsLines()) {
if (line.contains(todoPattern))
total += todoCost;
if (line.contains(ignorePattern))
total += ignoreCost;
if (isTest && line.contains('skip:'))
total += skipCost;
}
return total;
}