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:
parent
1374bcbeff
commit
38e68dc3e1
62
server.js
62
server.js
|
@ -691,34 +691,42 @@ cache(function(data, match, sendBadge, request) {
|
|||
var badgeTypeId = match[2]; // streamId or jobId
|
||||
var format = match[3];
|
||||
|
||||
//
|
||||
// Example URLs for requests sent to Coverity On Demand are:
|
||||
//
|
||||
// https://api.ondemand.coverity.com/streams/44b25sjc9l3ntc2ngfi29tngro/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 badgeData = getBadgeData('coverity', data);
|
||||
request(url, function(err, res, buffer) {
|
||||
if (err != null) {
|
||||
badgeData.text[1] = 'inaccessible';
|
||||
sendBadge(format, badgeData);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
badgeData = JSON.parse(buffer);
|
||||
sendBadge(format, badgeData);
|
||||
} catch(e) {
|
||||
badgeData.text[1] = 'invalid';
|
||||
sendBadge(format, badgeData);
|
||||
}
|
||||
});
|
||||
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:
|
||||
//
|
||||
// https://api.ondemand.coverity.com/streams/44b25sjc9l3ntc2ngfi29tngro/badge
|
||||
// https://api.ondemand.coverity.com/jobs/p4tmm8031t4i971r0im4s7lckk/badge
|
||||
//
|
||||
|
||||
var url = 'https://api.ondemand.coverity.com/' +
|
||||
badgeType + '/' + badgeTypeId + '/badge';
|
||||
request(url, function(err, res, buffer) {
|
||||
if (err != null) {
|
||||
badgeData.text[1] = 'inaccessible';
|
||||
sendBadge(format, badgeData);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
badgeData = JSON.parse(buffer);
|
||||
sendBadge(format, badgeData);
|
||||
} catch(e) {
|
||||
badgeData.text[1] = 'invalid';
|
||||
sendBadge(format, badgeData);
|
||||
}
|
||||
});
|
||||
}
|
||||
}));
|
||||
|
||||
// Gratipay integration.
|
||||
|
|
10
try.html
10
try.html
|
@ -172,9 +172,13 @@ Pixel-perfect Retina-ready Fast Consistent Hackable
|
|||
<td><img src='/coverity/scan/3997.svg' alt=''/></td>
|
||||
<td><code>https://img.shields.io/coverity/scan/3997.svg</code></td>
|
||||
</tr>
|
||||
<tr><th> Coverity Code Advisor On Demand: </th>
|
||||
<td><img src='/coverity/ondemand/streams/1234.svg' alt=''/></td>
|
||||
<td><code>https://img.shields.io/coverity/ondemand/streams/1234.svg</code></td>
|
||||
<tr><th> Coverity Code Advisor On Demand Stream Badge: </th>
|
||||
<td><img src='/coverity/ondemand/streams/STREAM.svg' alt=''/></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><th> HHVM: </th>
|
||||
<td><img src='/hhvm/symfony/symfony.svg' alt=''/></td>
|
||||
|
|
Loading…
Reference in New Issue
Block a user