dev-count-analysis.d.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { Contributor } from '../types';
  2. export declare const SERIOUS_DELIMITER = "_SNYK_SEPARATOR_";
  3. export declare const CONTRIBUTING_DEVELOPER_PERIOD_DAYS = 90;
  4. export declare const MAX_COMMITS_IN_GIT_LOG = 500;
  5. export declare function getContributors({ endDate, periodDays, repoPath }?: {
  6. endDate: Date;
  7. periodDays: number;
  8. repoPath: string;
  9. }): Promise<Contributor[]>;
  10. export declare class GitCommitInfo {
  11. authorEmail: string;
  12. commitTimestamp: string;
  13. constructor(authorEmail: string, commitTimestamp: string);
  14. }
  15. export declare class GitRepoCommitStats {
  16. commitInfos: GitCommitInfo[];
  17. constructor(commitInfos: GitCommitInfo[]);
  18. static empty(): GitRepoCommitStats;
  19. addCommitInfo(info: GitCommitInfo): void;
  20. getUniqueAuthorsCount(): number;
  21. getCommitsCount(): number;
  22. getUniqueAuthorEmails(): Set<string>;
  23. getRepoContributors(): Contributor[];
  24. getMostRecentCommitTimestamp(authorHashedEmail: string): string;
  25. }
  26. export declare function parseGitLogLine(logLine: string): GitCommitInfo;
  27. export declare function parseGitLog(gitLog: string): GitRepoCommitStats;
  28. /**
  29. * @returns time stamp in seconds-since-epoch of 90 days ago since 90 days is the "contributing devs" timeframe
  30. */
  31. export declare function getTimestampStartOfContributingDevTimeframe(dNow: Date, timespanInDays?: number): number;
  32. export declare function runGitLog(timestampEpochSecondsStartOfPeriod: number, timestampEpochSecondsEndOfPeriod: number, repoPath: string, fnShellout: (cmd: string, workingDirectory: string) => Promise<string>): Promise<string>;
  33. export declare function separateLines(inputText: string): string[];
  34. export declare function execShell(cmd: string, workingDirectory: string): Promise<string>;
  35. export declare class ShellOutError extends Error {
  36. innerError: Error | undefined;
  37. exitCode: number | undefined;
  38. stdout: string | undefined;
  39. stderr: string | undefined;
  40. constructor(message: string, exitCode: number | undefined, stdout: string, stderr: string, innerError: Error | undefined);
  41. }