From d5984a3cadab84fd9a3b62b09695a59ade99dc7f Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Mon, 5 Mar 2018 15:50:34 +0100 Subject: [PATCH] chore: remove unused getPrFiles functions --- lib/platform/github/index.js | 13 ------------- lib/platform/gitlab/index.js | 6 ------ lib/platform/vsts/index.js | 7 ------- test/platform/__snapshots__/index.spec.js.snap | 3 --- .../github/__snapshots__/index.spec.js.snap | 7 ------- test/platform/github/index.spec.js | 17 ----------------- test/platform/gitlab/index.spec.js | 6 ------ test/platform/vsts/index.spec.js | 6 ------ 8 files changed, 65 deletions(-) diff --git a/lib/platform/github/index.js b/lib/platform/github/index.js index b23555415c..19594b2610 100644 --- a/lib/platform/github/index.js +++ b/lib/platform/github/index.js @@ -39,7 +39,6 @@ module.exports = { findPr, createPr, getPr, - getPrFiles, updatePr, mergePr, // file @@ -831,18 +830,6 @@ async function getPr(prNo) { return pr; } -// Return a list of all modified files in a PR -async function getPrFiles(prNo) { - logger.debug({ prNo }, 'getPrFiles'); - if (!prNo) { - return []; - } - const files = (await get( - `repos/${config.parentRepo || config.repository}/pulls/${prNo}/files` - )).body; - return files.map(f => f.filename); -} - async function updatePr(prNo, title, body) { logger.debug(`updatePr(${prNo}, ${title}, body)`); const patchBody = { title }; diff --git a/lib/platform/gitlab/index.js b/lib/platform/gitlab/index.js index 939579d022..52d69e2ff2 100644 --- a/lib/platform/gitlab/index.js +++ b/lib/platform/gitlab/index.js @@ -34,7 +34,6 @@ module.exports = { findPr, createPr, getPr, - getPrFiles, updatePr, mergePr, // file @@ -482,11 +481,6 @@ async function getPr(iid) { return pr; } -function getPrFiles() { - // TODO - return []; -} - async function updatePr(iid, title, description) { await get.put(`projects/${config.repository}/merge_requests/${iid}`, { body: { diff --git a/lib/platform/vsts/index.js b/lib/platform/vsts/index.js index b16f5656d2..7fd0841931 100644 --- a/lib/platform/vsts/index.js +++ b/lib/platform/vsts/index.js @@ -36,7 +36,6 @@ module.exports = { findPr, createPr, getPr, - getPrFiles, updatePr, mergePr, // file @@ -557,9 +556,3 @@ async function addReviewers(prNo, reviewers) { }) ); } - -// to become async? -function getPrFiles(prNo) { - logger.info(`getPrFiles(prNo)(${prNo}) - Not supported by VSTS (yet!)`); - return []; -} diff --git a/test/platform/__snapshots__/index.spec.js.snap b/test/platform/__snapshots__/index.spec.js.snap index 0543b2fb6e..13901bdef4 100644 --- a/test/platform/__snapshots__/index.spec.js.snap +++ b/test/platform/__snapshots__/index.spec.js.snap @@ -27,7 +27,6 @@ Array [ "findPr", "createPr", "getPr", - "getPrFiles", "updatePr", "mergePr", "commitFilesToBranch", @@ -63,7 +62,6 @@ Array [ "findPr", "createPr", "getPr", - "getPrFiles", "updatePr", "mergePr", "commitFilesToBranch", @@ -99,7 +97,6 @@ Array [ "findPr", "createPr", "getPr", - "getPrFiles", "updatePr", "mergePr", "commitFilesToBranch", diff --git a/test/platform/github/__snapshots__/index.spec.js.snap b/test/platform/github/__snapshots__/index.spec.js.snap index 91fdb42415..19a04807f6 100644 --- a/test/platform/github/__snapshots__/index.spec.js.snap +++ b/test/platform/github/__snapshots__/index.spec.js.snap @@ -523,13 +523,6 @@ Object { } `; -exports[`platform/github getPrFiles() returns files 1`] = ` -Array [ - "renovate.json", - "not renovate.json", -] -`; - exports[`platform/github getRepos should return an array of repos 1`] = ` Array [ Array [ diff --git a/test/platform/github/index.spec.js b/test/platform/github/index.spec.js index 7b840d9568..6a49737c84 100644 --- a/test/platform/github/index.spec.js +++ b/test/platform/github/index.spec.js @@ -1309,23 +1309,6 @@ describe('platform/github', () => { expect(pr).toMatchSnapshot(); }); }); - describe('getPrFiles()', () => { - it('should return empty if no prNo is passed', async () => { - const prFiles = await github.getPrFiles(null); - expect(prFiles).toEqual([]); - }); - it('returns files', async () => { - get.mockReturnValueOnce({ - body: [ - { filename: 'renovate.json' }, - { filename: 'not renovate.json' }, - ], - }); - const prFiles = await github.getPrFiles(123); - expect(prFiles).toMatchSnapshot(); - expect(prFiles).toHaveLength(2); - }); - }); describe('updatePr(prNo, title, body)', () => { it('should update the PR', async () => { await initRepo({ repository: 'some/repo', token: 'token' }); diff --git a/test/platform/gitlab/index.spec.js b/test/platform/gitlab/index.spec.js index 94bca4325e..cfc9d94cf9 100644 --- a/test/platform/gitlab/index.spec.js +++ b/test/platform/gitlab/index.spec.js @@ -610,12 +610,6 @@ describe('platform/gitlab', () => { expect(pr).toMatchSnapshot(); }); }); - describe('getPrFiles()', () => { - it('should return empty', async () => { - const prFiles = await gitlab.getPrFiles(); - expect(prFiles).toEqual([]); - }); - }); describe('updatePr(prNo, title, body)', () => { jest.resetAllMocks(); it('updates the PR', async () => { diff --git a/test/platform/vsts/index.spec.js b/test/platform/vsts/index.spec.js index eb0a81f047..381ca7d157 100644 --- a/test/platform/vsts/index.spec.js +++ b/test/platform/vsts/index.spec.js @@ -691,11 +691,5 @@ describe('platform/vsts', () => { const res = await vsts.mergePr(); expect(res).toBeUndefined(); }); - - // to become async? - it('getPrFiles', () => { - const res = vsts.getPrFiles(46); - expect(res.length).toBe(0); - }); }); }); -- GitLab