Skip to content
This repository was archived by the owner on Dec 4, 2021. It is now read-only.

Commit 93343af

Browse files
Caleb HooverCaleb Hoover
Caleb Hoover
authored and
Caleb Hoover
committed
stuff
1 parent 4bf3eaf commit 93343af

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

bin/check

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,33 @@
11
#!/usr/bin/env node
22

3-
43
var yargs = require('yargs')
54
.usage('Usage: check <file> [options]')
65
.describe('v', 'Verbose flag. Will print statements.')
76
.describe('r', 'Recrusive flag. Will recursively check required files.')
8-
.describe('o', 'Output flag. Will output ast into ASTOutput.js.');
9-
yargs.check(function(fn) {
10-
if (!fn._[0]) {
11-
yargs.showHelp();
12-
process.exit();
13-
}
14-
});
7+
.describe('o', 'Output flag. Will output ast into ASTOutput.js.')
8+
.showHelpOnFail(false);
159

16-
var argv = yargs.argv;
10+
var check = require('../check.js'),
11+
colors = require('colors'),
12+
fs = require('fs'),
13+
path = require('path'),
14+
file = fs.realpathSync(process.argv[2]);
1715

18-
if (argv.h) {
16+
if (!file) {
1917
yargs.showHelp();
2018
process.exit();
19+
} else if (!fs.existsSync(file)) {
20+
console.error(fn._[0], 'doesn\'t exist.');
21+
process.exit();
2122
}
2223

23-
var check = require('../check.js'),
24-
colors = require('colors'),
25-
fs = require('fs'),
26-
file = process.argv[2];
27-
24+
var argv = yargs.argv;
2825

29-
if (!fs.existsSync(file)) {
30-
console.error(file, 'does not exist.');
26+
if (argv.h) {
27+
yargs.showHelp();
3128
process.exit();
3229
}
3330

34-
3531
var sinks = module.exports.sinks = require('../danger.json').sinks;
3632
var sources = module.exports.sources = require('../danger.json').sources;
3733

@@ -45,4 +41,5 @@ var scope = new check.Scope({
4541
file: file
4642
});
4743

44+
console.log();
4845
check.traverse(check.astFromFile(scope.file, argv.o), scope);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Check",
33
"description": "Static analysis tool to scan for vulneralbilites in a nodejs project.",
4-
"version": "1.0.0",
4+
"version": "0.5.0",
55
"author": "Caleb",
66
"main": "./bin/check",
77
"bin": {

0 commit comments

Comments
 (0)