Skip to content

Commit cdda438

Browse files
author
Arkadiy Tetelman
committed
Fix LintError parsing of new category
1 parent 6360c23 commit cdda438

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

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)