Skip to content

Commit

Permalink
Hotfix/failing thin pull requests practice (#207)
Browse files Browse the repository at this point in the history
fix: failing thin pull requests practice
  • Loading branch information
adelkahomolova authored Jan 21, 2020
2 parents a25b5b9 + 153f153 commit 7813c93
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/inspectors/CollaborationInspector.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('Collaboration Inspector', () => {
it('returns paginated pull requests', async () => {
new GitHubNock('1', 'octocat', 1296269, 'Hello-World').getPulls({
pulls: [
{ number: 1347, state: 'open', title: 'new-feature', body: 'Please pull these awesome changes', head: 'new-topic', base: 'master' },
{ number: 1, state: 'open', title: 'new-feature', body: 'Please pull these awesome changes', head: 'new-topic', base: 'master' },
],
});

Expand Down
4 changes: 2 additions & 2 deletions src/practices/LanguageIndependent/ThinPullRequestsPractice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import { Paginated } from '../../inspectors';
name: 'Break down large pull requests into smaller ones',
impact: PracticeImpact.medium,
suggestion:
'Large pull request are hard to code review and it reduces the probability of finding bugs. Split your PRs into logical units. Do not have PR with more than 500 changes.',
'Large pull request are hard to code review and it reduces the probability of finding bugs. Split your PRs into logical units. Do not have PR with more than 1000 changes.',
reportOnlyOnce: true,
url: 'https://medium.com/@hugooodias/the-anatomy-of-a-perfect-pull-request-567382bb6067',
dependsOn: { practicing: ['LanguageIndependent.DoesPullRequests'] },
})
export class ThinPullRequestsPractice implements IPractice {
private readonly measurePullRequestCount = 500; // update suggestion text when changed
private readonly measurePullRequestCount = 1000; // update suggestion text when changed

async isApplicable(): Promise<boolean> {
return true;
Expand Down
6 changes: 3 additions & 3 deletions src/services/git/GitHubService.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('GitHub Service', () => {
new GitHubNock('1', 'octocat', 1296269, 'Hello-World').getPulls({
pulls: [
{
number: 1347,
number: 1,
state: 'open',
title: 'new-feature',
body: 'Please pull these awesome changes',
Expand All @@ -69,7 +69,7 @@ describe('GitHub Service', () => {

it('returns pulls in own interface with diffStat', async () => {
const params = {
number: 1347,
number: 1,
state: 'open',
title: 'new-feature',
body: 'Please pull these awesome changes',
Expand Down Expand Up @@ -108,7 +108,7 @@ describe('GitHub Service', () => {
new GitHubNock('1', 'octocat', 1296269, 'Hello-World').getPulls({
pulls: [
{
number: 1347,
number: 1,
state: 'open',
title: 'new-feature',
body: 'Please pull these awesome changes',
Expand Down
6 changes: 3 additions & 3 deletions src/services/git/GitHubService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class GitHubService implements IVCSService {
closedAt: val.closed_at,
mergedAt: val.merged_at,
state: val.state,
id: val.id,
id: val.number, // Lists details of a pull request by providing its number. - https://developer.github.com/v3/pulls/
base: {
repo: {
url: val.base.repo.url,
Expand All @@ -105,7 +105,7 @@ export class GitHubService implements IVCSService {
};
// Get number of changes, additions and deletions in PullRequest if the withDiffStat is true
if (options?.withDiffStat) {
const lines = await this.getPullsDiffStat(owner, repo, val.id);
const lines = await this.getPullsDiffStat(owner, repo, val.number);
return { ...pullRequest, lines };
}
return pullRequest;
Expand Down Expand Up @@ -136,7 +136,7 @@ export class GitHubService implements IVCSService {
closedAt: response.data.closed_at,
mergedAt: response.data.merged_at,
state: response.data.state,
id: response.data.id,
id: response.data.number, // Lists details of a pull request by providing its number. - https://developer.github.com/v3/pulls/
base: {
repo: {
url: response.data.base.repo.url,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const getPullsServiceResponse: Paginated<PullRequest> = {
mergedAt: '2011-01-26T19:01:12Z',
state: 'open',
updatedAt: '2011-01-26T19:01:12Z',
url: 'https://api.github.com/repos/octocat/Hello-World/pulls/1347',
url: 'https://api.github.com/repos/octocat/Hello-World/pulls/1',
user: { id: '1', login: 'octocat', url: 'https://api.github.com/users/octocat' },
},
],
Expand Down

0 comments on commit 7813c93

Please sign in to comment.