Skip to content

Commit 07f6e5e

Browse files
committed
Drop exclude_paths support, default configuration
Defaulting to `include_paths: [./]` means it's possible to run docker run -v $PWD:/code $image to see raw output from running this engine, which is useful while developing.
1 parent 47e17e4 commit 07f6e5e

File tree

3 files changed

+7
-19
lines changed

3 files changed

+7
-19
lines changed

Diff for: lib/file-builder.js

-9
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@ function withIncludes(include_paths) {
66
return buildFiles(include_paths);
77
}
88

9-
// Returns file paths based on the exclude_paths values in config file
10-
function withExcludes(exclude_paths) {
11-
var allFiles = glob.sync("/code/**/**", {});
12-
var excludedFiles = buildFiles(exclude_paths);
13-
14-
return diff(allFiles, excludedFiles);
15-
}
16-
179
// Returns all the file paths in the main directory that match the given pattern
1810
function buildFiles(paths) {
1911
var files = [];
@@ -35,7 +27,6 @@ function filterFiles(paths) {
3527

3628
module.exports = {
3729
withIncludes: withIncludes,
38-
withExcludes: withExcludes,
3930
filterFiles: filterFiles
4031
};
4132

Diff for: lib/fix-me.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,20 @@ function FixMe() { }
1111

1212
FixMe.prototype.runEngine = function(){
1313
var analysisFiles = [],
14+
config = {
15+
include_paths: ["./"]
16+
},
1417
self = this;
1518

1619
if (fs.existsSync('/config.json')) {
17-
var engineConfig = JSON.parse(fs.readFileSync('/config.json'));
20+
var overrides = JSON.parse(fs.readFileSync('/config.json'));
1821

19-
if (engineConfig.hasOwnProperty('include_paths')) {
20-
analysisFiles = fileBuilder.withIncludes(engineConfig.include_paths);
21-
} else if (engineConfig.hasOwnProperty('exclude_paths')) {
22-
analysisFiles = fileBuilder.withExcludes(engineConfig.exclude_paths);
22+
for (var prop in overrides) {
23+
config[prop] = overrides[prop];
2324
}
2425
}
2526

27+
analysisFiles = fileBuilder.withIncludes(config.include_paths);
2628
analysisFiles = fileBuilder.filterFiles(analysisFiles);
2729

2830
analysisFiles.forEach(function(f, i, a){

Diff for: test/file-builder.js

-5
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ describe("fileBuilder", function(){
77
// expect();
88
});
99
});
10-
describe("#withExcludes(paths)", function(){
11-
xit("returns correct files", function(){
12-
// expect();
13-
});
14-
});
1510
describe("#filterFiles(paths)", function(){
1611
xit("returns filters out directory paths", function(){
1712
// expect();

0 commit comments

Comments
 (0)