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

encore-auditor

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

encore-auditor - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

lib/audits.js

32

lib/basic-reporter.js

@@ -11,4 +11,27 @@ 'use strict';

.replace(/\s{2,}/, ' ');
}
}//normalizeMessage()
function formattedMessage (result) {
let fmt;
let msg = result.signature.level;
switch(result.signature.level) {
case 'error':
// white on red
fmt = chalk.bold.white.bgRed;
break;
case 'info':
// white on blue
fmt = chalk.bold.white.bgBlue;
break;
default:
msg = 'warning';
// black on yellow
fmt = chalk.bold.black.bgYellow;
break;
}
return fmt(msg.toUpperCase());
}//formattedMessage()
module.exports = class BasicReporter {

@@ -22,5 +45,8 @@ constructor(results) {

[
chalk.bold(`${result.file.path}:${result.file.lineNumber}:${result.file.line}`),
[
formattedMessage(result),
chalk.bold(`${result.file.path}:${result.file.lineNumber}:${result.file.line}`)
].join(' '),
result.signature.messages.map(normalizeMessage).join('\n'),
'', // empty line for readability
'', // empty line
].forEach((m) => console.log(m));

@@ -27,0 +53,0 @@ });

14

lib/cli.js

@@ -7,2 +7,3 @@ 'use strict';

const util = require('util');
const audits = require('./audits');

@@ -15,10 +16,5 @@ /**

let config = require('../package.json').config;
config.audits = audits;
let auditor = new Auditor(config);
// Legacy audits are for deprecations in LTS block(s).
let ltsAudits = require('./audits/blank'); // none for initial release
// Current audits are for deprecations in current major block.
let currentAudits = require('./audits/onedot');
config.audits = [ ltsAudits, currentAudits ];
if (program.debug) {

@@ -30,6 +26,2 @@ console.log('OPTIONS:\n', util.inspect(options, { depth: null }));

// Custom Rules should be fixed AT EARLIEST CONVENIENCE
//config.customRules = require(path_to_custom.json);
let auditor = new Auditor(config);
auditor.analyze().then((results) => {

@@ -36,0 +28,0 @@ let reporter = new BasicReporter(results);

@@ -46,19 +46,16 @@ 'use strict'

// iterate over Current and LTS audit signatures
audits.forEach((audit) => { // O(n)
let lineNo = 0;
file.split('\n').forEach((line) => { // O(n)
lineNo++;
audit.signatures[ilk].forEach((signature) => { // O(n)
if (line.match(signature.pattern)) {
allResults.push({
signature: signature,
file: {
path: path,
line: line,
lineNumber: lineNo
}
});
}
});
let lineNo = 0;
file.split('\n').forEach((line) => { // O(n)
lineNo++;
audits.signatures[ilk].forEach((signature) => { // O(n)
if (line.match(signature.pattern)) {
allResults.push({
signature: signature,
file: {
path: path,
line: line,
lineNumber: lineNo
}
});
}
});

@@ -65,0 +62,0 @@ });

{
"name": "encore-auditor",
"version": "0.2.0",
"version": "0.3.0",
"description": "Source code analyzer for EncoreUI applications.",

@@ -5,0 +5,0 @@ "main": "./lib/encore-auditor.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