Merge remote-tracking branch 'kyrias/coverity-scan'

This commit is contained in:
Thaddee Tyl 2015-04-11 23:04:08 +02:00
commit 91f3a9e10e
2 changed files with 39 additions and 0 deletions

View File

@ -578,6 +578,41 @@ camp.route(/^\/sonar\/(http|https)\/(.*)\/(.*)\/coverage\.(svg|png|gif|jpg|json)
});
}));
// Coverity integration
camp.route(/^\/coverity\/scan\/(.+)\.(svg|png|gif|jpg|json)$/,
cache(function(data, match, sendBadge, request) {
var projectId = match[1]; // eg, `3997`
var format = match[2];
var url = 'https://scan.coverity.com/projects/' + projectId + '/badge.json';
var badgeData = getBadgeData('coverity', data);
request(url, function(err, res, buffer) {
if (err != null) {
badgeData.text[1] = 'inaccessible';
sendBadge(format, badgeData);
return;
}
try {
var data = JSON.parse(buffer);
badgeData.text[1] = data.message;
if (data.message === 'passed') {
badgeData.colorscheme = 'brightgreen'
} else if (/^passed .* new defects$/.test(data.message)) {
badgeData.colorscheme = 'yellow';
} else if (data.message === 'pending') {
badgeData.colorscheme = 'orange';
} else if (data.message === 'failed') {
badgeData.colorscheme = 'red';
}
sendBadge(format, badgeData);
} catch(e) {
badgeData.text[1] = 'invalid';
sendBadge(format, badgeData);
}
});
}));
// Gratipay integration.
camp.route(/^\/(gittip|gratipay)\/(.*)\.(svg|png|gif|jpg|json)$/,
cache(function(data, match, sendBadge, request) {

View File

@ -152,6 +152,10 @@ Pixel-perfect   Retina-ready   Fast   Consistent   Hackable
<td><img src='/codecov/c/github/codecov/example-python.svg' alt=''/></td>
<td><code>https://img.shields.io/codecov/c/github/codecov/example-python.svg</code></td>
</tr>
<tr><th> Coverity Scan: </th>
<td><img src='/coverity/scan/3997.svg' alt=''/></td>
<td><code>https://img.shields.io/coverity/scan/3997.svg</code></td>
</tr>
<tr><th> HHVM: </th>
<td><img src='/hhvm/symfony/symfony.svg' alt=''/></td>
<td><code>https://img.shields.io/hhvm/symfony/symfony.svg</code></td>