8000 Consistency fixes · codeclimate/codeclimate-fixme@ea526d5 · GitHub
[go: up one dir, main page]

Skip to content

Commit ea526d5

Browse files
committed
Consistency fixes
* Fix spacing * Use single quotes * Remove unneeded self references
1 parent 000a1d0 commit ea526d5

File tree

1 file changed

+25
-27
lines changed

1 file changed

+25
-27
lines changed

lib/fix-me.js

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
1-
var glob = require('glob');
2-
var spawn = require('child_process').spawn;
31
var fs = require('fs');
2+
var glob = require('glob');
43
var path = require('path');
54
var readline = require('readline');
5+
var spawn = require('child_process').spawn;
66

7-
module.exports = FixMe;
8-
9-
function FixMe() { }
7+
function FixMe() {}
108

11-
FixMe.prototype.runEngine = function(){
12-
var analysisFiles = [],
13-
config = {
14-
include_paths: ["./"],
15-
strings: ["FIXME", "TODO", "HACK", "XXX", "BUG"]
16-
},
17-
self = this;
9+
FixMe.prototype.runEngine = function() {
10+
var analysisFiles = [];
11+
var config = {
12+
include_paths: ['./'],
13+
strings: ['FIXME', 'TODO', 'HACK', 'XXX', 'BUG']
14+
};
1815

1916
if (fs.existsSync('/config.json')) {
2017
var userConfig = JSON.parse(fs.readFileSync('/config.json'));
@@ -28,37 +25,38 @@ FixMe.prototype.runEngine = function(){
2825
}
2926
}
3027

31-
self.find(config.include_paths, config.strings);
28+
this.find(config.include_paths, config.strings);
3229
}
3330

34-
FixMe.prototype.find = function(files, strings){
31+
FixMe.prototype.find = function(files, strings) {
3532
var fixmeStrings = '(' + strings.join('|') + ')';
3633
var grep = spawn('grep', ['-nHwoEr', fixmeStrings].concat(files));
37-
var output = "";
38-
var self = this;
34+
var output = '';
3935

4036
readline.createInterface({ input: grep.stdout }).on('line', function(line) {
41-
var cols = line.split(":");
37+
var cols = line.split(':');
4238
var fileName = cols[0].replace(/^\/code\//, '');
4339
var lineNum = parseInt(cols[1]);
4440
var matchedString = cols[2];
4541

4642
if (matchedString !== undefined){
4743
var issue = JSON.stringify({
48-
"type": "issue",
49-
"check_name": matchedString,
50-
"description": matchedString + " found",
51-
"categories": ["Bug Risk"],
52-
"location":{
53-
"path": fileName,
54-
"lines": {
55-
"begin": lineNum,
56-
"end": lineNum
44+
'type': 'issue',
45+
'check_name': matchedString,
46+
'description': matchedString + ' found',
47+
'categories': ['Bug Risk'],
48+
'location':{
49+
'path': fileName,
50+
'lines': {
51+
'begin': lineNum,
52+
'end': lineNum
5753
}
5854
}
5955
});
6056

61-
console.log(issue+'\0');
57+
console.log(issue + '\0');
6258
}
6359
});
6460
}
61+
62+
module.exports = FixMe;

0 commit comments

Comments
 (0)
0