From 5ab52706c1ef3673dc50462b527a5470e9ffb959 Mon Sep 17 00:00:00 2001 From: Collin Brown Date: Thu, 19 Oct 2023 17:02:14 +0000 Subject: [PATCH] tidy(octokit-checks): remove initializeChecker --- scanners/github-octokit-checks/index.js | 28 ++----------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/scanners/github-octokit-checks/index.js b/scanners/github-octokit-checks/index.js index 4175eac..ab80a6f 100644 --- a/scanners/github-octokit-checks/index.js +++ b/scanners/github-octokit-checks/index.js @@ -35,30 +35,6 @@ async function publish(subject, payload) { console.log(`Sent to ... ${subject}: `, payload) } -// Initialize Checkers //TODO - move to src??? -async function initializeChecker(checkName, repoName, OWNER, octokit, branchName='main') { - switch (checkName) { - case 'getRepoDetails': - return new GetRepoDetailsStrategy(repoName, OWNER, octokit, branchName) - case 'dependabot': - return new AutomatedSecurityFixesStrategy(repoName, OWNER, octokit, branchName) - case 'allLanguages': - return new ProgrammingLanguagesStrategy(repoName, OWNER, octokit, branchName) - case 'codeContributers': - return new CodeContributorsStrategy(repoName, OWNER, octokit, branchName) - case 'vunerabilityAlertsEnabled': - return new VunerabilityAlertsEnabledStrategy(repoName, OWNER, octokit, branchName) - case 'pullRequestProtection': - return new PullRequestProtectionStrategy(repoName, OWNER, octokit, branchName) - case 'branchProtection': - return new BranchProtectionStrategy(repoName, OWNER, octokit, branchName) - case 'allChecks': - return new AllChecksStrategy(repoName, OWNER, octokit, branchName) - default: - throw new Error(`Unknown checker: ${checkName}`) - } -} - process.on('SIGTERM', () => process.exit(0)) process.on('SIGINT', () => process.exit(0)) ;(async () => { @@ -76,8 +52,8 @@ process.on('SIGINT', () => process.exit(0)) // const checkName = 'allLanguages' // const checkName = 'getRepoDetails' const branchName = 'main' // TODO - come back for this after initial pass - when picked up by repodetails - const check = await initializeChecker(checkName, repoName, OWNER, octokit, branchName) - + const check = new AllChecksStrategy(repoName, OWNER, octokit, branchName); + const payload = await check.formatResponse(check) const subject = `${NATS_PUB_STREAM}.${checkName}.${repoName}`