diff --git a/lib/config/__snapshots__/migration.spec.ts.snap b/lib/config/__snapshots__/migration.spec.ts.snap index b3f0b3deb66552..c10def2c2227f4 100644 --- a/lib/config/__snapshots__/migration.spec.ts.snap +++ b/lib/config/__snapshots__/migration.spec.ts.snap @@ -292,7 +292,6 @@ exports[`config/migration migrateConfig(config, parentConfig) migrates config 1` "separateMinorPatch": true, "suppressNotifications": [ "lockFileErrors", - "deprecationWarningIssues", ], "travis": { "enabled": true, diff --git a/lib/config/migrations/custom/raise-deprecation-warnings-migration.spec.ts b/lib/config/migrations/custom/raise-deprecation-warnings-migration.spec.ts deleted file mode 100644 index 62921740777e1f..00000000000000 --- a/lib/config/migrations/custom/raise-deprecation-warnings-migration.spec.ts +++ /dev/null @@ -1,31 +0,0 @@ -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, - }, - {}, - ); - }); -}); diff --git a/lib/config/migrations/custom/raise-deprecation-warnings-migration.ts b/lib/config/migrations/custom/raise-deprecation-warnings-migration.ts deleted file mode 100644 index fa04aeedb20168..00000000000000 --- a/lib/config/migrations/custom/raise-deprecation-warnings-migration.ts +++ /dev/null @@ -1,19 +0,0 @@ -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'], - ); - } - } -} diff --git a/lib/config/migrations/migrations-service.ts b/lib/config/migrations/migrations-service.ts index 184f4df9ca3ec5..007afe878d8129 100644 --- a/lib/config/migrations/migrations-service.ts +++ b/lib/config/migrations/migrations-service.ts @@ -39,7 +39,6 @@ import { PackagesMigration } from './custom/packages-migration'; import { PathRulesMigration } from './custom/path-rules-migration'; import { PinVersionsMigration } from './custom/pin-versions-migration'; import { PostUpdateOptionsMigration } from './custom/post-update-options-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 { RecreateClosedMigration } from './custom/recreate-closed-migration'; @@ -76,6 +75,7 @@ export class MigrationsService { 'yarnMaintenanceCommitMessage', 'yarnMaintenancePrBody', 'yarnMaintenancePrTitle', + 'raiseDeprecationWarnings', ]); static readonly renamedProperties: ReadonlyMap = new Map([ @@ -129,7 +129,6 @@ export class MigrationsService { PathRulesMigration, PinVersionsMigration, PostUpdateOptionsMigration, - RaiseDeprecationWarningsMigration, RebaseConflictedPrs, RebaseStalePrsMigration, RenovateForkMigration, diff --git a/lib/config/options/index.ts b/lib/config/options/index.ts index 2f6450fe1ed46c..9bb63958869327 100644 --- a/lib/config/options/index.ts +++ b/lib/config/options/index.ts @@ -2802,13 +2802,12 @@ const options: RenovateOptions[] = [ 'Options to suppress various types of warnings and other notifications.', type: 'array', subType: 'string', - default: ['deprecationWarningIssues'], + default: [], allowedValues: [ 'artifactErrors', 'branchAutomergeFailure', 'configErrorIssue', 'dependencyLookupWarnings', - 'deprecationWarningIssues', 'lockFileErrors', 'missingCredentialsError', 'onboardingClose', diff --git a/lib/workers/repository/error-config.spec.ts b/lib/workers/repository/error-config.spec.ts index f3dc7fb6f05dfd..c5eefe6d541f51 100644 --- a/lib/workers/repository/error-config.spec.ts +++ b/lib/workers/repository/error-config.spec.ts @@ -17,7 +17,6 @@ beforeEach(() => { // default values config = partial({ onboardingBranch: 'configure/renovate', - suppressNotifications: ['deprecationWarningIssues'], configWarningReuseIssue: true, confidential: false, }); @@ -127,7 +126,6 @@ Message: some-message const error = new Error(CONFIG_VALIDATION); error.validationSource = 'package.json'; error.validationMessage = 'some-message'; - // config.suppressNotifications = ['deprecationWarningIssues'] config.suppressNotifications = [notificationName]; platform.getBranchPr.mockResolvedValueOnce({ ...mock(), diff --git a/lib/workers/repository/process/deprecated.spec.ts b/lib/workers/repository/process/deprecated.spec.ts deleted file mode 100644 index 1f15b73f6db1fe..00000000000000 --- a/lib/workers/repository/process/deprecated.spec.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { RenovateConfig, platform } from '../../../../test/util'; -import { raiseDeprecationWarnings } from './deprecated'; - -describe('workers/repository/process/deprecated', () => { - describe('raiseDeprecationWarnings()', () => { - it('returns if onboarding', async () => { - const config = {}; - await expect(raiseDeprecationWarnings(config, {})).resolves.not.toThrow(); - }); - - it('returns if disabled', async () => { - const config: RenovateConfig = { - repoIsOnboarded: true, - suppressNotifications: ['deprecationWarningIssues'], - }; - await expect(raiseDeprecationWarnings(config, {})).resolves.not.toThrow(); - }); - - it('returns if in silent mode', async () => { - const config: RenovateConfig = { - repoIsOnboarded: true, - suppressNotifications: [], - mode: 'silent', - }; - await expect(raiseDeprecationWarnings(config, {})).resolves.not.toThrow(); - }); - - it('raises deprecation warnings', async () => { - const config: RenovateConfig = { - repoIsOnboarded: true, - suppressNotifications: [], - }; - const packageFiles = { - npm: [ - { - packageFile: 'package.json', - deps: [ - { - depName: 'foo', - deprecationMessage: 'foo is deprecated', - }, - { - depName: 'bar', - }, - ], - }, - { - packageFile: 'backend/package.json', - deps: [], - }, - { - packageFile: 'frontend/package.json', - deps: [ - { - depName: 'abc', - }, - { - depName: 'foo', - deprecationMessage: 'foo is deprecated', - }, - ], - }, - ], - }; - const mockIssue = [ - { - title: 'Dependency deprecation warning: mockDependency (mockManager)', - state: 'open', - }, - ]; - platform.getIssueList.mockResolvedValue(mockIssue); - await raiseDeprecationWarnings(config, packageFiles); - expect(platform.ensureIssue.mock.calls).toMatchObject([ - [{ once: true, title: 'Dependency deprecation warning: foo (npm)' }], - ]); - expect(platform.getIssueList).toHaveBeenCalledTimes(1); - expect(platform.ensureIssue).toHaveBeenCalledTimes(1); - }); - }); -}); diff --git a/lib/workers/repository/process/deprecated.ts b/lib/workers/repository/process/deprecated.ts deleted file mode 100644 index 0a27d71b531572..00000000000000 --- a/lib/workers/repository/process/deprecated.ts +++ /dev/null @@ -1,94 +0,0 @@ -// TODO #22198 -import { GlobalConfig } from '../../../config/global'; -import type { RenovateConfig } from '../../../config/types'; -import { logger } from '../../../logger'; -import type { PackageFile } from '../../../modules/manager/types'; -import { platform } from '../../../modules/platform'; - -export async function raiseDeprecationWarnings( - config: RenovateConfig, - packageFiles: Record, -): Promise { - if (!config.repoIsOnboarded) { - return; - } - if (config.suppressNotifications?.includes('deprecationWarningIssues')) { - return; - } - if (config.mode === 'silent') { - logger.debug( - `Deprecation warning issues are not created, updated or closed when mode=silent`, - ); - return; - } - for (const [manager, files] of Object.entries(packageFiles)) { - const deprecatedPackages: Record< - string, - { deprecationMessage?: string; depPackageFiles: string[] } - > = {}; - for (const packageFile of files) { - for (const dep of packageFile.deps) { - const { deprecationMessage } = dep; - if (deprecationMessage) { - deprecatedPackages[dep.depName!] = deprecatedPackages[ - dep.depName! - ] || { - deprecationMessage, - depPackageFiles: [], - }; - deprecatedPackages[dep.depName!].depPackageFiles.push( - packageFile.packageFile, - ); - } - } - } - - logger.debug({ deprecatedPackages }); - const issueTitleList: string[] = []; - const issueTitlePrefix = 'Dependency deprecation warning:'; - for (const [depName, val] of Object.entries(deprecatedPackages)) { - const { deprecationMessage, depPackageFiles } = val; - logger.debug( - { - depName, - deprecationMessage, - packageFiles: depPackageFiles, - }, - 'dependency is deprecated', - ); - const issueTitle = `${issueTitlePrefix} ${depName} (${manager})`; - issueTitleList.push(issueTitle); - let issueBody = deprecationMessage; - issueBody += `\n\nAffected package file(s): ${depPackageFiles - .map((f) => '`' + f + '`') - .join(', ')}`; - issueBody += `\n\nIf you don't care about this, you can close this issue and not be warned about \`${depName}\`'s deprecation again. If you would like to completely disable all future deprecation warnings then add the following to your config:\n\n\`\`\`\n"suppressNotifications": ["deprecationWarningIssues"]\n\`\`\`\n\n`; - // istanbul ignore if - if (GlobalConfig.get('dryRun')) { - logger.info('DRY-RUN: Ensure deprecation warning issue for ' + depName); - } else { - const ensureOnce = true; - await platform.ensureIssue({ - title: issueTitle, - body: issueBody!, - once: ensureOnce, - confidential: config.confidential, - }); - } - } - logger.debug( - 'Checking for existing deprecated package issues missing in current deprecatedPackages', - ); - const issueList = await platform.getIssueList(); - if (issueList?.length) { - const deprecatedIssues = issueList.filter( - (i) => i.title!.startsWith(issueTitlePrefix) && i.state === 'open', - ); - for (const i of deprecatedIssues) { - if (!issueTitleList.includes(i.title!)) { - await platform.ensureIssueClosing(i.title!); - } - } - } - } -} diff --git a/lib/workers/repository/process/extract-update.spec.ts b/lib/workers/repository/process/extract-update.spec.ts index ab25d07bdb1f19..21627e84b9c797 100644 --- a/lib/workers/repository/process/extract-update.spec.ts +++ b/lib/workers/repository/process/extract-update.spec.ts @@ -50,7 +50,6 @@ describe('workers/repository/process/extract-update', () => { it('runs with no baseBranches', async () => { const config = { repoIsOnboarded: true, - suppressNotifications: ['deprecationWarningIssues'], }; repositoryCache.getCache.mockReturnValueOnce({ scan: {} }); scm.checkoutBranch.mockResolvedValueOnce('123test' as LongCommitSha); @@ -75,7 +74,6 @@ describe('workers/repository/process/extract-update', () => { const config = { baseBranches: ['master', 'dev'], repoIsOnboarded: true, - suppressNotifications: ['deprecationWarningIssues'], enabledManagers: ['npm'], javascript: { labels: ['js'], @@ -94,7 +92,6 @@ describe('workers/repository/process/extract-update', () => { const packageFiles: Record = {}; const config = { repoIsOnboarded: true, - suppressNotifications: ['deprecationWarningIssues'], baseBranch: 'master', }; repositoryCache.getCache.mockReturnValueOnce({ @@ -116,7 +113,6 @@ describe('workers/repository/process/extract-update', () => { it('fetches vulnerabilities', async () => { const config = { repoIsOnboarded: true, - suppressNotifications: ['deprecationWarningIssues'], osvVulnerabilityAlerts: true, }; const appendVulnerabilityPackageRulesMock = jest.fn(); @@ -136,7 +132,6 @@ describe('workers/repository/process/extract-update', () => { it('handles exception when fetching vulnerabilities', async () => { const config = { repoIsOnboarded: true, - suppressNotifications: ['deprecationWarningIssues'], osvVulnerabilityAlerts: true, }; createVulnerabilitiesMock.mockRejectedValueOnce(new Error()); diff --git a/lib/workers/repository/process/extract-update.ts b/lib/workers/repository/process/extract-update.ts index aceaab7f407fde..a7b611d659ee56 100644 --- a/lib/workers/repository/process/extract-update.ts +++ b/lib/workers/repository/process/extract-update.ts @@ -12,7 +12,6 @@ import type { BranchConfig } from '../../types'; import { extractAllDependencies } from '../extract'; import { generateFingerprintConfig } from '../extract/extract-fingerprint-config'; import { branchifyUpgrades } from '../updates/branchify'; -import { raiseDeprecationWarnings } from './deprecated'; import { fetchUpdates } from './fetch'; import { sortBranches } from './sort'; import { Vulnerabilities } from './vulnerabilities'; @@ -191,7 +190,6 @@ export async function lookup( ): Promise { await fetchVulnerabilities(config, packageFiles); await fetchUpdates(config, packageFiles); - await raiseDeprecationWarnings(config, packageFiles); const { branches, branchList } = await branchifyUpgrades( config, packageFiles,