Skip to content

Commit f702fb5

Browse files
committed
Merge pull request #14 from codeclimate/gd-config
Read config json from file
2 parents 845bd93 + 8b1416c commit f702fb5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

bin/eslint.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env node
22

33
var CLIEngine = require("eslint").CLIEngine;
4+
var fs = require("fs");
45

56
function buildIssueJson(message, path) {
67
// ESLint doesn't emit a ruleId in the
@@ -37,18 +38,23 @@ var options = {
3738
extensions: [".js"], ignore: true, reset: false, useEslintrc: true
3839
};
3940
var ignores = [];
40-
if (process.env.ENGINE_CONFIG) {
41-
var engineConfig = JSON.parse(process.env.ENGINE_CONFIG);
41+
42+
if (fs.existsSync("/config.json")) {
43+
var engineConfig = JSON.parse(fs.readFileSync("/config.json"));
44+
4245
if (engineConfig.config) {
4346
options.configFile = "/code/" + engineConfig.config;
4447
}
48+
4549
if (engineConfig.exclude_paths) {
4650
ignores = engineConfig.exclude_paths;
4751
}
52+
4853
if (engineConfig.extensions) {
4954
options.extensions = engineConfig.extensions;
5055
}
5156
}
57+
5258
var cli = new CLIEngine(options);
5359
var report = cli.executeOnFiles(["/code"]);
5460
report.results.forEach(function(result) {

0 commit comments

Comments
 (0)