import { Rule } from "../rule"; import { Context } from "../context"; import { Options } from "../options"; import { Client } from "../client"; export default class GroupName extends Rule { private readonly pattern: string; constructor(context: Context, options: Options) { super(context, options); this.pattern = options.string("pattern"); } async run(client: Client): Promise { const pattern = new RegExp(`^${this.pattern}$`); const groups = await client.listGroups(); for (const group of groups) { const name = group.displayName; if (name && !name.match(pattern)) { this.report(group, "groupNameDoesNotMatchPattern", { name, pattern: pattern.toString() }); } } } }