Skip to content

Commit

Permalink
Switch variable use to be less repetitive.
Browse files Browse the repository at this point in the history
Some of these were already defined higher up, so it's worth using their
shorter notations!
  • Loading branch information
abernix committed May 23, 2018
1 parent 493d9a7 commit 5d3889c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions dangerfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import { includes } from 'lodash';
import * as fs from 'fs';

// Setup
const pr = danger.github.pr;
const commits = danger.github.commits;
const github = danger.github;
const pr = github.pr;
const commits = github.commits;
const modified = danger.git.modified_files;
const bodyAndTitle = (pr.body + pr.title).toLowerCase();
console.log(commits.map(({ sha }) => sha));
Expand All @@ -24,8 +25,8 @@ const modifiedAppFiles = modified

// Takes a list of file paths, and converts it into clickable links
const linkableFiles = paths => {
const repoURL = danger.github.pr.head.repo.html_url;
const ref = danger.github.pr.head.ref;
const repoURL = pr.head.repo.html_url;
const ref = pr.head.ref;
const links = paths.map(path => {
return createLink(`${repoURL}/blob/${ref}/${path}`, path);
});
Expand Down Expand Up @@ -92,7 +93,7 @@ if (!isBot) {
// Warn when there is a big PR
const bigPRThreshold = 500;
if (
danger.github.pr.additions + danger.github.pr.deletions >
github.pr.additions + github.pr.deletions >
bigPRThreshold
) {
warn(':exclamation: Big PR');
Expand Down

0 comments on commit 5d3889c

Please sign in to comment.