Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(migrations): raiseDeprecationWarnings #13761

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 0 additions & 7 deletions lib/config/migration.ts
Expand Up @@ -425,13 +425,6 @@ export function migrateConfig(
if (subMigrate.isMigrated) {
migratedConfig[key] = subMigrate.migratedConfig;
}
} else if (key === 'raiseDeprecationWarnings') {
delete migratedConfig.raiseDeprecationWarnings;
if (val === false) {
migratedConfig.suppressNotifications =
migratedConfig.suppressNotifications || [];
migratedConfig.suppressNotifications.push('deprecationWarningIssues');
}
} else if (key === 'azureAutoComplete' || key === 'gitLabAutomerge') {
if (migratedConfig[key] !== undefined) {
migratedConfig.platformAutomerge = migratedConfig[key];
Expand Down
@@ -0,0 +1,31 @@
import { RaiseDeprecationWarningsMigration } from './raise-deprecation-warnings-migration';

describe('config/migrations/custom/raise-deprecation-warnings-migration', () => {
it('should migrate false', () => {
expect(RaiseDeprecationWarningsMigration).toMigrate(
{ raiseDeprecationWarnings: false },
{
suppressNotifications: ['deprecationWarningIssues'],
}
);
});

it('should migrate false and concat with existing value', () => {
expect(RaiseDeprecationWarningsMigration).toMigrate(
{
raiseDeprecationWarnings: false,
suppressNotifications: ['test'],
},
{ suppressNotifications: ['test', 'deprecationWarningIssues'] }
);
});

it('should just remove property when raiseDeprecationWarnings not equals to true', () => {
expect(RaiseDeprecationWarningsMigration).toMigrate(
{
raiseDeprecationWarnings: true,
},
{}
);
});
});
@@ -0,0 +1,19 @@
import { AbstractMigration } from '../base/abstract-migration';

export class RaiseDeprecationWarningsMigration extends AbstractMigration {
override readonly deprecated = true;
override readonly propertyName = 'raiseDeprecationWarnings';

override run(value: unknown): void {
const suppressNotifications = this.get('suppressNotifications');

if (value === false) {
this.setHard(
'suppressNotifications',
Array.isArray(suppressNotifications)
? suppressNotifications.concat(['deprecationWarningIssues'])
: ['deprecationWarningIssues']
);
}
}
}
2 changes: 2 additions & 0 deletions lib/config/migrations/migrations-service.ts
Expand Up @@ -8,6 +8,7 @@ import { EnabledManagersMigration } from './custom/enabled-managers-migration';
import { GoModTidyMigration } from './custom/go-mod-tidy-migration';
import { IgnoreNodeModulesMigration } from './custom/ignore-node-modules-migration';
import { PinVersionsMigration } from './custom/pin-versions-migration';
import { RaiseDeprecationWarningsMigration } from './custom/raise-deprecation-warnings-migration';
import { RebaseConflictedPrs } from './custom/rebase-conflicted-prs-migration';
import { RebaseStalePrsMigration } from './custom/rebase-stale-prs-migration';
import { RequiredStatusChecksMigration } from './custom/required-status-checks-migration';
Expand Down Expand Up @@ -51,6 +52,7 @@ export class MigrationsService {
GoModTidyMigration,
IgnoreNodeModulesMigration,
PinVersionsMigration,
RaiseDeprecationWarningsMigration,
RebaseConflictedPrs,
RebaseStalePrsMigration,
RequiredStatusChecksMigration,
Expand Down