Big News: Socket Selected for OpenAI's Cybersecurity Grant Program.Details
Socket
Book a DemoSign in
Socket

leasot

Package Overview
Dependencies
Maintainers
1
Versions
124
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leasot - npm Package Compare versions

Comparing version
2.1.1
to
2.1.2
+49
lib/parsers/pythonParser.js
'use strict';
var regex = require('../regex');
var commentsRegex = new RegExp('^\\s*#' + regex + '$', 'mig');
var multiLineRegex = new RegExp('^\\s*"""' + regex + '"""$', 'mig');
module.exports = function (contents) {
var comments = [];
contents.split('\n').forEach(function (line, index) {
var hashMatch = commentsRegex.exec(line);
while (hashMatch) {
if (!hashMatch || !hashMatch.length) {
break;
}
//verify kind exists
if (!hashMatch[1]) {
break;
}
comments.push({
kind: hashMatch[1],
text: hashMatch[2].trim(),
line: index + 1
});
hashMatch = commentsRegex.exec(line);
}
var multiLineMatch = multiLineRegex.exec(line);
while (multiLineMatch) {
if (!multiLineMatch || !multiLineMatch.length) {
break;
}
//verify kind exists
if (!multiLineMatch[1]) {
break;
}
comments.push({
kind: multiLineMatch[1],
text: multiLineMatch[2].trim(),
line: index + 1
});
multiLineMatch = multiLineRegex.exec(line);
}
});
// sort by line number
comments = comments.sort(function (a, b) {
return a.line - b.line;
});
return comments;
};
+3
-0

@@ -70,2 +70,5 @@ 'use strict';

},
'.py': function () {
return require('./parsers/pythonParser');
},
};

@@ -72,0 +75,0 @@

+1
-1
{
"name": "leasot",
"description": "Parse and output TODOs and FIXMEs from comments in your files",
"version": "2.1.1",
"version": "2.1.2",
"author": "Gilad Peleg <giladp007@gmail.com> (http://giladpeleg.com)",

@@ -6,0 +6,0 @@ "bin": "./bin/leasot.js",

+24
-22

@@ -18,7 +18,8 @@ ![leasot](media/leasot.png)

- Spaces are optional
- Colon is optional
- Must be in a comment (line or block) in its' own line (`some code(); //TODO: do something` is not supported)
- Spaces are trimmed from comment text
- Supported types are `TODO` and `FIXME` - case insensitive
- Spaces are optional.
- Colon is optional.
- Must be in a comment (line or block) in its' own line (`some code(); //TODO: do something` is not supported).
- Can be prefixed with a @ (i.e @TODO).
- Spaces are trimmed around comment text.
- Supported types are `TODO` and `FIXME` - case insensitive.

@@ -29,18 +30,20 @@ ## Supported languages:

| ------------ | -------------------- | ------------------------------------------------|
| C# | `.cs` | using regex. Supports `// and /* */` comments. |
| C++/C | `.cpp` `.c` `.h` | using regex. Supports `// and /* */` comments. |
| Coffee-React | `.cjsx` | using regex. Supports `#` comments. |
| Coffeescript | `.coffee` | using regex. Supports `#` comments. |
| Go | `.go` | using regex. Supports `// and /* */` comments. |
| Handlebars | `.hbs` | using regex. Supports `{{! }}` and `{{!-- --}}` |
| Jade | `.jade` | using regex. |
| Javascript | `.js` | using regex. Supports `// and /* */` comments |
| Jsx | `.jsx` | using regex. Supports `// and /* */` comments. |
| Less | `.less` | using regex. Supports `// and /* */` comments. |
| Ruby | `.rb` | using regex. Supports `#` comments. |
| Sass | `.sass` `.scss` | using regex. Supports `// and /* */` comments. |
| Shell | `.sh` `.zsh` `.bash` | using regex. Supports `#` comments. |
| Stylus | `.styl` | using regex. Supports `// and /* */` comments. |
| Twig | `.twig` | using regex. Supports `{# #}` and `<!-- -->` |
| Typescript | `.ts` | using regex. Supports `// and /* */` comments. |
| C# | `.cs` | Using regex. Supports `// and /* */` comments. |
| C++/C | `.cpp` `.c` `.h` | Using regex. Supports `// and /* */` comments. |
| Coffee-React | `.cjsx` | Using regex. Supports `#` comments. |
| Coffeescript | `.coffee` | Using regex. Supports `#` comments. |
| Go | `.go` | Using regex. Supports `// and /* */` comments. |
| Handlebars | `.hbs` | Using regex. Supports `{{! }}` and `{{!-- --}}` |
| Jade | `.jade` | Using regex. Supports `//` and `//-` comments. |
| Javascript | `.js` | Using regex. Supports `// and /* */` comments |
| Jsx | `.jsx` | Using regex. Supports `// and /* */` comments. |
| Less | `.less` | Using regex. Supports `// and /* */` comments. |
| PHP | `.php` | Using regex. Supports `// and /* */` comments. |
| Python | `.py` | Using regex. Supports `"""` and `#` comments. |
| Ruby | `.rb` | Using regex. Supports `#` comments. |
| Sass | `.sass` `.scss` | Using regex. Supports `// and /* */` comments. |
| Shell | `.sh` `.zsh` `.bash` | Using regex. Supports `#` comments. |
| Stylus | `.styl` | Using regex. Supports `// and /* */` comments. |
| Twig | `.twig` | Using regex. Supports `{# #}` and `<!-- -->` |
| Typescript | `.ts` | Using regex. Supports `// and /* */` comments. |

@@ -123,3 +126,2 @@ Javascript is the default parser.

## API

@@ -126,0 +128,0 @@