Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jscs-html-pretty-reporter

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jscs-html-pretty-reporter - npm Package Compare versions

Comparing version 0.1.3 to 0.2.0

78

index.js

@@ -11,2 +11,10 @@ var fs = require('fs'),

this.errorAttrs = [
'filename',
'rule',
'line',
'column',
'message'
];
this.summarizeFile = function(file, alert) {

@@ -34,21 +42,21 @@ var messages = {

this.summarizeData = function(files) {
_.each(files, _.bind(function eachFile(file) {
var entry = {
path: file.filename,
errors: 0,
warnings: 0,
messages: [],
errorList: []
},
alerts = file.errors;
this.eachFile = function(file) {
var entry = {
path: file.filename,
errors: 0,
warnings: 0,
messages: [],
errorList: []
},
alerts = file.errors;
_.each(alerts, _.bind(function eachAlert(alert) {
entry = this.summarizeFile(entry, alert);
}, this));
_.each(alerts, _.partial(this.summarizeFile, entry));
hairballs.updateFileSummary(entry);
}, this));
hairballs.updateFileSummary(entry);
};
this.summarizeData = function(files) {
_.each(files, this.eachFile);
};
this.runReport = function(input) {

@@ -72,26 +80,32 @@ this.summarizeData(input);

this.saveHandler = function(err) {
if (err) {
throw err;
}
}
this.save = function(data) {
fs.writeFile(this.outputPath, templateUtils.applyTemplates(data), function writeHandler(err) {
if (err) {
throw err;
}
});
fs.writeFile(this.outputPath, templateUtils.applyTemplates(data), this.saveHandler);
};
results = _.map(input, function inputMapper(file) {
this.mapError = function(error) {
return _.pick(error, this.errorAttrs);
};
this.mapInput = function(file) {
return {
errors: _.map(file._errorList, function errorMapper(error) {
return _.pick(error, [
'filename',
'rule',
'line',
'column',
'message'
]);
}),
errors: _.map(file._errorList, this.mapError),
filename: file._file._filename
};
});
};
this.save(this.runReport(results));
_.bindAll(this, [
'summarizeData',
'summarizeFile',
'eachFile',
'mapError',
'mapInput'
]);
this.save(this.runReport(_.map(input, this.mapInput)));
};
{
"name": "jscs-html-pretty-reporter",
"version": "0.1.3",
"version": "0.2.0",
"description": "An HTML reporter for JSCS using Hairballs",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc