Skip to content

Commit 1d46c20

Browse files
committed
Allow configurability of the FIXME strings
1 parent 07f6e5e commit 1d46c20

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

Diff for: README.md

+17
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,23 @@ These strings are things you should fix now, not later.
1717
2. Run `codeclimate engines:enable fixme`. This command both installs the engine and enables it in your `.codeclimate.yml` file.
1818
3. You're ready to analyze! Browse into your project's folder and run `codeclimate analyze`.
1919

20+
### Configuration
21+
22+
You can specify what strings to match by adding a `strings` key in your
23+
`.codeclimate.yml`:
24+
25+
```yaml
26+
engines:
27+
fixme:
28+
enabled: true
29+
strings:
30+
- FIXME
31+
- CUSTOM
32+
```
33+
34+
**NOTE**: values specified here *override* the defaults, they are not
35+
*additional* strings to match.
36+
2037
### Need help?
2138
2239
For help with `codeclimate-fixme`, please open an issue on this repository.

Diff for: lib/fix-me.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ function FixMe() { }
1212
FixMe.prototype.runEngine = function(){
1313
var analysisFiles = [],
1414
config = {
15-
include_paths: ["./"]
15+
include_paths: ["./"],
16+
strings: ["FIXME", "TODO", "HACK", "XXX", "BUG"]
1617
},
1718
self = this;
1819

@@ -28,12 +29,12 @@ FixMe.prototype.runEngine = function(){
2829
analysisFiles = fileBuilder.filterFiles(analysisFiles);
2930

3031
analysisFiles.forEach(function(f, i, a){
31-
self.find(f);
32+
self.find(f, config.strings);
3233
});
3334
}
3435

35-
FixMe.prototype.find = function(file){
36-
var fixmeStrings = "'(FIXME|TODO|HACK|XXX|BUG)'",
36+
FixMe.prototype.find = function(file, strings){
37+
var fixmeStrings = "'(" + strings.join("|") + ")'",
3738
self = this;
3839

3940
// Prepare the grep string for execution (uses BusyBox grep)

0 commit comments

Comments
 (0)