fix(dev-infra): clean up usages within pullapprove tooling (#37338)

Clean up pullapprove tooling to use newly created common utils.
Additionally, use newly created logging levels rather than
verbose flagging.

PR Close #37338
This commit is contained in:
Joey Perrott
2020-05-28 14:57:47 -07:00
committed by atscott
parent c8f7fc22c7
commit dffcca73e4
3 changed files with 32 additions and 40 deletions

View File

@ -10,15 +10,15 @@ import {info} from '../utils/console';
import {PullApproveGroupResult} from './group';
/** Create logs for each pullapprove group result. */
export function logGroup(group: PullApproveGroupResult, matched = true) {
export function logGroup(group: PullApproveGroupResult, matched = true, printMessageFn = info) {
const conditions = matched ? group.matchedConditions : group.unmatchedConditions;
info.group(`[${group.groupName}]`);
printMessageFn.group(`[${group.groupName}]`);
if (conditions.length) {
conditions.forEach(matcher => {
const count = matcher.matchedFiles.size;
info(`${count} ${count === 1 ? 'match' : 'matches'} - ${matcher.expression}`);
printMessageFn(`${count} ${count === 1 ? 'match' : 'matches'} - ${matcher.expression}`);
});
info.groupEnd();
printMessageFn.groupEnd();
}
}