Skip to content

Commit

Permalink
Allow configurability of the FIXME strings
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrisbin committed Jan 13, 2016
1 parent 07f6e5e commit 1d46c20
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,23 @@ These strings are things you should fix now, not later.
2. Run `codeclimate engines:enable fixme`. This command both installs the engine and enables it in your `.codeclimate.yml` file.
3. You're ready to analyze! Browse into your project's folder and run `codeclimate analyze`.

### Configuration

You can specify what strings to match by adding a `strings` key in your
`.codeclimate.yml`:

```yaml
engines:
fixme:
enabled: true
strings:
- FIXME
- CUSTOM

This comment has been minimized.

Copy link
@ABaldwinHunter

ABaldwinHunter Feb 1, 2016

Contributor

@pbrisbin I believe you have to add a config key to give engines custom nodes. So:

engines:
   fixme:
      enabled: true
     config:
          strings:
          - ALL
          - MY
          - STRINGS

The cc/yaml gem might not pick up key otherwise.

```
**NOTE**: values specified here *override* the defaults, they are not
*additional* strings to match.
### Need help?
For help with `codeclimate-fixme`, please open an issue on this repository.
Expand Down
9 changes: 5 additions & 4 deletions lib/fix-me.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ function FixMe() { }
FixMe.prototype.runEngine = function(){
var analysisFiles = [],
config = {
include_paths: ["./"]
include_paths: ["./"],
strings: ["FIXME", "TODO", "HACK", "XXX", "BUG"]
},
self = this;

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

analysisFiles.forEach(function(f, i, a){
self.find(f);
self.find(f, config.strings);
});
}

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

// Prepare the grep string for execution (uses BusyBox grep)
Expand Down

0 comments on commit 1d46c20

Please sign in to comment.