Skip to content

Commit eafcb97

Browse files
Merge pull request #8 from arkadiyt/at-lint-error
Fix LintError parsing of new category
2 parents 6360c23 + a2fab21 commit eafcb97

File tree

3 files changed

+33
-7
lines changed

3 files changed

+33
-7
lines changed

lib/filters.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ var extend = require('./extend.js');
99
var defaults = {
1010
'build': {
1111
'class': true,
12+
'c++11': true,
1213
'deprecated': true,
1314
'endif_comment': true,
1415
'explicit_make_pair': true,
@@ -27,6 +28,7 @@ var defaults = {
2728
'copyright': true
2829
},
2930
'readability': {
31+
'alt_tokens': true,
3032
'braces': true,
3133
'casting': true,
3234
'check': true,
@@ -36,6 +38,7 @@ var defaults = {
3638
'multiline_comment': true,
3739
'multiline_string': true,
3840
'nolint': true,
41+
'nul': true,
3942
'streams': true,
4043
'todo': true,
4144
'utf8': true
@@ -53,21 +56,20 @@ var defaults = {
5356
'printf': true,
5457
'printf_format': true,
5558
'references': true,
56-
'rtti': true,
57-
'sizeof': true,
5859
'string': true,
5960
'threadsafe_fn': true,
60-
'virtual': true
61+
'vlog': true
6162
},
6263
'whitespace': {
6364
'blank_line': true,
6465
'braces': true,
6566
'comma': true,
6667
'comments': true,
68+
'empty_conditional_body': true,
69+
'empty_loop_body': true,
6770
'end_of_line': true,
6871
'ending_newline': true,
6972
'indent': true,
70-
'labels': true,
7173
'line_length': true,
7274
'newline': true,
7375
'operators': true,
@@ -113,7 +115,6 @@ function parse(str) {
113115
return result;
114116
}
115117

116-
117118
module.exports = {
118119
'defaults': defaults,
119120
'parse': parse

lib/lint-error.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var path = require('path');
77
var extend = require('./extend.js');
88

99
// [whitespace/blank_line] [3]
10-
var category = /\[([a-z]+)\/([a-z_]+)\] \[([1-5])\]/i;
10+
var category = /\[([a-z]+)\/([a-z0-9_+]+)\] \[([1-5])\]/i;
1111

1212
function LintError(line) {
1313
if (!line) {

test/lint-error.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,33 @@ suite.addBatch({
214214
'should have correct level': function (err, lintError) {
215215
assert.equal(lintError.level, '5');
216216
}
217-
}
217+
},
218218

219+
'build/c++11 (5)': {
220+
topic: function () {
221+
var error = new LintError('src/channel.cpp:1: <future> is an unapproved C++11 header. [build/c++11] [5]');
222+
this.callback(null, error);
223+
},
224+
'should have correct filename': function (err, lintError) {
225+
assert.equal(lintError.file, 'src/channel.cpp');
226+
},
227+
'should have correct line number': function (err, lintError) {
228+
assert.equal(lintError.linenumber, '1');
229+
},
230+
'should have correct reason': function (err, lintError) {
231+
console.log(lintError);
232+
assert.equal(lintError.reason, '<future> is an unapproved C++11 header.');
233+
},
234+
'should have correct category': function (err, lintError) {
235+
assert.equal(lintError.category, 'build');
236+
},
237+
'should have correct sub-category': function (err, lintError) {
238+
assert.equal(lintError.sub_category, 'c++11');
239+
},
240+
'should have correct level': function (err, lintError) {
241+
assert.equal(lintError.level, '5');
242+
}
243+
}
219244
});
220245

221246
suite.export(module);

0 commit comments

Comments
 (0)