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

standard-reporter

Package Overview
Dependencies
Maintainers
6
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

standard-reporter - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

test/expected-checkstyle.stdout

4

package.json
{
"name": "standard-reporter",
"version": "1.0.0",
"version": "1.0.1",
"description": "Reporters for feross/standard or uber/standard via unix pipes",

@@ -27,2 +27,4 @@ "main": "standard-reporter.js",

"husky": "^0.7.0",
"run-series": "^1.0.2",
"tape": "^4.0.0",
"uber-standard": "^3.6.0"

@@ -29,0 +31,0 @@ },

@@ -18,4 +18,2 @@ #!/usr/bin/env node

var DefaultReporter = StylishReporter;
function CheckStyleReporter() {

@@ -79,3 +77,3 @@ // ==== begin attribution ==================================================

].join('\n') + '\n';
console.log(checkstyle);
this.push(checkstyle);
callback();

@@ -87,3 +85,3 @@ }

function StylishReporter() {
function StylishReporter(options) {
var tableOptions = {

@@ -102,3 +100,3 @@ align: ['l', 'r', 'l', 'l', 'l'],

if (isTTY) {
if (options.colors) {
line = chalk.magenta(line);

@@ -120,5 +118,5 @@ column = chalk.blue(column);

var errors = fileErrors.errors.map(formatRow);
var header = isTTY ? chalk.underline.cyan(file) : file;
var header = options.colors ? chalk.underline.cyan(file) : file;
var formattedErrors = table(errors, tableOptions);
console.log(header + '\n' + formattedErrors + '\n');
this.push(header + '\n' + formattedErrors + '\n');
callback();

@@ -139,3 +137,3 @@ }

function flush(callback) {
console.log(JSON.stringify(errors, undefined, 2));
this.push(JSON.stringify(errors, undefined, 2));
callback();

@@ -219,23 +217,59 @@ }

var reporter = argv.json ? JSONReporter :
argv.checkstyle ? CheckStyleReporter :
argv.stylish ? StylishReporter : DefaultReporter;
var reporterMap = {
'json': JSONReporter,
'checkstyle': CheckStyleReporter,
'stylish': StylishReporter
};
process.stdin
.pipe(byline())
.pipe(parseErrors())
.pipe(groupErrorsByFile())
.pipe(reporter())
.pipe(process.stdout);
function standardReporter(options) {
options = extend({
type: 'none',
colors: isTTY,
sink: process.stdout
}, options || {});
process.on('error', function handleError(err) {
console.error(err);
hasErrors = true;
});
var inputStream = through2(noopTransform);
var reporter = reporterMap[options.type];
process.on('exit', function onStandardExit() {
if (hasErrors) {
return process.exit(1);
if (reporter) {
inputStream
.pipe(byline())
.pipe(parseErrors())
.pipe(groupErrorsByFile())
.pipe(reporter(options))
.pipe(options.sink);
} else {
inputStream.pipe(options.sink);
}
process.exit(0);
});
function noopTransform(chunk, enc, callback) {
this.push(chunk);
callback();
}
return inputStream;
}
module.exports = standardReporter;
if (require.main === module) {
var type = argv.json ? 'json' :
argv.checkstyle ? 'checkstyle' :
argv.stylish ? 'stylish' : 'none';
process.stdin.pipe(standardReporter({
type: type
}));
process.on('error', function handleError(err) {
console.error(err);
hasErrors = true;
});
process.on('exit', function onStandardExit() {
if (hasErrors) {
return process.exit(1);
}
process.exit(0);
});
}
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