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

View file

@ -389,6 +389,13 @@ function migrateConfig(config) {
.replace(/newVersion/g, 'newValue')
.replace(/newValueMajor/g, 'newMajor')
.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) {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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