Skip to content

Commit f7d5e1c

Browse files
committed
Formatting and style changes
1 parent 8a6dee8 commit f7d5e1c

File tree

1 file changed

+26
-19
lines changed

1 file changed

+26
-19
lines changed

index.js

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var formatOutput = function(report, file, options) {
3333
};
3434

3535
var cssLintPlugin = function(options) {
36-
if (!options) options = {};
36+
options = options || {};
3737

3838
var ruleset = {};
3939

@@ -76,12 +76,15 @@ var cssLintPlugin = function(options) {
7676
};
7777

7878
cssLintPlugin.reporter = function(customReporter) {
79-
var reporter = csslint.getFormatter('text'), builtInReporter = true, output;
79+
var reporter = csslint.getFormatter('text');
80+
var builtInReporter = true;
81+
var output;
8082

8183
if (typeof customReporter === 'function') {
8284
reporter = customReporter;
8385
builtInReporter = false;
84-
} else if (typeof customReporter === 'string') {
86+
}
87+
else if (typeof customReporter === 'string') {
8588
if (customReporter === 'fail') {
8689
return cssLintPlugin.failReporter();
8790
}
@@ -97,26 +100,30 @@ cssLintPlugin.reporter = function(customReporter) {
97100
output = reporter.startFormat();
98101
}
99102

100-
return through.obj(function(file, enc, cb) {
101-
// Only report if CSSLint was ran and errors were found
102-
if (file.csslint && !file.csslint.success) {
103-
if (builtInReporter) {
104-
output += reporter.formatResults(file.csslint.originalReport, file.path);
105-
} else {
106-
reporter(file);
103+
return through.obj(
104+
function(file, enc, cb) {
105+
// Only report if CSSLint was ran and errors were found
106+
if (file.csslint && !file.csslint.success) {
107+
if (builtInReporter) {
108+
output += reporter.formatResults(file.csslint.originalReport, file.path);
109+
}
110+
else {
111+
reporter(file);
112+
}
107113
}
108-
}
109114

110-
return cb(null, file);
111-
}, function(cb) {
112-
if (builtInReporter) {
113-
output += reporter.endFormat();
115+
return cb(null, file);
116+
},
117+
function(cb) {
118+
if (builtInReporter) {
119+
output += reporter.endFormat();
114120

115-
gutil.log(output);
116-
}
121+
gutil.log(output);
122+
}
117123

118-
return cb();
119-
});
124+
return cb();
125+
}
126+
);
120127
};
121128

122129
cssLintPlugin.addRule = function(rule) {

0 commit comments

Comments
 (0)