Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save xianhuazhou/b32c0d10bcb22335a96d to your computer and use it in GitHub Desktop.
Save xianhuazhou/b32c0d10bcb22335a96d to your computer and use it in GitHub Desktop.
$('div.rule-violations').each(function() {
var header = $(this).find('h2').text().replace(/\s+/g, " ");
var labels = $(this).find('ul li.label').map(function() {
return $(this).text();
}).get().join(', ');
console.log(header + " (" + labels + ")");
var titles = [];
$(this).find('div.violations div.location').each(function() {
titles.push(" " + $(this).html().replace(/\s+/g, " "));
});
if (titles.length > 0) {
console.log(titles.join("\n"));
} else {
console.log(' ' + $(this).find('div.violation-context').text().replace(/\s+/g, " "));
}
console.log("\n\n");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment