From c8c2f0913bd5adf99bd84d8847eb4381104c4859 Mon Sep 17 00:00:00 2001 From: Adela Homolova Date: Mon, 25 Nov 2019 12:59:23 +0100 Subject: [PATCH] fix: rename CVS to VCS --- src/inspectors/CollaborationInspector.ts | 6 +++--- src/inspectors/IssueTrackingInspector.ts | 6 +++--- src/model.ts | 3 +-- src/services/git/CSVServicesUtils.ts | 10 +++++----- src/services/git/Git.ts | 6 +++--- src/services/git/GitHubService.ts | 9 ++++----- src/services/git/ICVSService.ts | 4 ++-- 7 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/inspectors/CollaborationInspector.ts b/src/inspectors/CollaborationInspector.ts index c29b05910..f21554bf9 100644 --- a/src/inspectors/CollaborationInspector.ts +++ b/src/inspectors/CollaborationInspector.ts @@ -2,13 +2,13 @@ import { inject, injectable } from 'inversify'; import { Types } from '../types'; import { ListGetterOptions } from './common/ListGetterOptions'; import { ICollaborationInspector, PullRequestState } from './ICollaborationInspector'; -import { CSVService } from '../model'; +import { VCSService } from '../model'; @injectable() export class CollaborationInspector implements ICollaborationInspector { - private service: CSVService; + private service: VCSService; - constructor(@inject(Types.IContentRepositoryBrowser) service: CSVService) { + constructor(@inject(Types.IContentRepositoryBrowser) service: VCSService) { this.service = service; } diff --git a/src/inspectors/IssueTrackingInspector.ts b/src/inspectors/IssueTrackingInspector.ts index b58ff6aae..998832bd5 100644 --- a/src/inspectors/IssueTrackingInspector.ts +++ b/src/inspectors/IssueTrackingInspector.ts @@ -4,13 +4,13 @@ import { IIssueTrackingInspector } from './IIssueTrackingInspector'; import { Paginated } from './common/Paginated'; import { Issue, IssueComment } from '../services/git/model'; import { Types } from '../types'; -import { CSVService } from '../model'; +import { VCSService } from '../model'; @injectable() export class IssueTrackingInspector implements IIssueTrackingInspector { - private service: CSVService; + private service: VCSService; - constructor(@inject(Types.IContentRepositoryBrowser) service: CSVService) { + constructor(@inject(Types.IContentRepositoryBrowser) service: VCSService) { this.service = service; } diff --git a/src/model.ts b/src/model.ts index 806f575c4..c408821b1 100644 --- a/src/model.ts +++ b/src/model.ts @@ -1,6 +1,5 @@ -import { GitHubService } from './services/git/GitHubService'; import { BitbucketService } from './services/bitbucket/BitbucketService'; -import { CSVServicesUtils } from './services/git/CSVServicesUtils'; +import { GitHubService } from './services/git/GitHubService'; // New model starts here diff --git a/src/services/git/CSVServicesUtils.ts b/src/services/git/CSVServicesUtils.ts index 4f73e4f55..8d7f3ece9 100644 --- a/src/services/git/CSVServicesUtils.ts +++ b/src/services/git/CSVServicesUtils.ts @@ -1,13 +1,13 @@ import { PullRequestState } from '../../inspectors/ICollaborationInspector'; -import { BitbucketPullRequestState, CSVService } from './ICVSService'; +import { BitbucketPullRequestState, VCSService } from './ICVSService'; import { GitHubPullRequestState } from './IGitHubService'; -export class CSVServicesUtils { +export class VCSServicesUtils { static getPRState = ( state: PullRequestState | undefined, - service: CSVService, + service: VCSService, ): GitHubPullRequestState | BitbucketPullRequestState | undefined => { - if (service === CSVService.github) { + if (service === VCSService.github) { switch (state) { case PullRequestState.open: return GitHubPullRequestState.open; @@ -20,7 +20,7 @@ export class CSVServicesUtils { } } - if (service === CSVService.bitbucket) { + if (service === VCSService.bitbucket) { switch (state) { case PullRequestState.open: return BitbucketPullRequestState.open; diff --git a/src/services/git/Git.ts b/src/services/git/Git.ts index 4518bb5fd..bdb78dbb0 100644 --- a/src/services/git/Git.ts +++ b/src/services/git/Git.ts @@ -3,7 +3,7 @@ import * as nodePath from 'path'; import { isArray } from 'util'; import { PullRequestState } from '../../inspectors/ICollaborationInspector'; import { ErrorFactory } from '../../lib/errors/ErrorFactory'; -import { CSVService, Repository } from '../../model'; +import { Repository, VCSService } from '../../model'; import { Types } from '../../types'; import { IProjectFilesBrowserService, Metadata, MetadataType } from '../model'; import { GitServiceUtils } from './GitServiceUtils'; @@ -12,9 +12,9 @@ import { Directory, File, Symlink } from './model'; @injectable() export class Git implements IProjectFilesBrowserService { private repository: Repository; - private service: CSVService; + private service: VCSService; - constructor(repository: Repository, @inject(Types.IContentRepositoryBrowser) service: CSVService) { + constructor(repository: Repository, @inject(Types.IContentRepositoryBrowser) service: VCSService) { this.repository = repository; this.service = service; } diff --git a/src/services/git/GitHubService.ts b/src/services/git/GitHubService.ts index 0f962832a..e4cc35c1e 100644 --- a/src/services/git/GitHubService.ts +++ b/src/services/git/GitHubService.ts @@ -17,7 +17,8 @@ import { ErrorFactory } from '../../lib/errors'; import { ICache } from '../../scanner/cache/ICache'; import { InMemoryCache } from '../../scanner/cache/InMemoryCache'; import { Types } from '../../types'; -import { ICVSService, BitbucketPullRequestState, CSVService } from './ICVSService'; +import { VCSServicesUtils } from './CSVServicesUtils'; +import { IVCSService, VCSService } from './ICVSService'; import { Commit, Contributor, @@ -33,12 +34,10 @@ import { RepoContentType, Symlink, } from './model'; -import { GitHubPullRequestState } from './IGitHubService'; -import { CSVServicesUtils } from './CSVServicesUtils'; const debug = Debug('cli:services:git:github-service'); @injectable() -export class GitHubService implements ICVSService { +export class GitHubService implements IVCSService { private readonly client: Octokit; private cache: ICache; private callCount = 0; @@ -75,7 +74,7 @@ export class GitHubService implements ICVSService { ): Promise> { let url = 'GET /repos/:owner/:repo/pulls'; if (options !== undefined && options.filter !== undefined && options.filter.state !== undefined) { - const state = CSVServicesUtils.getPRState(options.filter.state, CSVService.github); + const state = VCSServicesUtils.getPRState(options.filter.state, VCSService.github); url = `${url}?state=${state}`; } const response: PullsListResponseItem[] = await this.paginate(url, owner, repo); diff --git a/src/services/git/ICVSService.ts b/src/services/git/ICVSService.ts index ac3430c03..594f355fe 100644 --- a/src/services/git/ICVSService.ts +++ b/src/services/git/ICVSService.ts @@ -3,7 +3,7 @@ import { Paginated } from '../../inspectors/common/Paginated'; import { PullRequestState } from '../../inspectors/ICollaborationInspector'; import { Commit, Contributor, ContributorStats, Directory, File, Issue, PullFiles, PullRequest, PullRequestReview, Symlink } from './model'; -export interface ICVSService { +export interface IVCSService { getPullRequests(owner: string, repo: string, options?: ListGetterOptions<{ state?: PullRequestState }>): Promise>; getPullRequestReviews(owner: string, repo: string, prNumber: number): Promise>; getPullRequestFiles(owner: string, repo: string, prNumber: number): Promise>; @@ -16,7 +16,7 @@ export interface ICVSService { getRepoContent(owner: string, repo: string, path: string): Promise; } -export enum CSVService { +export enum VCSService { github = 'GitHub', bitbucket = 'Bitbucket', }