Skip to content

Commit e25c19b

Browse files
committed
changed tab size to 4
1 parent c03f662 commit e25c19b

File tree

2 files changed

+101
-101
lines changed

2 files changed

+101
-101
lines changed

index.js

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -17,65 +17,65 @@ var bootlint = require('bootlint');
1717
var PLUGIN_NAME = 'gulp-bootlint';
1818

1919
function gulpBootlint(options) {
20-
options = options || {
21-
disabledIds: []
22-
};
23-
var hasError = false;
20+
options = options || {
21+
disabledIds: []
22+
};
23+
var hasError = false;
2424

25-
// creating a stream through which each file will pass
26-
var stream = through.obj(function (file, enc, cb) {
27-
var errorCount = 0;
25+
// creating a stream through which each file will pass
26+
var stream = through.obj(function (file, enc, cb) {
27+
var errorCount = 0;
2828

29-
if (file.isNull()) {
30-
return cb(null, file);
31-
}
29+
if (file.isNull()) {
30+
return cb(null, file);
31+
}
3232

33-
if (file.isStream()) {
34-
this.emit('error', new PluginError(PLUGIN_NAME, 'Streams are not supported!'));
35-
return cb();
36-
}
33+
if (file.isStream()) {
34+
this.emit('error', new PluginError(PLUGIN_NAME, 'Streams are not supported!'));
35+
return cb();
36+
}
3737

38-
var reporter = function (lint) {
39-
var lintId = (lint.id[0] === 'E') ? chalk.bgRed.white(lint.id) : chalk.bgYellow.white(lint.id),
40-
errorElementsAvailable = false;
38+
var reporter = function (lint) {
39+
var lintId = (lint.id[0] === 'E') ? chalk.bgRed.white(lint.id) : chalk.bgYellow.white(lint.id),
40+
errorElementsAvailable = false;
4141

42-
if (lint.elements) {
43-
lint.elements.each(function (_, element) {
44-
var errorLocation = element.startLocation;
45-
gutil.log(file.path + ":" + (errorLocation.line + 1) + ":" + (errorLocation.column + 1), lintId, lint.message);
46-
errorElementsAvailable = true;
47-
});
48-
}
49-
if (!errorElementsAvailable) {
50-
gutil.log(file.path + ":", lintId, lint.message);
51-
}
42+
if (lint.elements) {
43+
lint.elements.each(function (_, element) {
44+
var errorLocation = element.startLocation;
45+
gutil.log(file.path + ":" + (errorLocation.line + 1) + ":" + (errorLocation.column + 1), lintId, lint.message);
46+
errorElementsAvailable = true;
47+
});
48+
}
49+
if (!errorElementsAvailable) {
50+
gutil.log(file.path + ":", lintId, lint.message);
51+
}
5252

53-
++errorCount;
54-
hasError = true;
55-
file.bootlint.success = false;
56-
file.bootlint.issues.push(lint);
57-
};
53+
++errorCount;
54+
hasError = true;
55+
file.bootlint.success = false;
56+
file.bootlint.issues.push(lint);
57+
};
5858

59-
gutil.log(chalk.gray('Linting file ' + file.path));
60-
file.bootlint = { success: true, issues: [] };
61-
bootlint.lintHtml(file.contents.toString(), reporter, options.disabledIds);
59+
gutil.log(chalk.gray('Linting file ' + file.path));
60+
file.bootlint = { success: true, issues: [] };
61+
bootlint.lintHtml(file.contents.toString(), reporter, options.disabledIds);
6262

63-
if(errorCount > 0) {
64-
gutil.log(chalk.red(errorCount + ' lint error(s) found in file ' + file.path));
65-
} else {
66-
gutil.log(chalk.green(file.path + ' is lint free!'));
67-
}
63+
if(errorCount > 0) {
64+
gutil.log(chalk.red(errorCount + ' lint error(s) found in file ' + file.path));
65+
} else {
66+
gutil.log(chalk.green(file.path + ' is lint free!'));
67+
}
6868

69-
return cb(null, file);
70-
}, function(cb) {
71-
if(hasError) {
72-
this.emit('error', new PluginError(PLUGIN_NAME, 'Lint errors found!'));
73-
}
69+
return cb(null, file);
70+
}, function(cb) {
71+
if(hasError) {
72+
this.emit('error', new PluginError(PLUGIN_NAME, 'Lint errors found!'));
73+
}
7474

75-
return cb();
76-
});
75+
return cb();
76+
});
7777

78-
return stream;
78+
return stream;
7979
};
8080

