feat: refactor raiseDeprecationWarnings into suppressNotifications (#2921)

This commit is contained in:
rtaum 2018-12-09 11:39:35 +01:00 committed by Rhys Arkins
parent 0f57f9a69a
commit 90af9fc3ab
9 changed files with 16 additions and 19 deletions

View file

@ -1302,12 +1302,6 @@ const options = [
mergeable: true, mergeable: true,
cli: false, cli: false,
}, },
{
name: 'raiseDeprecationWarnings',
description: 'Raise deprecation warnings in issues whenever found',
type: 'boolean',
default: true,
},
{ {
name: 'hostRules', name: 'hostRules',
description: 'Host rules/configuration including credentials', description: 'Host rules/configuration including credentials',
@ -1359,6 +1353,7 @@ const options = [
'prEditNotification', 'prEditNotification',
'branchAutomergeFailure', 'branchAutomergeFailure',
'lockFileErrors', 'lockFileErrors',
'deprecationWarningIssues',
], ],
cli: false, cli: false,
env: false, env: false,

View file

@ -389,6 +389,13 @@ function migrateConfig(config) {
.replace(/newVersion/g, 'newValue') .replace(/newVersion/g, 'newValue')
.replace(/newValueMajor/g, 'newMajor') .replace(/newValueMajor/g, 'newMajor')
.replace(/newValueMinor/g, 'newMinor'); .replace(/newValueMinor/g, 'newMinor');
} else if (key === 'raiseDeprecationWarnings') {
isMigrated = true;
delete migratedConfig.raiseDeprecationWarnings;
if (val === false) {
migratedConfig.suppressNotifications = migratedConfig.suppressNotifications || [];
migratedConfig.suppressNotifications.push('deprecationWarningIssues');
}
} }
} }
if (migratedConfig.endpoints) { if (migratedConfig.endpoints) {

View file

@ -3,7 +3,7 @@ module.exports = {
}; };
async function raiseDeprecationWarnings(config, packageFiles) { async function raiseDeprecationWarnings(config, packageFiles) {
if (!config.raiseDeprecationWarnings) { if (config.suppressNotifications && config.suppressNotifications.includes('deprecationWarningIssues')) {
return; return;
} }
const deprecatedPackages = {}; const deprecatedPackages = {};

View file

@ -128,6 +128,9 @@ Object {
"separateMajorMinor": true, "separateMajorMinor": true,
"separateMajorReleases": true, "separateMajorReleases": true,
"separateMinorPatch": true, "separateMinorPatch": true,
"suppressNotifications": Array [
"deprecationWarningIssues",
],
"travis": Object { "travis": Object {
"enabled": true, "enabled": true,
}, },

View file

@ -85,6 +85,7 @@ describe('config/migration', () => {
schedule: 'before 5am on Mondays', schedule: 'before 5am on Mondays',
}, },
], ],
raiseDeprecationWarnings: false,
}; };
const parentConfig = { ...defaultConfig, semanticCommits: false }; const parentConfig = { ...defaultConfig, semanticCommits: false };
const { isMigrated, migratedConfig } = configMigration.migrateConfig( const { isMigrated, migratedConfig } = configMigration.migrateConfig(

View file

@ -6,13 +6,13 @@ describe('workers/repository/process/deprecated', () => {
describe('raiseDeprecationWarnings()', () => { describe('raiseDeprecationWarnings()', () => {
it('returns if disabled', async () => { it('returns if disabled', async () => {
const config = { const config = {
raiseDeprecationWarnings: false, suppressNotifications: ['deprecationWarningIssues'],
}; };
await raiseDeprecationWarnings(config, {}); await raiseDeprecationWarnings(config, {});
}); });
it('raises deprecation warnings', async () => { it('raises deprecation warnings', async () => {
const config = { const config = {
raiseDeprecationWarnings: true, suppressNotifications: [],
}; };
const packageFiles = { const packageFiles = {
npm: [ npm: [

View file

@ -16,6 +16,7 @@ describe('workers/repository/process/extract-update', () => {
it('runs', async () => { it('runs', async () => {
const config = { const config = {
repoIsOnboarded: true, repoIsOnboarded: true,
suppressNotifications: ['deprecationWarningIssues']
}; };
await extractAndUpdate(config); await extractAndUpdate(config);
}); });

View file

@ -64,7 +64,6 @@ Array [
"prHourlyLimit": 0, "prHourlyLimit": 0,
"prNotPendingHours": 25, "prNotPendingHours": 25,
"prTitle": null, "prTitle": null,
"raiseDeprecationWarnings": true,
"rangeStrategy": "replace", "rangeStrategy": "replace",
"rebaseLabel": "rebase", "rebaseLabel": "rebase",
"rebaseStalePrs": null, "rebaseStalePrs": null,
@ -158,7 +157,6 @@ Array [
"prHourlyLimit": 0, "prHourlyLimit": 0,
"prNotPendingHours": 25, "prNotPendingHours": 25,
"prTitle": null, "prTitle": null,
"raiseDeprecationWarnings": true,
"rangeStrategy": "replace", "rangeStrategy": "replace",
"rebaseLabel": "rebase", "rebaseLabel": "rebase",
"rebaseStalePrs": null, "rebaseStalePrs": null,
@ -249,7 +247,6 @@ Array [
"prHourlyLimit": 0, "prHourlyLimit": 0,
"prNotPendingHours": 25, "prNotPendingHours": 25,
"prTitle": null, "prTitle": null,
"raiseDeprecationWarnings": true,
"rangeStrategy": "replace", "rangeStrategy": "replace",
"rebaseLabel": "rebase", "rebaseLabel": "rebase",
"rebaseStalePrs": true, "rebaseStalePrs": true,
@ -346,7 +343,6 @@ Array [
"prHourlyLimit": 0, "prHourlyLimit": 0,
"prNotPendingHours": 25, "prNotPendingHours": 25,
"prTitle": null, "prTitle": null,
"raiseDeprecationWarnings": true,
"rangeStrategy": "replace", "rangeStrategy": "replace",
"rebaseLabel": "rebase", "rebaseLabel": "rebase",
"rebaseStalePrs": null, "rebaseStalePrs": null,
@ -437,7 +433,6 @@ Array [
"prHourlyLimit": 0, "prHourlyLimit": 0,
"prNotPendingHours": 25, "prNotPendingHours": 25,
"prTitle": null, "prTitle": null,
"raiseDeprecationWarnings": true,
"rangeStrategy": "replace", "rangeStrategy": "replace",
"rebaseLabel": "rebase", "rebaseLabel": "rebase",
"rebaseStalePrs": true, "rebaseStalePrs": true,
@ -534,7 +529,6 @@ Array [
"prHourlyLimit": 0, "prHourlyLimit": 0,
"prNotPendingHours": 25, "prNotPendingHours": 25,
"prTitle": null, "prTitle": null,
"raiseDeprecationWarnings": true,
"rangeStrategy": "replace", "rangeStrategy": "replace",
"rebaseLabel": "rebase", "rebaseLabel": "rebase",
"rebaseStalePrs": null, "rebaseStalePrs": null,
@ -628,7 +622,6 @@ Array [
"prHourlyLimit": 0, "prHourlyLimit": 0,
"prNotPendingHours": 25, "prNotPendingHours": 25,
"prTitle": null, "prTitle": null,
"raiseDeprecationWarnings": true,
"rangeStrategy": "replace", "rangeStrategy": "replace",
"rebaseLabel": "rebase", "rebaseLabel": "rebase",
"rebaseStalePrs": null, "rebaseStalePrs": null,
@ -722,7 +715,6 @@ Array [
"prHourlyLimit": 0, "prHourlyLimit": 0,
"prNotPendingHours": 25, "prNotPendingHours": 25,
"prTitle": null, "prTitle": null,
"raiseDeprecationWarnings": true,
"rangeStrategy": "replace", "rangeStrategy": "replace",
"rebaseLabel": "rebase", "rebaseLabel": "rebase",
"rebaseStalePrs": null, "rebaseStalePrs": null,

View file

@ -686,8 +686,6 @@ The PR title is important for some of Renovate's matching algorithms (e.g. deter
Currently the only Python package manager is `pip` - specifically for `requirements.txt` and `requirequirements.pip` files - so adding any config to this `python` object is essentially the same as adding it to the `pip_requirements` object instead. Currently the only Python package manager is `pip` - specifically for `requirements.txt` and `requirequirements.pip` files - so adding any config to this `python` object is essentially the same as adding it to the `pip_requirements` object instead.
## raiseDeprecationWarnings
## rangeStrategy ## rangeStrategy
Behaviour: Behaviour: