Skip to content

Commit 719bc46

Browse files
committed
Exposed the extensions argument in the cli
1 parent c60d899 commit 719bc46

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

lib/cli.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ var cli = commander
1212
.option('-v, --verbose [verbosity]', 'Set the verbosity level', Number, 1)
1313
.option('-r, --reporter [reporter]', 'Set the reporter', String, 'spec')
1414
.option('-filters, --filters [filters]', 'Set a list of ignored errors')
15+
.option('-extensions, --extensions [extensions]', 'Set The allowed file extensions that cpplint will check')
1516
.parse(process.argv);
1617

1718
var options = {};
@@ -38,6 +39,11 @@ if (cli.filters) {
3839
options.filters = filters.parse(cli.filters);
3940
}
4041

42+
// set the ignored errors
43+
if (cli.extensions) {
44+
options.extensions = cli.extensions;
45+
}
46+
4147
// set the remainging options (assume they're files and we should lint them)
4248
options.files = cli.args;
4349

lib/make-args.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ function counting(type) {
2626
return '--counting=' + type;
2727
}
2828

29+
/**
30+
* Get the cpplint `extensions` argument
31+
*
32+
* @param {String} type
33+
* @return {String}
34+
*/
35+
function extensions(exts) {
36+
return '--extensions=' + exts;
37+
}
38+
2939
/**
3040
* Get the cpplint `filter` argument
3141
*
@@ -109,6 +119,11 @@ function makeArgs(conf, next) {
109119
args.push(filter(conf.filters));
110120
}
111121

122+
if (conf.extensions) {
123+
// set filters
124+
args.push(extensions(conf.extensions));
125+
}
126+
112127
// set files
113128
args.push(conf.files.join(' '));
114129

@@ -123,5 +138,6 @@ module.exports = {
123138
'makeArgs': makeArgs,
124139
'filter': filter,
125140
'counting': counting,
126-
'verbosity': verbosity
141+
'verbosity': verbosity,
142+
'extensions': extensions
127143
};

lib/parse-output.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ var expressions = {
77
// Done processing /Users/stephenmathieson/work/node-cpplint/test/fixtures/somefile.cc
88
'done': {
99
'is': /Done processing [\/a-z\-\_\.\d]+/i,
10-
'file': / ([\/a-z\-\_\.\d]+)$/i
10+
'file': / ([\/a-z\-\_\.\d\+]+)$/i
1111
},
1212
// /Users/stephenmathieson/work/node-cpplint/test/fixtures/somefile.cc:302: Blank line at the end of a code block. Is this needed? [whitespace/blank_line] [3]
1313
'error': {
14-
'is': /[\/a-z-_\.]+\:[\d]+\:[ ]{2}.*\[[1-5]\]/i
14+
'is': /[\/a-z-_\.\+]+\:[\d]+\:[ ]{2}.*\[[1-5]\]/i
1515
}
1616
};
1717

0 commit comments

Comments
 (0)