mirror of
https://github.com/zhigang1992/firebase-tools.git
synced 2026-01-12 22:47:24 +08:00
Log warnings, fail on errors (#848)
This commit is contained in:
committed by
Michael Bleigh
parent
e51b1a7b54
commit
d2bb8a1bb9
@@ -93,11 +93,11 @@ RulesDeploy.prototype = {
|
||||
var self = this;
|
||||
return gcp.rules.testRuleset(self.options.project, files).then(function(response) {
|
||||
if (response.body && response.body.issues && response.body.issues.length > 0) {
|
||||
var add = response.body.issues.length === 1 ? "" : "s";
|
||||
var message = "Compilation error" + add + " in " + chalk.bold(filename) + ":\n";
|
||||
var warnings = [];
|
||||
var errors = [];
|
||||
response.body.issues.forEach(function(issue) {
|
||||
message +=
|
||||
"\n[" +
|
||||
var issueMessage =
|
||||
"[" +
|
||||
issue.severity.substring(0, 1) +
|
||||
"] " +
|
||||
issue.sourcePosition.line +
|
||||
@@ -105,9 +105,26 @@ RulesDeploy.prototype = {
|
||||
issue.sourcePosition.column +
|
||||
" - " +
|
||||
issue.description;
|
||||
|
||||
if (issue.severity === "ERROR") {
|
||||
errors.push(issueMessage);
|
||||
} else {
|
||||
warnings.push(issueMessage);
|
||||
}
|
||||
});
|
||||
|
||||
return utils.reject(message, { exit: 1 });
|
||||
if (warnings.length > 0) {
|
||||
warnings.forEach(function(warning) {
|
||||
utils.logWarning(warning);
|
||||
});
|
||||
}
|
||||
|
||||
if (errors.length > 0) {
|
||||
var add = errors.length === 1 ? "" : "s";
|
||||
var message =
|
||||
"Compilation error" + add + " in " + chalk.bold(filename) + ":\n" + errors.join("\n");
|
||||
return utils.reject(message, { exit: 1 });
|
||||
}
|
||||
}
|
||||
|
||||
utils.logSuccess(
|
||||
|
||||
Reference in New Issue
Block a user