Skip to content

Commit

Permalink
fix: refactor Contributors type naming
Browse files Browse the repository at this point in the history
  • Loading branch information
maxjeffos committed Sep 18, 2020
1 parent 0a0193f commit 026436d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/cli/commands/monitor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -93,7 +93,7 @@ async function monitor(...args0: MethodArgs): Promise<any> {

apiTokenExists();

let contributors: Contributors[] = [];
let contributors: Contributor[] = [];
if (!options.docker && analytics.allowAnalytics()) {
try {
const repoPath = process.cwd();
Expand Down
5 changes: 3 additions & 2 deletions src/lib/monitor/dev-count-analysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
12 changes: 6 additions & 6 deletions src/lib/monitor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
PolicyOptions,
MonitorOptions,
Options,
Contributors,
Contributor,
} from '../types';
import * as projectMetadata from '../project-metadata';

Expand Down Expand Up @@ -67,7 +67,7 @@ interface MonitorBody {
target: {};
targetFileRelativePath: string;
targetFile: string;
contributors?: Contributors[];
contributors?: Contributor[];
}

interface Meta {
Expand Down Expand Up @@ -95,7 +95,7 @@ export async function monitor(
options: Options & MonitorOptions & PolicyOptions,
pluginMeta: PluginMetadata,
targetFileRelativePath?: string,
contributors?: Contributors[],
contributors?: Contributor[],
): Promise<MonitorResult> {
apiTokenExists();

Expand Down Expand Up @@ -162,7 +162,7 @@ async function monitorDepTree(
pluginMeta: PluginMetadata,
options: MonitorOptions & PolicyOptions,
targetFileRelativePath?: string,
contributors?: Contributors[],
contributors?: Contributor[],
): Promise<MonitorResult> {
let treeMissingDeps: string[] = [];

Expand Down Expand Up @@ -351,7 +351,7 @@ export async function monitorDepGraph(
pluginMeta: PluginMetadata,
options: MonitorOptions & PolicyOptions,
targetFileRelativePath?: string,
contributors?: Contributors[],
contributors?: Contributor[],
): Promise<MonitorResult> {
const packageManager = meta.packageManager;
analytics.add('monitorDepGraph', true);
Expand Down Expand Up @@ -475,7 +475,7 @@ async function experimentalMonitorDepGraphFromDepTree(
pluginMeta: PluginMetadata,
options: MonitorOptions & PolicyOptions,
targetFileRelativePath?: string,
contributors?: Contributors[],
contributors?: Contributor[],
): Promise<MonitorResult> {
const packageManager = meta.packageManager;
analytics.add('experimentalMonitorDepGraphFromDepTree', true);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export interface WizardOptions {
newPolicy: boolean;
}

export interface Contributors {
export interface Contributor {
userId: string;
lastCommitDate: string;
}
Expand Down

0 comments on commit 026436d

Please sign in to comment.