Reformat and change step descriptions

This commit is contained in:
Abhas
2018-07-10 12:21:53 +05:30
parent 093e70cd69
commit 3dc3cff98a
+22 -13
View File
@@ -78,7 +78,7 @@ interface ResponseWithMetaLink {
interface ResponseWithDataArrayAndMeta<T> interface ResponseWithDataArrayAndMeta<T>
extends ResponseWithDataArray<T>, extends ResponseWithDataArray<T>,
ResponseWithMetaLink { } ResponseWithMetaLink {}
interface ResponseFromGetUserRepo extends ResponseWithMetaLink { interface ResponseFromGetUserRepo extends ResponseWithMetaLink {
data: RepoFromGetUserRepo[]; data: RepoFromGetUserRepo[];
@@ -168,7 +168,7 @@ interface RepoNameWithParentRepo {
interface RepoNameWithBranchesAndParent interface RepoNameWithBranchesAndParent
extends RepoNameWithBranches, extends RepoNameWithBranches,
RepoNameWithParentRepo { } RepoNameWithParentRepo {}
interface ObjectWithPerPage { interface ObjectWithPerPage {
per_page?: number; per_page?: number;
@@ -188,7 +188,9 @@ class GithubDetectUnusedRepos {
username: this.username, username: this.username,
}; };
const repos: ResponseWithDataArray<RepoFromGetUserRepo> = await this.paginate( const repos: ResponseWithDataArray<
RepoFromGetUserRepo
> = await this.paginate(
( (
tmpFirstParam: Octokit.ReposGetForUserParams tmpFirstParam: Octokit.ReposGetForUserParams
): Promise<ResponseFromGetUserRepo> => { ): Promise<ResponseFromGetUserRepo> => {
@@ -277,7 +279,10 @@ class GithubDetectUnusedRepos {
const allPromiseRepoWithFlagFromParentContrib = allRepoNameWithBranchesAndParent.map( const allPromiseRepoWithFlagFromParentContrib = allRepoNameWithBranchesAndParent.map(
({ repoName, parentRepo }) => { ({ repoName, parentRepo }) => {
return this.fetchUserIsNotContributor(parentRepo.owner.login, repoName); return this.fetchUserIsNotContributor(
parentRepo.owner.login,
repoName
);
} }
); );
@@ -305,7 +310,8 @@ class GithubDetectUnusedRepos {
for (let index = 0; index < repoCount; index++) { for (let index = 0; index < repoCount; index++) {
const tmpObjFromCommit = allRepoWithFlagFromCommit[index]; const tmpObjFromCommit = allRepoWithFlagFromCommit[index];
const tmpObjFromForkContrib = allRepoWithFlagFromForkContrib[index]; const tmpObjFromForkContrib = allRepoWithFlagFromForkContrib[index];
const tmpObjFromParentContrib = allRepoWithFlagFromParentContrib[index]; const tmpObjFromParentContrib =
allRepoWithFlagFromParentContrib[index];
assert.strictEqual( assert.strictEqual(
tmpObjFromCommit.repoName, tmpObjFromCommit.repoName,
@@ -348,7 +354,9 @@ class GithubDetectUnusedRepos {
// Set per_page // Set per_page
args.per_page = 100; args.per_page = 100;
let response: ResponseWithDataArrayAndMeta<TDataElement> = await method(args); let response: ResponseWithDataArrayAndMeta<TDataElement> = await method(
args
);
// Concat all data // Concat all data
let { data } = response; let { data } = response;
@@ -372,13 +380,16 @@ class GithubDetectUnusedRepos {
const branchesResponse: ResponseWithDataArray< const branchesResponse: ResponseWithDataArray<
BranchFromGetBranches BranchFromGetBranches
> = await this.paginate((tmpFirstParam: Octokit.ReposGetBranchesParams): Promise< > = await this.paginate(
ResponseFromGetBranches (
> => { tmpFirstParam: Octokit.ReposGetBranchesParams
): Promise<ResponseFromGetBranches> => {
return (octokit.repos.getBranches(tmpFirstParam) as any) as Promise< return (octokit.repos.getBranches(tmpFirstParam) as any) as Promise<
ResponseFromGetBranches ResponseFromGetBranches
>; >;
}, params); },
params
);
return { return {
repoName, repoName,
@@ -527,8 +538,6 @@ class GithubDetectUnusedRepos {
} }
} }
export function runMain(username: string = 'bendtherules') { export function runMain(username: string = 'bendtherules') {
new GithubDetectUnusedRepos(username) new GithubDetectUnusedRepos(username)
.fetchUnusedForkedRepos() .fetchUnusedForkedRepos()
@@ -555,7 +564,7 @@ export function runMain(username: string = 'bendtherules') {
// https://developer.github.com/v3/repos/commits/#compare-two-commits // https://developer.github.com/v3/repos/commits/#compare-two-commits
// https://octokit.github.io/rest.js/#api-Repos-compareCommits // https://octokit.github.io/rest.js/#api-Repos-compareCommits
// //
// 4. If parent contains, then check if user is in contributor list (of either parent or forked repo) {Should not be present in either of them} // 4. Then check if user is in contributor list (of either parent or forked repo) {Should not be present in either of them}
// https://developer.github.com/v3/repos/#list-contributors // https://developer.github.com/v3/repos/#list-contributors
// https://octokit.github.io/rest.js/#api-Repos-getContributors // https://octokit.github.io/rest.js/#api-Repos-getContributors
// //