diff --git a/src/cli/commands/monitor/index.ts b/src/cli/commands/monitor/index.ts index 00e2bd29b4..a85decc07f 100644 --- a/src/cli/commands/monitor/index.ts +++ b/src/cli/commands/monitor/index.ts @@ -13,7 +13,7 @@ import { MonitorResult, Options, PolicyOptions, - Contributors, + Contributor, } from '../../../lib/types'; import * as config from '../../../lib/config'; import * as detect from '../../../lib/detect'; @@ -93,7 +93,7 @@ async function monitor(...args0: MethodArgs): Promise { apiTokenExists(); - let contributors: Contributors[] = []; + let contributors: Contributor[] = []; if (!options.docker && analytics.allowAnalytics()) { try { const repoPath = process.cwd(); diff --git a/src/lib/monitor/dev-count-analysis.ts b/src/lib/monitor/dev-count-analysis.ts index 45f685d541..46eefbfb6e 100644 --- a/src/lib/monitor/dev-count-analysis.ts +++ b/src/lib/monitor/dev-count-analysis.ts @@ -8,6 +8,7 @@ */ import * as crypto from 'crypto'; import { exec } from 'child_process'; +import { Contributor } from '../types'; export const SERIOUS_DELIMITER = '_SNYK_SEPARATOR_'; export const CONTRIBUTING_DEVELOPER_PERIOD_DAYS = 90; @@ -60,9 +61,9 @@ export class GitRepoCommitStats { return uniqueAuthorHashedEmails; } - public getRepoContributors(): { userId: string; lastCommitDate: string }[] { + public getRepoContributors(): Contributor[] { const uniqueAuthorHashedEmails = this.getUniqueAuthorHashedEmails(); - const contributors: { userId: string; lastCommitDate: string }[] = []; + const contributors: Contributor[] = []; // for each uniqueAuthorHashedEmails, get the latest commit for (const nextUniqueAuthorHashedEmail of uniqueAuthorHashedEmails) { diff --git a/src/lib/monitor/index.ts b/src/lib/monitor/index.ts index 4c16cc8120..aa301d27af 100644 --- a/src/lib/monitor/index.ts +++ b/src/lib/monitor/index.ts @@ -17,7 +17,7 @@ import { PolicyOptions, MonitorOptions, Options, - Contributors, + Contributor, } from '../types'; import * as projectMetadata from '../project-metadata'; @@ -67,7 +67,7 @@ interface MonitorBody { target: {}; targetFileRelativePath: string; targetFile: string; - contributors?: Contributors[]; + contributors?: Contributor[]; } interface Meta { @@ -95,7 +95,7 @@ export async function monitor( options: Options & MonitorOptions & PolicyOptions, pluginMeta: PluginMetadata, targetFileRelativePath?: string, - contributors?: Contributors[], + contributors?: Contributor[], ): Promise { apiTokenExists(); @@ -162,7 +162,7 @@ async function monitorDepTree( pluginMeta: PluginMetadata, options: MonitorOptions & PolicyOptions, targetFileRelativePath?: string, - contributors?: Contributors[], + contributors?: Contributor[], ): Promise { let treeMissingDeps: string[] = []; @@ -351,7 +351,7 @@ export async function monitorDepGraph( pluginMeta: PluginMetadata, options: MonitorOptions & PolicyOptions, targetFileRelativePath?: string, - contributors?: Contributors[], + contributors?: Contributor[], ): Promise { const packageManager = meta.packageManager; analytics.add('monitorDepGraph', true); @@ -475,7 +475,7 @@ async function experimentalMonitorDepGraphFromDepTree( pluginMeta: PluginMetadata, options: MonitorOptions & PolicyOptions, targetFileRelativePath?: string, - contributors?: Contributors[], + contributors?: Contributor[], ): Promise { const packageManager = meta.packageManager; analytics.add('experimentalMonitorDepGraphFromDepTree', true); diff --git a/src/lib/types.ts b/src/lib/types.ts index c26b427b50..17515e8602 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -29,7 +29,7 @@ export interface WizardOptions { newPolicy: boolean; } -export interface Contributors { +export interface Contributor { userId: string; lastCommitDate: string; }