<tr>
<td class="width-55">
<div class="overview-main-measure">
+ {{#notNull sqaleRating}}
+ <a href="{{urlForDrilldown componentKey 'sqale_rating'}}"><span class="rating rating-{{formatMeasure sqaleRating 'RATING'}}">{{formatMeasure sqaleRating 'RATING'}}</span></a>
+ {{/notNull}}
<a href="{{urlForDrilldown componentKey 'sqale_index'}}">{{formatMeasure debt 'WORK_DUR'}}</a>
</div>
<div class="overview-trend">
return formatted[0] !== '-' ? '+' + formatted : formatted;
};
+ /**
+ * Format a rating measure
+ * @param value
+ */
+ var ratingFormatter = function (value) {
+ var intValue = +value;
+ return String.fromCharCode(97 + intValue - 1).toUpperCase();
+ };
+
/**
* Format a measure according to its type
* @param measure
'PERCENT': function (value) {
return numeral(+value / 100).format('0,0.0%');
},
- 'WORK_DUR': durationFormatter
+ 'WORK_DUR': durationFormatter,
+ 'RATING': ratingFormatter
};
if (measure != null && type != null) {
formatted = formatters[type] != null ? formatters[type](measure) : measure;
SIZE_METRIC = 'ncloc',
ISSUES_METRIC = 'violations',
DEBT_METRIC = 'sqale_index',
+ SQALE_RATING_METRIC = 'sqale_rating',
COVERAGE_METRIC = 'overall_coverage',
NEW_COVERAGE_METRIC = 'new_overall_coverage',
DUPLICATIONS_METRIC = 'duplicated_lines_density';
GATE_METRIC,
SIZE_METRIC,
DEBT_METRIC,
+ SQALE_RATING_METRIC,
COVERAGE_METRIC,
NEW_COVERAGE_METRIC,
DUPLICATIONS_METRIC
},
parseDebt: function (msr) {
- var debtMeasure = _.findWhere(msr, { key: DEBT_METRIC });
+ var debtMeasure = _.findWhere(msr, { key: DEBT_METRIC }),
+ sqaleRatingMeasure = _.findWhere(msr, { key: SQALE_RATING_METRIC });
if (debtMeasure != null) {
this.set({
debt: debtMeasure.val,
debt3: debtMeasure.var3
});
}
+ if (sqaleRatingMeasure != null) {
+ this.set({ sqaleRating: sqaleRatingMeasure.val });
+ }
},
parseCoverage: function (msr) {
lib.configureCasper();
-casper.test.begin(testName(), 33, function (test) {
+casper.test.begin(testName(), 34, function (test) {
casper
.start(lib.buildUrl('overview'), function () {
lib.setDefaultViewport();
test.assertSelectorContains('#overview-issues', '1,605');
test.assertExists('#overview-issues-trend path');
+ test.assertSelectorContains('#overview-debt', 'A');
test.assertSelectorContains('#overview-debt', '66');
test.assertSelectorContains('#overview-debt', '-2');
test.assertSelectorContains('#overview-debt', '-49');
"var3": -30819,
"fvar3": "-64d"
},
+ {
+ "key": "sqale_rating",
+ "val": 1,
+ "frmt_val": "A",
+ "data": "A",
+ "trend": 0,
+ "var": 0,
+ "var1": 0,
+ "fvar1": "0",
+ "var2": 0,
+ "fvar2": "0",
+ "var3": 0,
+ "fvar3": "0"
+ },
{
"key": "overall_coverage",
"val": 83.9,