New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.0.2 to 0.1.0

lib/audits/blank.js

2

bin/encore-auditor.js

@@ -12,6 +12,4 @@ #!/usr/bin/env node

.option('--debug', 'Debug encore-auditor program')
.option('--exclude-glob [glob]', 'Ignore files matching given glob.')
.option('--include-directory [directory]', 'Analyze files in given directory')
.parse(process.argv);
cli(program);
'use strict';
const Auditor = require('./encore-auditor');
const BasicReporter = require('./basic-reporter');
const _ = require('lodash');
const Auditor = require('./encore-auditor');
const util = require('util');

@@ -14,10 +15,25 @@

// 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) {
console.log('CONFIG:\n', util.inspect(config));
console.log('OPTIONS:\n', util.inspect(options));
console.log('OPTIONS:\n', util.inspect(options, { depth: null }));
console.log('CONFIG:\n', util.inspect(config, { depth: null }));
return;
}
let auditor = new Auditor();
auditor.analyze();
// Custom Rules should be fixed AT EARLIEST CONVENIENCE
//config.customRules = require(path_to_custom.json);
let auditor = new Auditor(config);
auditor.analyze().then((results) => {
let reporter = new BasicReporter(results);
reporter.report();
}).catch((err) => {
console.log('Something broke with the auditor.', err);
});
};
'use strict'
const _ = require('lodash');
const glob = require('glob');
const util = require('util');
const fs = require('fs');
module.exports = class Auditor {
constructor () {
console.log('NEW Auditor');
constructor (config) {
this.globs = config.globs;
this.audits = config.audits;
this.config = config;
}
// Start code analysis here!
analyze() {
// Start code analysis here!
console.log('Analyzing!');
return Promise.all([
this.analysisOf('markup'),
this.analysisOf('styles'),
this.analysisOf('scripts'),
this.analysisOf('tests')
]);
}
/**
* @param {String} ilk
* - `markup`
* - `styles`
* - `scripts`
* - `tests`
* @returns {Promise<Array>} Get array of results when promise resolves.
*/
analysisOf(ilk) {
let audits = this.audits;
let promise = new Promise((resolve, reject) => {
glob(this.globs[ilk], (err, paths) => {
if (err) reject(err);
let results = paths.reduce((allResults, path) => {
if (path.match(/bower_components|node_modules/)) {
return allResults;
}
let file = fs.readFileSync(path, 'utf8');
// 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
}
});
}
});
});
});
return allResults;
}, []);//paths
resolve(results);
});//glob
});//Promise()
return promise;
}//analysisOf(ilk)
}//Auditor
{
"name": "encore-auditor",
"version": "0.0.2",
"version": "0.1.0",
"description": "Source code analyzer for EncoreUI applications.",

@@ -17,2 +17,3 @@ "main": "./lib/encore-auditor.js",

"dependencies": {
"chalk": "^1.1.3",
"commander": "^2.9.0",

@@ -28,16 +29,8 @@ "glob": "^7.0.3",

"globs": {
"markdown": [
"app/**/*.html"
],
"style": [
"app/**/*.less"
],
"scripts": [
"app/**/*.js"
],
"tests": [
"test/**/*.js"
]
"markup": "{app,src}/**/*.html",
"styles": "{app,src}/**/*.less",
"scripts": "{app,src}/**/*.js",
"tests": "test/**/*.js"
}
}
}

Sorry, the diff of this file is not supported yet

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