Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
files.forEach(function( filepath ) {
var file = grunt.file.read( filepath ),
message = "Linting " + filepath + "...",
result;
// skip empty files
if (file.length) {
result = csslint.verify( file, ruleset );
verbose.write( message );
if (result.messages.length) {
verbose.or.write( message );
grunt.log.error();
} else {
verbose.ok();
}
result.messages.forEach(function( message ) {
grunt.log.writeln( "[".red + (typeof message.line !== "undefined" ? ( "L" + message.line ).yellow + ":".red + ( "C" + message.col ).yellow : "GENERAL".yellow) + "]".red );
grunt.log[ message.type === "error" ? "error" : "writeln" ]( message.message + " " + message.rule.desc + " (" + message.rule.id + ")" );
});
if ( result.messages.length ) {
hadErrors += 1;
}
} else {
files.forEach(function( filepath ) {
var file = grunt.file.read( filepath ),
message = "Linting " + filepath + "...",
result;
// skip empty files
if (file.length) {
result = csslint.verify( file, ruleset );
verbose.write( message );
if (result.messages.length) {
verbose.or.write( message );
grunt.log.error();
} else {
verbose.ok();
}
result.messages.forEach(function( message ) {
grunt.log.writeln( "[".red + (typeof message.line !== "undefined" ? ( "L" + message.line ).yellow + ":".red + ( "C" + message.col ).yellow : "GENERAL".yellow) + "]".red );
grunt.log[ message.type === "error" ? "error" : "writeln" ]( message.message + " " + message.rule.desc + " (" + message.rule.id + ")" );
});
if ( result.messages.length ) {
hadErrors += 1;
}
} else {
this.filesSrc.forEach(function(filepath) {
var file = grunt.file.read(filepath),
message = 'Linting ' + chalk.cyan(filepath) + '...',
result;
// skip empty files
if (file.length) {
result = csslint.verify(file, ruleset);
verbose.write(message);
if (result.messages.length) {
verbose.or.write(message);
grunt.log.error();
} else {
verbose.ok();
}
// store combined result for later use with formatters
combinedResult[filepath] = result;
result.messages.forEach(function(message) {
var offenderMessage;
if (message.line !== 'undefined') {
offenderMessage =
chalk.yellow('L' + message.line) +
module.exports = function(hack){
if (hack.language === 'css' && !hack.safe){
var result = csslint.verify(hack.test);
var filterdMessages = result.messages.filter(function(v){ // filter for real errors!
return v.type === 'error';
});
if (filterdMessages.length > 0){
hack.safe = false;
hack.csslint = filterdMessages[0].message;
} else {
hack.safe = true;
}
}
};
module.exports = function(hack){
if (hack.language === 'css' && !hack.safe){
var result = [],
filterdMessages = [];
for(var i = 0; i < hack.test.length; i++) {
result[i] = csslint.verify(hack.test[i]);
/*if(result[i].messages.filter === 'error') {
filterdMessages[i] = result[i];
}*/
}
/*
filterdMessages = result.messages.filter(function(v){ // filter for real errors!
return v.type === 'error';
});
*/
if (filterdMessages.length > 0){
hack.safe = false;
// hack.csslint = filterdMessages[0].message;
} else {
hack.safe = true;
}
var callback = function (loaderErr, loaderResult) {
var result = CSSLint.verify(loaderResult);
_.each(_.map(result.messages, 'type'), function(errTy) {
assert.notEqual(errTy, "error");
});
done();
};
this.hintCSS = function(file, options){
var content = fileutil.read(file);
var results = CSSLint.verify(content);
var messages = results.messages;
if (!messages.length) {
return console.log('[Perfect] %s', file);
}
for (var i = 0, len = messages.length; i < len; i++) {
console.log(' ' + messages[i].message +
' (line ' + messages[i].line + ', col ' + messages[i].col + ')', messages[i].type);
}
}
var checkFile = exports.checkFile = function(file){
var content = fs.readFileSync(file, 'utf-8');
var results = CSSLint.verify(content);
messages = results.messages;
if (messages.length) {
console.log("# " + file);
}
for (i = 0, len = messages.length; i < len; i++) {
console.log(" " + messages[i].message + " (line " + messages[i].line + ", col " + messages[i].col + ")", messages[i].type);
}
}
/**
fs.readFile(o.sourceFile, encoding, function(err, data) {
if (err) {
callback(err);
} else {
data = data.toString(encoding);
result = csslint.verify(data, opts);
callback(false, result);
}
});
} else {
fs.readFile(o.sourceFile, encoding, function(err, data) {
if (err) {
callback(err);
} else {
data = data.toString(encoding);
result = csslint.verify(data, opts);
callback(false, result);
}
});
} else {