Skip to content
This repository has been archived by the owner on Jul 25, 2021. It is now read-only.

Commit

Permalink
v0.19.2
Browse files Browse the repository at this point in the history
  • Loading branch information
brentlintner committed Sep 12, 2017
1 parent 27a88cf commit 0c336c0
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 26 deletions.
20 changes: 17 additions & 3 deletions lib/cli/analyze.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var config = require("./../config");
var git = require("./../git");
var logger = require("./../logger");
var plugin = require("./../plugin");
var util = require("./../util");
var upload = require("./analyze/upload");
var log_helper = require("./analyze/log_helper");
var plugin_map = require("./init/map");
Expand All @@ -19,6 +20,11 @@ var add_default_ignores = function (vile_yml) {
var new_ignore = _.uniq(_.concat(base_ignore, DEFAULT_IGNORE_DIRS));
_.set(vile_yml, "vile.ignore", new_ignore);
};
var has_non_info_issues = function (issues) {
return _.filter(issues, function (issue) {
return _.some(util.displayable_issues, function (t) { return t == issue.type; });
}).length > 0;
};
var analyze = function (opts, paths) {
var custom_plugins = typeof opts.plugins == "string" ?
_.compact(_.split(opts.plugins, ",")) : [];
Expand Down Expand Up @@ -51,9 +57,15 @@ var analyze = function (opts, paths) {
else {
log_helper.issues(issues, opts.terminalSnippets, !opts.decorations);
}
return opts.upload ?
upload.commit(issues, cli_time, opts) :
Bluebird.resolve();
if (opts.upload) {
return upload.commit(issues, cli_time, opts);
}
else {
if (opts.exitOnIssues && has_non_info_issues(issues)) {
process.exit(1);
}
return Bluebird.resolve();
}
})
.catch(log_and_exit); };
if (opts.gitDiff) {
Expand Down Expand Up @@ -109,6 +121,8 @@ var create = function (cli) {
.option("-w, --without-core-plugins", "don't use plugins bundled with core lib")
.option("-l, --log [level]", "specify the log level (info=default|warn|error)")
.option("-i, --issue-log [level]", "specify issue types to log (ex: '-i security,dependency')")
.option("-e, --exit-on-issues", "exit with bad code " +
"if non-info issues exist")
.option("-q, --quiet", "log nothing")
.option("-n, --no-decorations", "disable color and progress bar")
.action(action);
Expand Down
3 changes: 2 additions & 1 deletion lib/cli/init/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ var DEFAULT_IGNORE_DIRS = [
"doc",
"dist",
".git",
".gitmodules",
".gitattributes",
".gitignore",
".gitmodules",
"log",
"node_modules",
".nyc_output",
Expand Down
21 changes: 1 addition & 20 deletions lib/cli/init/pre.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,6 @@ var path = require("path");
var inquirer = require("inquirer");
var Bluebird = require("bluebird");
var fs_writeFile = Bluebird.promisify(fs.writeFile);
var welcome_confirm = function (config) {
return inquirer.prompt([
{
default: true,
message: "Hello friend. Please follow the prompts and " +
"answer as best you can.",
name: "ok_to_proceed",
type: "confirm"
}
]).then(function (answers) {
if (answers.ok_to_proceed) {
return Bluebird.resolve(config);
}
else {
return Bluebird.resolve(process.exit(0));
}
});
};
var check_for_existing_config = function (config) {
var vile_yml_path = path.join(process.cwd(), ".vile.yml");
if (fs.existsSync(vile_yml_path)) {
Expand Down Expand Up @@ -64,8 +46,7 @@ var check_for_existing_package_json = function (config) {
};
module.exports = {
init: function (config) {
return welcome_confirm(config)
.then(check_for_existing_config)
return check_for_existing_config(config)
.then(check_for_existing_package_json);
}
};
3 changes: 2 additions & 1 deletion lib/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ var stop_spinner = function () {
spin.stop();
};
var start_spinner = function () {
spin.start();
if (enable_colors)
spin.start();
};
var update_spinner = function (text) {
spin.text = text;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vile",
"version": "0.19.1",
"version": "0.19.2",
"description": "A punishing yet easy to use tool for writing insightful code.",
"main": "lib/index.js",
"types": "src/@types/index.d.ts",
Expand Down

0 comments on commit 0c336c0

Please sign in to comment.