Added static example badges for Coverity Code Advisor On Demand

integration.
Added example of a job badge url to try.html.
This commit is contained in:
John Fitzpatrick 2015-06-09 13:52:36 -06:00
parent 1374bcbeff
commit 38e68dc3e1
2 changed files with 42 additions and 30 deletions

View File

@ -691,20 +691,27 @@ cache(function(data, match, sendBadge, request) {
var badgeTypeId = match[2]; // streamId or jobId var badgeTypeId = match[2]; // streamId or jobId
var format = match[3]; var format = match[3];
var badgeData = getBadgeData('coverity', data);
if ((badgeType == 'jobs' && badgeTypeId == 'JOB') ||
(badgeType == 'streams' && badgeTypeId == 'STREAM')) {
// Request is for a static demo badge
badgeData.text[1] = 'clean';
badgeData.colorscheme = 'green'
sendBadge(format, badgeData);
return;
} else {
//
// Request is for a real badge; send request to Coverity On Demand API
// server to get the badge
// //
// Example URLs for requests sent to Coverity On Demand are: // Example URLs for requests sent to Coverity On Demand are:
// //
// https://api.ondemand.coverity.com/streams/44b25sjc9l3ntc2ngfi29tngro/badge // https://api.ondemand.coverity.com/streams/44b25sjc9l3ntc2ngfi29tngro/badge
// https://api.ondemand.coverity.com/jobs/p4tmm8031t4i971r0im4s7lckk/badge // https://api.ondemand.coverity.com/jobs/p4tmm8031t4i971r0im4s7lckk/badge
// //
// Note that jobs expire after 30 days so any working examples included here
// will likely be stale. For testing, it would be best to submit a small
// project for analysis, e.g. commons-io using the Coverity On Demand maven
// plugin.
//
var url = 'https://api.ondemand.coverity.com/' + badgeType + '/' + badgeTypeId + '/badge'; var url = 'https://api.ondemand.coverity.com/' +
var badgeData = getBadgeData('coverity', data); badgeType + '/' + badgeTypeId + '/badge';
request(url, function(err, res, buffer) { request(url, function(err, res, buffer) {
if (err != null) { if (err != null) {
badgeData.text[1] = 'inaccessible'; badgeData.text[1] = 'inaccessible';
@ -719,6 +726,7 @@ cache(function(data, match, sendBadge, request) {
sendBadge(format, badgeData); sendBadge(format, badgeData);
} }
}); });
}
})); }));
// Gratipay integration. // Gratipay integration.

View File

@ -172,9 +172,13 @@ Pixel-perfect   Retina-ready   Fast   Consistent   Hackable
<td><img src='/coverity/scan/3997.svg' alt=''/></td> <td><img src='/coverity/scan/3997.svg' alt=''/></td>
<td><code>https://img.shields.io/coverity/scan/3997.svg</code></td> <td><code>https://img.shields.io/coverity/scan/3997.svg</code></td>
</tr> </tr>
<tr><th> Coverity Code Advisor On Demand: </th> <tr><th> Coverity Code Advisor On Demand Stream Badge: </th>
<td><img src='/coverity/ondemand/streams/1234.svg' alt=''/></td> <td><img src='/coverity/ondemand/streams/STREAM.svg' alt=''/></td>
<td><code>https://img.shields.io/coverity/ondemand/streams/1234.svg</code></td> <td><code>https://img.shields.io/coverity/ondemand/streams/STREAM.svg</code></td>
</tr>
<tr><th> Coverity Code Advisor On Demand Job Badge: </th>
<td><img src='/coverity/ondemand/jobs/JOB.svg' alt=''/></td>
<td><code>https://img.shields.io/coverity/ondemand/jobs/JOB.svg</code></td>
</tr> </tr>
<tr><th> HHVM: </th> <tr><th> HHVM: </th>
<td><img src='/hhvm/symfony/symfony.svg' alt=''/></td> <td><img src='/hhvm/symfony/symfony.svg' alt=''/></td>