diff --git a/lib/config/decrypt.js b/lib/config/decrypt.js index 58974097932c096b72a05317a97dc7231327199d..5f2e66f540d59cb6aea84b20dbfab4b72c100bba 100644 --- a/lib/config/decrypt.js +++ b/lib/config/decrypt.js @@ -23,7 +23,9 @@ function decryptConfig(config, logger, privateKey) { logger.info(`Decrypted ${encryptedKey}`); if (encryptedKey === 'npmToken') { logger.info('Migrating npmToken to npmrc'); - decryptedConfig.npmrc = `//registry.npmjs.org/:_authToken=${decryptedStr}\n`; + decryptedConfig.npmrc = `//registry.npmjs.org/:_authToken=${ + decryptedStr + }\n`; } else { decryptedConfig[encryptedKey] = decryptedStr; } diff --git a/lib/config/validation.js b/lib/config/validation.js index 12800e5318cd73961d83a9d6417a188dc14338f3..029af8d233ed106063b4a33f7ee9219078b92b80 100644 --- a/lib/config/validation.js +++ b/lib/config/validation.js @@ -60,7 +60,9 @@ function validateConfig(config) { if (val !== true && val !== false) { errors.push({ depName: 'Configuration Error', - message: `Configuration option \`${key}\` should be boolean. Found: ${JSON.stringify( + message: `Configuration option \`${ + key + }\` should be boolean. Found: ${JSON.stringify( val )} (${typeof val})`, }); @@ -69,7 +71,9 @@ function validateConfig(config) { if (!Array.isArray(val)) { errors.push({ depName: 'Configuration Error', - message: `Configuration option \`${key}\` should be a list (Array)`, + message: `Configuration option \`${ + key + }\` should be a list (Array)`, }); } else { // eslint-disable-next-line no-loop-func @@ -96,7 +100,9 @@ function validateConfig(config) { } else { errors.push({ depName: 'Configuration Error', - message: `Configuration option \`${key}\` should be a json object`, + message: `Configuration option \`${ + key + }\` should be a json object`, }); } } diff --git a/lib/manager/docker/registry.js b/lib/manager/docker/registry.js index 8408f7ad1a3b57fd9be8053cead80f342e110226..23d5c4dee256d824846439353c556676093068c4 100644 --- a/lib/manager/docker/registry.js +++ b/lib/manager/docker/registry.js @@ -8,7 +8,9 @@ module.exports = { async function getDigest(name, tag = 'latest', logger) { const repository = name.includes('/') ? name : `library/${name}`; try { - const authUrl = `https://auth.docker.io/token?service=registry.docker.io&scope=repository:${repository}:pull`; + const authUrl = `https://auth.docker.io/token?service=registry.docker.io&scope=repository:${ + repository + }:pull`; logger.debug(`Obtaining docker registry token for ${repository}`); const { token } = (await got(authUrl, { json: true })).body; if (!token) { @@ -35,7 +37,9 @@ async function getDigest(name, tag = 'latest', logger) { async function getTags(name, logger) { const repository = name.includes('/') ? name : `library/${name}`; try { - const authUrl = `https://auth.docker.io/token?service=registry.docker.io&scope=repository:${repository}:pull`; + const authUrl = `https://auth.docker.io/token?service=registry.docker.io&scope=repository:${ + repository + }:pull`; logger.debug(`Obtaining docker registry token for ${repository}`); const { token } = (await got(authUrl, { json: true })).body; if (!token) { diff --git a/lib/manager/docker/update.js b/lib/manager/docker/update.js index e0a9982a366d12d01c9d1f5fddac300abded5bfe..e0264d75b1bbdf0d7052ef15e4653f3ee7b82ad6 100644 --- a/lib/manager/docker/update.js +++ b/lib/manager/docker/update.js @@ -6,7 +6,9 @@ function setNewValue(currentFileContent, upgrade, logger) { try { logger.debug(`setNewValue: ${upgrade.newFrom}`); const oldLine = new RegExp( - `(^|\n)${upgrade.fromPrefix} ${upgrade.depName}.*? ?${upgrade.fromSuffix}\n` + `(^|\n)${upgrade.fromPrefix} ${upgrade.depName}.*? ?${ + upgrade.fromSuffix + }\n` ); let newLine = `$1${upgrade.fromPrefix} ${upgrade.newFrom}`; if (upgrade.fromSuffix.length) { diff --git a/lib/manager/npm/package.js b/lib/manager/npm/package.js index afa44d125564fbff17bd4dcf7c8914bf2a5f0442..c5f4e19bb9b74ebb51b553bfdc58bcf33b511c63 100644 --- a/lib/manager/npm/package.js +++ b/lib/manager/npm/package.js @@ -12,7 +12,9 @@ async function getPackageUpdates(config) { results.push({ depName: config.depName, type: 'warning', - message: `Dependency uses tag "\`${config.currentVersion}\`" as its version so that will never be changed by Renovate`, + message: `Dependency uses tag "\`${ + config.currentVersion + }\`" as its version so that will never be changed by Renovate`, }); logger.debug(results[0].message); return results; diff --git a/lib/platform/github/index.js b/lib/platform/github/index.js index d14faf9c30263706f3dd7098783f56635748a805..b59682c5b8ed8538605d54944c0db99d815a0ada 100644 --- a/lib/platform/github/index.js +++ b/lib/platform/github/index.js @@ -141,7 +141,9 @@ async function initRepo(repoName, token, endpoint, repoLogger) { async function getBranchProtection(branchName) { const res = await get( - `repos/${config.repoName}/branches/${branchName}/protection/required_status_checks`, + `repos/${config.repoName}/branches/${ + branchName + }/protection/required_status_checks`, { headers: { accept: 'application/vnd.github.loki-preview+json', @@ -404,7 +406,9 @@ async function addLabels(issueNo, labels) { async function getComments(issueNo) { // GET /repos/:owner/:repo/issues/:number/comments logger.debug(`Getting comments for #${issueNo}`); - const url = `repos/${config.repoName}/issues/${issueNo}/comments?per_page=100`; + const url = `repos/${config.repoName}/issues/${ + issueNo + }/comments?per_page=100`; const comments = (await get(url, { paginate: true })).body; logger.debug(`Found ${comments.length} comments`); return comments; diff --git a/lib/platform/gitlab/index.js b/lib/platform/gitlab/index.js index 9898d1f610ba5d8652336b83fd14ee690e8bffcc..6a56376646af354330f0ca498e225c1348d27f70 100644 --- a/lib/platform/gitlab/index.js +++ b/lib/platform/gitlab/index.js @@ -114,7 +114,9 @@ async function getFileList(branchName = config.baseBranch) { } try { const res = await get( - `projects/${config.repoName}/repository/tree?ref=${branchName}&recursive=true&per_page=100`, + `projects/${config.repoName}/repository/tree?ref=${ + branchName + }&recursive=true&per_page=100`, { paginate: true } ); config.fileList = res.body @@ -134,10 +136,9 @@ async function getFileList(branchName = config.baseBranch) { async function branchExists(branchName) { logger.debug(`Checking if branch exists: ${branchName}`); try { - const url = `projects/${config.repoName}/repository/branches/${branchName.replace( - '/', - '%2F' - )}`; + const url = `projects/${ + config.repoName + }/repository/branches/${branchName.replace('/', '%2F')}`; const res = await get(url); if (res.statusCode === 200) { logger.debug('Branch exists'); @@ -170,7 +171,9 @@ function isBranchStale() { // Returns the Pull Request for a branch. Null if not exists. async function getBranchPr(branchName) { logger.debug(`getBranchPr(${branchName})`); - const urlString = `projects/${config.repoName}/merge_requests?state=opened&per_page=100`; + const urlString = `projects/${ + config.repoName + }/merge_requests?state=opened&per_page=100`; const res = await get(urlString, { paginate: true }); logger.debug(`Got res with ${res.body.length} results`); let pr = null; @@ -198,10 +201,9 @@ async function getBranchStatus(branchName, requiredStatusChecks) { return 'failed'; } // First, get the branch to find the commit SHA - let url = `projects/${config.repoName}/repository/branches/${branchName.replace( - '/', - '%2F' - )}`; + let url = `projects/${ + config.repoName + }/repository/branches/${branchName.replace('/', '%2F')}`; let res = await get(url); const branchSha = res.body.commit.id; // Now, check the statuses for that commit @@ -229,10 +231,9 @@ async function getBranchStatus(branchName, requiredStatusChecks) { async function getBranchStatusCheck(branchName, context) { // First, get the branch to find the commit SHA - let url = `projects/${config.repoName}/repository/branches/${branchName.replace( - '/', - '%2F' - )}`; + let url = `projects/${ + config.repoName + }/repository/branches/${branchName.replace('/', '%2F')}`; let res = await get(url); const branchSha = res.body.commit.id; // Now, check the statuses for that commit @@ -255,10 +256,9 @@ async function setBranchStatus( targetUrl ) { // First, get the branch to find the commit SHA - let url = `projects/${config.repoName}/repository/branches/${branchName.replace( - '/', - '%2F' - )}`; + let url = `projects/${ + config.repoName + }/repository/branches/${branchName.replace('/', '%2F')}`; const res = await get(url); const branchSha = res.body.commit.id; // Now, check the statuses for that commit @@ -326,7 +326,9 @@ async function ensureCommentRemoval() { async function findPr(branchName, prTitle, state = 'all') { logger.debug(`findPr(${branchName}, ${prTitle}, ${state})`); - const urlString = `projects/${config.repoName}/merge_requests?state=${state}&per_page=100`; + const urlString = `projects/${config.repoName}/merge_requests?state=${ + state + }&per_page=100`; const res = await get(urlString, { paginated: true }); let pr = null; res.body.forEach(result => { @@ -392,10 +394,9 @@ async function getPr(prNo) { } // Check if the most recent branch commit is by us // If not then we don't allow it to be rebased, in case someone's changes would be lost - const branchUrl = `projects/${config.repoName}/repository/branches/${pr.source_branch.replace( - '/', - '%2F' - )}`; + const branchUrl = `projects/${ + config.repoName + }/repository/branches/${pr.source_branch.replace('/', '%2F')}`; const branch = (await get(branchUrl)).body; if (branch && branch.commit && branch.commit.author_email === config.email) { pr.canRebase = true; diff --git a/lib/workers/branch/index.js b/lib/workers/branch/index.js index e7096e68811dc90278fd71fc710994988fa037bc..8249de6da9650d9cde7c6de54bc73bdc52de9109 100644 --- a/lib/workers/branch/index.js +++ b/lib/workers/branch/index.js @@ -59,11 +59,21 @@ async function processBranch(branchConfig) { const subject = 'Renovate Ignore Notification'; let content; if (config.isMajor) { - content = `As this PR has been closed unmerged, Renovate will ignore this upgrade and you will not receive PRs for *any* future ${config.newVersionMajor}.x releases. However, if you upgrade to ${config.newVersionMajor}.x manually then Renovate will then reenable updates for minor and patch updates automatically.`; + content = `As this PR has been closed unmerged, Renovate will ignore this upgrade and you will not receive PRs for *any* future ${ + config.newVersionMajor + }.x releases. However, if you upgrade to ${ + config.newVersionMajor + }.x manually then Renovate will then reenable updates for minor and patch updates automatically.`; } else if (config.isDigest) { - content = `As this PR has been closed unmerged, Renovate will ignore this upgrade type and you will not receive PRs for *any* future ${config.depName}:${config.currentTag} digest updates. Digest updates will resume if you update the specified tag at any time.`; + content = `As this PR has been closed unmerged, Renovate will ignore this upgrade type and you will not receive PRs for *any* future ${ + config.depName + }:${ + config.currentTag + } digest updates. Digest updates will resume if you update the specified tag at any time.`; } else { - content = `As this PR has been closed unmerged, Renovate will now ignore this update (${config.newVersion}). You will still receive a PR once a newer version is released, so if you wish to permanently ignore this dependency, please add it to the \`ignoreDeps\` array of your renovate config.`; + content = `As this PR has been closed unmerged, Renovate will now ignore this update (${ + config.newVersion + }). You will still receive a PR once a newer version is released, so if you wish to permanently ignore this dependency, please add it to the \`ignoreDeps\` array of your renovate config.`; } content += '\n\nIf this PR was closed by mistake or you changed your mind, you can simply reopen or rename it to reactivate Renovate for this dependency version.'; @@ -118,8 +128,9 @@ async function processBranch(branchConfig) { try { logger.debug('Ensuring PR'); logger.debug( - `There are ${config.errors.length} errors and ${config.warnings - .length} warnings` + `There are ${config.errors.length} errors and ${ + config.warnings.length + } warnings` ); const pr = await prWorker.ensurePr(config); // TODO: ensurePr should check for automerge itself diff --git a/lib/workers/branch/schedule.js b/lib/workers/branch/schedule.js index 61b207d270f900e9fddd985303c8b0753048a6f3..22dce6d8c5a2959590c2df10b18a6a917a3e5eae 100644 --- a/lib/workers/branch/schedule.js +++ b/lib/workers/branch/schedule.js @@ -109,7 +109,9 @@ function isScheduledNow(config) { logger.debug({ scheduledDays }, `scheduledDays`); if (scheduledDays.indexOf(currentDay) === -1) { logger.debug( - `Does not match schedule because ${currentDay} is not in ${scheduledDays}` + `Does not match schedule because ${currentDay} is not in ${ + scheduledDays + }` ); return false; } @@ -127,7 +129,9 @@ function isScheduledNow(config) { const startSeconds = schedule.t_a[0]; if (currentSeconds < startSeconds) { logger.debug( - `Does not match schedule because ${currentSeconds} is earlier than ${startSeconds}` + `Does not match schedule because ${ + currentSeconds + } is earlier than ${startSeconds}` ); return false; } @@ -137,7 +141,9 @@ function isScheduledNow(config) { const endSeconds = schedule.t_b[0]; if (currentSeconds > endSeconds) { logger.debug( - `Does not match schedule because ${currentSeconds} is later than ${endSeconds}` + `Does not match schedule because ${currentSeconds} is later than ${ + endSeconds + }` ); return false; } diff --git a/lib/workers/package/versions.js b/lib/workers/package/versions.js index faf6df1989951071a9f90354d8493b094ef3fd0e..98e44c381e8c800bb13376160be4181be814bb80 100644 --- a/lib/workers/package/versions.js +++ b/lib/workers/package/versions.js @@ -144,7 +144,9 @@ function determineUpgrades(npmDep, config) { const semverParsed = semverUtils.parseRange(currentVersion); if (semverParsed.length > 1) { // We don't know how to support complex semver ranges, so don't upgrade - result.message = `Complex semver ranges such as "${currentVersion}" are not yet supported so won't ever be upgraded`; + result.message = `Complex semver ranges such as "${ + currentVersion + }" are not yet supported so won't ever be upgraded`; logger.warn(result.message); return [result]; } @@ -200,7 +202,9 @@ function determineUpgrades(npmDep, config) { // Example: 1.2.x return { ...upgrade, ...{ newVersion: `${major}.${minor}.x` } }; } - result.message = `The current semver range "${currentVersion}" is not supported so won't ever be upgraded`; + result.message = `The current semver range "${ + currentVersion + }" is not supported so won't ever be upgraded`; logger.warn(result.message); return null; }) diff --git a/lib/workers/pr/index.js b/lib/workers/pr/index.js index 2339868d9d58a2dd8904c5eb5fce4ecfaacba070..ef9e7ee28413faba86c9b9480b3ee41e337c9adc 100644 --- a/lib/workers/pr/index.js +++ b/lib/workers/pr/index.js @@ -28,7 +28,9 @@ async function ensurePr(prConfig) { // Only create a PR if a branch automerge has failed if (config.automerge === true && config.automergeType.startsWith('branch')) { logger.debug( - `Branch is configured for branch automerge, branchStatus is: ${branchStatus}` + `Branch is configured for branch automerge, branchStatus is: ${ + branchStatus + }` ); if (config.forcePr || branchStatus === 'failure') { logger.debug(`Branch tests failed, so will create PR`); @@ -60,7 +62,9 @@ async function ensurePr(prConfig) { return null; } logger.debug( - `prNotPendingHours=${config.prNotPendingHours} threshold hit - creating PR` + `prNotPendingHours=${ + config.prNotPendingHours + } threshold hit - creating PR` ); } logger.debug('Branch status success'); @@ -72,7 +76,9 @@ async function ensurePr(prConfig) { // Get changelog and then generate template strings for (const upgrade of upgrades) { - const upgradeKey = `${upgrade.depName}-${upgrade.changeLogFromVersion}-${upgrade.changeLogToVersion}`; + const upgradeKey = `${upgrade.depName}-${upgrade.changeLogFromVersion}-${ + upgrade.changeLogToVersion + }`; if (processedUpgrades.indexOf(upgradeKey) !== -1) { continue; // eslint-disable-line no-continue } diff --git a/lib/workers/repository/init/base.js b/lib/workers/repository/init/base.js index 770ff88dcc96374682acb727caffd8e1379994f0..ef17dc043b1c1f6609f5cf95ae9ce9aae62ef983 100644 --- a/lib/workers/repository/init/base.js +++ b/lib/workers/repository/init/base.js @@ -9,7 +9,9 @@ async function checkBaseBranch(config) { await platform.setBaseBranch(config.baseBranch); } else { // Warn and ignore setting (use default branch) - const message = `The configured baseBranch "${config.baseBranch}" is not present. Ignoring`; + const message = `The configured baseBranch "${ + config.baseBranch + }" is not present. Ignoring`; error = [ { depName: 'baseBranch', diff --git a/lib/workers/repository/onboarding/pr/base-branch.js b/lib/workers/repository/onboarding/pr/base-branch.js index f4b376197f9f9b222a296a8f25abcc2f50233eee..bc8c155c649438138fc4b66309f1af28914021bc 100644 --- a/lib/workers/repository/onboarding/pr/base-branch.js +++ b/lib/workers/repository/onboarding/pr/base-branch.js @@ -1,7 +1,9 @@ function getBaseBranchDesc(config) { // Describe base branch only if it's configured return config.baseBranch - ? `You have configured renovate to use branch \`${config.baseBranch}\` as base branch.\n\n` + ? `You have configured renovate to use branch \`${ + config.baseBranch + }\` as base branch.\n\n` : ''; } diff --git a/lib/workers/repository/onboarding/pr/pr-list.js b/lib/workers/repository/onboarding/pr/pr-list.js index 8ad0fe8dc55cf5e6ad09bf2fc8b24dea0750192b..fdc11f9cfea617290c88f9a5928de0d55e3f9e02 100644 --- a/lib/workers/repository/onboarding/pr/pr-list.js +++ b/lib/workers/repository/onboarding/pr/pr-list.js @@ -4,9 +4,13 @@ function getPrList(config) { logger.trace({ config }); let prDesc = `\n### What to Expect\n\n`; if (!branches.length) { - return `${prDesc}It looks like your repository dependencies are already up-to-date and no Pull Requests will be necessary right away.\n`; + return `${ + prDesc + }It looks like your repository dependencies are already up-to-date and no Pull Requests will be necessary right away.\n`; } - prDesc += `With your current configuration, Renovate will create ${branches.length} Pull Request`; + prDesc += `With your current configuration, Renovate will create ${ + branches.length + } Pull Request`; prDesc += branches.length > 1 ? `s:\n\n` : `:\n\n`; for (const [index, branch] of branches.entries()) { diff --git a/lib/workers/repository/updates/generate.js b/lib/workers/repository/updates/generate.js index 13cba0e0d42122250735f64e14321610f8d70117..3f9e6bffc09858f69b7bcae08ac4fedbc5ed21b4 100644 --- a/lib/workers/repository/updates/generate.js +++ b/lib/workers/repository/updates/generate.js @@ -38,7 +38,9 @@ function generateBranchConfig(branchUpgrades, logger) { upgrade.prTitle = handlebars.compile(upgrade.prTitle)(upgrade); if (upgrade.semanticCommits) { logger.debug('Upgrade has semantic commits enabled'); - upgrade.prTitle = `${upgrade.semanticPrefix} ${upgrade.prTitle.toLowerCase()}`; + upgrade.prTitle = `${ + upgrade.semanticPrefix + } ${upgrade.prTitle.toLowerCase()}`; } logger.debug(`${upgrade.branchName}, ${upgrade.prTitle}`); config.upgrades.push(upgrade); diff --git a/package.json b/package.json index 7c5602587736eac2de11c1526e85f0f36d30d14b..5cdab13ffcb4a81af510616ae322fddfd28ab0b0 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "jest": "20.0.4", "mkdirp": "0.5.1", "mockdate": "2.0.2", - "prettier": "1.7.4", + "prettier": "1.8.0", "rimraf": "2.6.2", "semantic-release": "8.2.0" }, diff --git a/yarn.lock b/yarn.lock index 11db4ad6de73061b1792871c594c8ef97bca17bf..d6b384cbe4c6f179d7788339bb0a1229665fada7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3972,9 +3972,9 @@ preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" -prettier@1.7.4: - version "1.7.4" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.7.4.tgz#5e8624ae9363c80f95ec644584ecdf55d74f93fa" +prettier@1.8.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.8.0.tgz#d9dc68277cf1ded816c8e8863ab47889c29ce9a6" pretty-format@^20.0.3: version "20.0.3"