in src/buildifier/buildifier.ts [221:241]
function shouldTreatBuildifierErrorAsSuccess(error: Error): boolean {
// Some of buildifier's exit codes represent states that we want to treat as
// "successful" (i.e., the file had warnings/errors but we want to render
// them), and other exit codes represent legitimate failures (like I/O
// errors). We have to treat them specifically; see the following section for
// the specific exit codes we handle (and make sure that this is updated if
// new failure modes are introduced in the future):
//
// tslint:disable-next-line:max-line-length
// https://github.com/bazelbuild/buildtools/blob/831e4632/buildifier/buildifier.go#L323-L331
const code = (error as any).code;
switch (code) {
case 1: // syntax errors in input
case 4: // check mode failed
return true;
case undefined: // some other type of error, assume it's severe
return false;
default:
return false;
}
}