Skip to content

Commit

Permalink
fix: rename CVS to VCS
Browse files Browse the repository at this point in the history
  • Loading branch information
adelkahomolova committed Nov 25, 2019
1 parent aaeec66 commit c8c2f09
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 23 deletions.
6 changes: 3 additions & 3 deletions src/inspectors/CollaborationInspector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
6 changes: 3 additions & 3 deletions src/inspectors/IssueTrackingInspector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
3 changes: 1 addition & 2 deletions src/model.ts
Original file line number Diff line number Diff line change
@@ -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

Expand Down
10 changes: 5 additions & 5 deletions src/services/git/CSVServicesUtils.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -20,7 +20,7 @@ export class CSVServicesUtils {
}
}

if (service === CSVService.bitbucket) {
if (service === VCSService.bitbucket) {
switch (state) {
case PullRequestState.open:
return BitbucketPullRequestState.open;
Expand Down
6 changes: 3 additions & 3 deletions src/services/git/Git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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;
}
Expand Down
9 changes: 4 additions & 5 deletions src/services/git/GitHubService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down Expand Up @@ -75,7 +74,7 @@ export class GitHubService implements ICVSService {
): Promise<Paginated<PullRequest>> {
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);
Expand Down
4 changes: 2 additions & 2 deletions src/services/git/ICVSService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Paginated<PullRequest>>;
getPullRequestReviews(owner: string, repo: string, prNumber: number): Promise<Paginated<PullRequestReview>>;
getPullRequestFiles(owner: string, repo: string, prNumber: number): Promise<Paginated<PullFiles>>;
Expand All @@ -16,7 +16,7 @@ export interface ICVSService {
getRepoContent(owner: string, repo: string, path: string): Promise<File | Symlink | Directory | null>;
}

export enum CSVService {
export enum VCSService {
github = 'GitHub',
bitbucket = 'Bitbucket',
}
Expand Down

0 comments on commit c8c2f09

Please sign in to comment.