Comparing version 3.2.2 to 4.0.1
@@ -15,3 +15,2 @@ 'use strict'; | ||
'.erb': { parserName: 'ejsParser' }, | ||
'.hrl': { parserName: 'erlangParser' }, | ||
'.erl': { parserName: 'erlangParser' }, | ||
@@ -27,2 +26,3 @@ '.es': { parserName: 'defaultParser' }, | ||
'.hogan': { parserName: 'hbsParser' }, | ||
'.hrl': { parserName: 'erlangParser' }, | ||
'.hs': { parserName: 'haskellParser' }, | ||
@@ -40,2 +40,3 @@ '.htm': { parserName: 'twigParser' }, | ||
'.pm': { parserName: 'coffeeParser' }, | ||
'.pug': { parserName: 'jadeParser' }, | ||
'.py': { parserName: 'pythonParser' }, | ||
@@ -42,0 +43,0 @@ '.rb': { parserName: 'coffeeParser' }, |
@@ -18,3 +18,3 @@ var os = require('os'); | ||
// transformed comment as an array item | ||
var transformedComment = transformFn(comment.file, comment.line, comment.text, kind); | ||
var transformedComment = transformFn(comment.file, comment.line, comment.text, kind, comment.ref); | ||
// enforce array type | ||
@@ -58,5 +58,5 @@ if (!Array.isArray(transformedComment)) { | ||
newLine: os.EOL, | ||
transformComment: function (file, line, text, kind) { | ||
transformComment: function (file, line, text, kind, ref) { | ||
//jshint unused:false | ||
return ['file: ' + file, 'line: ' + line, 'text: ' + text]; | ||
return ['file: ' + file, 'line: ' + line, 'text: ' + text, 'ref:' + ref]; | ||
}, | ||
@@ -63,0 +63,0 @@ transformHeader: function (kind) { |
@@ -10,4 +10,5 @@ 'use strict'; | ||
newLine: os.EOL, | ||
transformComment: function (file, line, text, kind) { | ||
transformComment: function (file, line, text, kind, ref) { | ||
//jshint unused:false | ||
if (ref) text = '@' + ref + ' ' + text; | ||
return ['| ' + file + ' | ' + line + ' | ' + text]; | ||
@@ -14,0 +15,0 @@ }, |
@@ -20,6 +20,10 @@ var table = require('text-table'); | ||
var t = table(todos.map(function (el, i) { | ||
var text = chalk.cyan(el.text); | ||
if (el.ref) { | ||
text = chalk.gray('@' + el.ref) + ' ' + text; | ||
} | ||
var line = ['', | ||
chalk.gray('line ' + el.line), | ||
chalk.green(el.kind), | ||
chalk.cyan(el.text) | ||
text | ||
]; | ||
@@ -26,0 +30,0 @@ if (el.file !== prevfile) { |
@@ -9,11 +9,12 @@ var DEFAULT_TAGS = ['todo', 'fixme']; | ||
return '\\s*@?(' + tags.join('|') + ')\\s*:?\\s*(.*?)\\s*'; | ||
return '\\s*@?(' + tags.join('|') + ')\\s*(?:\\(([^)]*)\\))?\\s*:?\\s*(.*?)\\s*\\s*(?:/(.*)\\s*)?'; | ||
} | ||
function prepareComment(match, line, file) { | ||
// match = [ <entire_match>, required <kind>, <text> ] | ||
// match = [<entire_match>, required <kind>, <reference>, <text>, <reference>] | ||
if (!match || !match[1]) { | ||
return null; | ||
} | ||
var text = match[2] || ''; | ||
var ref = match[2] || match[4] || ''; | ||
var text = match[3] || ''; | ||
return { | ||
@@ -24,2 +25,3 @@ file: file || 'unknown file', | ||
text: text.trim(), | ||
ref: ref.trim() | ||
}; | ||
@@ -26,0 +28,0 @@ } |
{ | ||
"name": "leasot", | ||
"description": "Parse and output TODOs and FIXMEs from comments in your files", | ||
"version": "3.2.2", | ||
"version": "4.0.1", | ||
"author": "Gilad Peleg <giladp007@gmail.com> (http://giladpeleg.com)", | ||
@@ -9,10 +9,10 @@ "bin": "./bin/leasot.js", | ||
"chalk": "^1.1.1", | ||
"commander": "^2.8.1", | ||
"commander": "^2.9.0", | ||
"get-line-from-pos": "^1.0.0", | ||
"get-stdin": "^5.0.0", | ||
"glob": "^5.0.14", | ||
"get-stdin": "^5.0.1", | ||
"glob": "^7.0.3", | ||
"json2xml": "^0.1.2", | ||
"lodash.compact": "^3.0.0", | ||
"lodash.defaults": "^3.1.2", | ||
"lodash.uniq": "^3.2.2", | ||
"lodash.compact": "^3.0.1", | ||
"lodash.defaults": "^4.0.1", | ||
"lodash.uniq": "^4.2.0", | ||
"log-symbols": "^1.0.2", | ||
@@ -23,4 +23,4 @@ "map-async": "^0.1.1", | ||
"devDependencies": { | ||
"mocha": "^2.3.3", | ||
"should": "^7.1.0" | ||
"mocha": "^3.0.2", | ||
"should": "^11.1.0" | ||
}, | ||
@@ -27,0 +27,0 @@ "engines": { |
@@ -26,2 +26,3 @@ ![leasot](media/leasot.png) | ||
- New extensions can be associated with bundled parsers as many languages have overlapping syntax | ||
- Supports both leading and trailing references. E.g. `// TODO(tregusti): Make this better` or `// TODO: Text /tregusti` | ||
@@ -46,3 +47,3 @@ ## Supported languages: | ||
| Hogan | `.hgn` `.hogan` | Supports `{{! }}` and `{{!-- --}}` | hbsParser | | ||
| Jade | `.jade` | Supports `//` and `//-` comments. | jadeParser | | ||
| Jade | `.jade` `.pug` | Supports `//` and `//-` comments. | jadeParser | | ||
| Javascript | `.js` `.es` `.es6` | Supports `// and /* */` comments | defaultParser | | ||
@@ -209,3 +210,4 @@ | Jsx | `.jsx` | Supports `// and /* */` comments. | defaultParser | | ||
kind: 'TODO', | ||
line: 8 | ||
line: 8, | ||
ref: 'reference' | ||
}] | ||
@@ -293,3 +295,3 @@ ``` | ||
### transformComment(file, line, text, kind) | ||
### transformComment(file, line, text, kind, ref) | ||
@@ -302,3 +304,3 @@ Control the output for each comment. | ||
```js | ||
transformComment: function (file, line, text, kind) { | ||
transformComment: function (file, line, text, kind, ref) { | ||
return ['| ' + file + ' | ' + line + ' | ' + text]; | ||
@@ -312,6 +314,8 @@ }, | ||
**text**: comment text | ||
**text**: comment text. Default ''. | ||
**kind**: will be be passed as the comment kind (todo/fixme). | ||
**ref**: a reference. Default ''. | ||
**Returns**: `String[]|String` | ||
@@ -318,0 +322,0 @@ |
45979
890
366
+ Addedfs.realpath@1.0.0(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedlodash.defaults@4.2.0(transitive)
+ Addedlodash.uniq@4.5.0(transitive)
- Removedglob@5.0.15(transitive)
- Removedlodash._baseassign@3.2.0(transitive)
- Removedlodash._basecallback@3.3.1(transitive)
- Removedlodash._basecopy@3.0.1(transitive)
- Removedlodash._baseindexof@3.1.0(transitive)
- Removedlodash._baseisequal@3.0.7(transitive)
- Removedlodash._baseuniq@3.0.3(transitive)
- Removedlodash._bindcallback@3.0.1(transitive)
- Removedlodash._cacheindexof@3.0.2(transitive)
- Removedlodash._createassigner@3.1.1(transitive)
- Removedlodash._createcache@3.1.2(transitive)
- Removedlodash._getnative@3.9.1(transitive)
- Removedlodash._isiterateecall@3.0.9(transitive)
- Removedlodash.assign@3.2.0(transitive)
- Removedlodash.defaults@3.1.2(transitive)
- Removedlodash.isarguments@3.1.0(transitive)
- Removedlodash.isarray@3.0.4(transitive)
- Removedlodash.istypedarray@3.0.6(transitive)
- Removedlodash.keys@3.1.2(transitive)
- Removedlodash.pairs@3.0.1(transitive)
- Removedlodash.restparam@3.6.1(transitive)
- Removedlodash.uniq@3.2.2(transitive)
Updatedcommander@^2.9.0
Updatedget-stdin@^5.0.1
Updatedglob@^7.0.3
Updatedlodash.compact@^3.0.1
Updatedlodash.defaults@^4.0.1
Updatedlodash.uniq@^4.2.0