refactor(dev-infra): fix lint warnings for Pullapprove-related scripts (#36287)

The `dev-infra` scripts were added to the list of sources that should be verified with clang (b07b6edc2a), but the Pullapprove-related scripts that were merged before (83e4a76afa) doesn't pass these checks. This commit updates a couple scripts to have a proper formatting.

PR Close #36287
This commit is contained in:
Andrew Kushnir 2020-03-27 18:14:52 -07:00 committed by Igor Minar
parent 5cee709266
commit c94a33c525
2 changed files with 13 additions and 8 deletions

View File

@ -72,13 +72,17 @@ export class PullApproveGroup {
} else if (condition.match(CONDITION_TYPES.ATTR_LENGTH)) { } else if (condition.match(CONDITION_TYPES.ATTR_LENGTH)) {
// Currently a noop as we do not take any action on this condition type. // Currently a noop as we do not take any action on this condition type.
} else { } else {
const errMessage = `Unrecognized condition found, unable to parse the following condition: \n\n` + const errMessage =
`From the [${groupName}] group:\n` + `Unrecognized condition found, unable to parse the following condition: \n\n` +
` - ${condition}` + `From the [${groupName}] group:\n` +
`\n\n` + ` - ${condition}` +
`Known condition regexs:\n` + `\n\n` +
`${Object.entries(CONDITION_TYPES).map(([k, v]) => ` ${k} - ${v}`).join('\n')}` + `Known condition regexs:\n` +
`\n\n`; `${Object.entries(CONDITION_TYPES).map(([k, v]) => ` ${k} - $ {
v
}
`).join('\n')}` +
`\n\n`;
console.error(errMessage); console.error(errMessage);
process.exit(1); process.exit(1);
} }

View File

@ -9,10 +9,11 @@ import {readFileSync} from 'fs';
import * as path from 'path'; import * as path from 'path';
import {cd, exec, set} from 'shelljs'; import {cd, exec, set} from 'shelljs';
import {getRepoBaseDir} from '../utils/config';
import {PullApproveGroup} from './group'; import {PullApproveGroup} from './group';
import {logGroup, logHeader} from './logging'; import {logGroup, logHeader} from './logging';
import {parsePullApproveYaml} from './parse-yaml'; import {parsePullApproveYaml} from './parse-yaml';
import {getRepoBaseDir} from '../utils/config';
export function verify() { export function verify() {
// Exit early on shelljs errors // Exit early on shelljs errors