import { Rule } from "../rule"; import { Context } from "../context"; import { Options } from "../options"; import { Client } from "../client"; export default class ApplicationName 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 applications = await client.listApplications(); for (const application of applications) { const name = application.displayName; if (name && !name.match(pattern)) { this.report(application, "applicationNameDoesNotMatchPattern", { name, pattern: pattern.toString() }); } } } }