8181
// exporting the plugin

test/test.js

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -13,67 +13,67 @@ var fs = require('fs');
1313
var path = require('path');
1414

1515
var getFile = function(filePath) {
16-
var fullFilePath = './test/' + filePath;
17-
return new gutil.File({
18-
path: fullFilePath,
19-
cwd: './test/',
20-
base: path.dirname(fullFilePath),
21-
contents: fs.readFileSync(fullFilePath)
22-
});
16+
var fullFilePath = './test/' + filePath;
17+
return new gutil.File({
18+
path: fullFilePath,
19+
cwd: './test/',
20+
base: path.dirname(fullFilePath),
21+
contents: fs.readFileSync(fullFilePath)
22+
});
2323
};
2424

2525
describe('gulp-bootlint', function() {
26-
describe('bootlintPlugin', function() {
27-
it('should pass file through', function(done) {
28-
var file = getFile('fixtures/valid-bootstrap.html'),
29-
stream = bootlintPlugin(),
30-
fileCount = 0;
26+
describe('bootlintPlugin', function() {
27+
it('should pass file through', function(done) {
28+
var file = getFile('fixtures/valid-bootstrap.html'),
29+
stream = bootlintPlugin(),
30+
fileCount = 0;
3131

32-
stream.on('data', function(file) {
33-
should.exist(file);
34-
should.exist(file.path);
35-
should.exist(file.relative);
36-
should.exist(file.contents);
37-
should.exist(file.bootlint);
38-
should.equal(file.bootlint.success, true);
39-
file.path.should.equal('./test/fixtures/valid-bootstrap.html');
40-
file.relative.should.equal('valid-bootstrap.html');
41-
++fileCount;
42-
});
32+
stream.on('data', function(file) {
33+
should.exist(file);
34+
should.exist(file.path);
35+
should.exist(file.relative);
36+
should.exist(file.contents);
37+
should.exist(file.bootlint);
38+
should.equal(file.bootlint.success, true);
39+
file.path.should.equal('./test/fixtures/valid-bootstrap.html');
40+
file.relative.should.equal('valid-bootstrap.html');
41+
++fileCount;
42+
});
4343

44-
stream.once('end', function() {
45-
fileCount.should.equal(1);
46-
done();
47-
});
44+
stream.once('end', function() {
45+
fileCount.should.equal(1);
46+
done();
47+
});
4848

49-
stream.write(file);
50-
stream.end();
51-
});
49+
stream.write(file);
50+
stream.end();
51+
});
5252

53-
it('should send failure status', function(done) {
54-
var file = getFile('fixtures/invalid-bootstrap.html'),
55-
stream = bootlintPlugin(),
56-
fileCount = 0;
53+
it('should send failure status', function(done) {
54+
var file = getFile('fixtures/invalid-bootstrap.html'),
55+
stream = bootlintPlugin(),
56+
fileCount = 0;
5757

58-
stream.on('data', function(file) {
59-
++fileCount;
60-
should.exist(file.bootlint);
61-
should.exist(file.bootlint.success);
62-
file.bootlint.success.should.equal(false);
63-
should.exist(file.bootlint.issues);
64-
file.bootlint.issues.length.should.equal(1);
65-
file.bootlint.issues[0].id.should.equal('W009');
66-
});
67-
stream.on('error', function( err ) {
68-
err.message.should.equal('Lint errors found!');
69-
});
70-
stream.once('end', function() {
71-
fileCount.should.equal(1);
72-
done();
73-
});
58+
stream.on('data', function(file) {
59+
++fileCount;
60+
should.exist(file.bootlint);
61+
should.exist(file.bootlint.success);
62+
file.bootlint.success.should.equal(false);
63+
should.exist(file.bootlint.issues);
64+
file.bootlint.issues.length.should.equal(1);
65+
file.bootlint.issues[0].id.should.equal('W009');
66+
});
67+
stream.on('error', function( err ) {
68+
err.message.should.equal('Lint errors found!');
69+
});
70+
stream.once('end', function() {
71+
fileCount.should.equal(1);
72+
done();
73+
});
7474

75-
stream.write(file);
76-
stream.end();
75+
stream.write(file);
76+
stream.end();
77+
});
7778
});
78-
})
7979
});

0 commit comments

Comments
 (0)