Skip to content

Commit 06d95aa

Browse files
committed
Switch base images, fix up index
1 parent 6cfb796 commit 06d95aa

File tree

2 files changed

+23
-21
lines changed

2 files changed

+23
-21
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM mhart/alpine-node
1+
FROM node
22

33
WORKDIR /usr/src/app
44

index.js

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
var glob = require('glob');
2-
var exec = require('child_process').exec;
2+
var exec = require('child_process').execSync;
33
var fs = require('fs');
44

55
module.exports = FixMe;
66
function FixMe() { }
77

88
// Strings to scan for in source
9-
var fixmeStrings = "'FIXME|TODO|HACK|XXX|BUG'";
9+
var fixmeStrings = "'(FIXME|TODO|HACK|XXX|BUG)|?:'";
1010

1111
// Prints properly structured Issue data to STDOUT according to
1212
// Code Climate Engine specification.
@@ -32,29 +32,29 @@ var printIssue = function(fileName, lineNum, matchedString){
3232

3333
var findFixmes = function(file){
3434
// Prepare the grep string for execution (uses BusyBox grep)
35-
var grepString = "grep -inwHoE " + fixmeStrings + " " + file;
35+
var grepString = "grep -inHwoE " + fixmeStrings + " " + file;
3636

3737
// Execute grep with the FIXME patterns
38-
exec(grepString, function(error, stdout, stderr) {
38+
var results = exec(grepString);
3939

40-
// Parses grep output
41-
var lines = stdout.split("\n");
42-
lines.forEach(function(line, index, array){
40+
// Parses grep output
41+
var lines = results.toString().split("\n");
42+
43+
lines.forEach(function(line, index, array){
44+
// grep spits out an extra line that we can ignore
45+
if(index < (array.length-1)){
46+
47+
var cols = line.split(":");
4348

44-
// grep spits out an extra line that we can ignore
45-
if(index < (array.length-1)){
46-
47-
var cols = line.split(":");
49+
// Remove remnants of container paths for external display
50+
var fileName = cols[0].split("/code/")[1];
51+
var lineNum = cols[1];
52+
var matchedString = cols[2];
4853

49-
// Remove remnants of container paths for external display
50-
var fileName = cols[0].split("/code/")[1];
51-
var lineNum = cols[1];
52-
var matchedString = cols[2];
53-
54-
printIssue(fileName, lineNum, matchedString);
55-
}
56-
})
54+
printIssue(fileName, lineNum, matchedString);
55+
}
5756
})
57+
5858
}
5959

6060
// Uses glob to traverse code directory and find files to analyze,
@@ -65,7 +65,9 @@ var fileWalk = function(excludePaths){
6565

6666
allFiles.forEach(function(file, i, a){
6767
if(excludePaths.indexOf(file.split("/code/")[1]) < 0) {
68-
analysisFiles.push(file);
68+
if(!fs.lstatSync(file).isDirectory()){
69+
analysisFiles.push(file);
70+
}
6971
}
7072
});
7173

0 commit comments

Comments
 (0)