From 65da698886edf7fef4d31aebca1c3f11320632ce Mon Sep 17 00:00:00 2001 From: Kamil Monicz Date: Tue, 20 Dec 2022 18:53:09 +0100 Subject: [PATCH] Optimize oldTagIssues method by reordering the checks (#9434) The hasInterestingTags skips most entities and is light to run - in contrary to presetManager.match --- modules/validations/outdated_tags.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/validations/outdated_tags.js b/modules/validations/outdated_tags.js index 5c8b5a929..02114b927 100644 --- a/modules/validations/outdated_tags.js +++ b/modules/validations/outdated_tags.js @@ -24,12 +24,14 @@ export function validationOutdatedTags() { function oldTagIssues(entity, graph) { - const oldTags = Object.assign({}, entity.tags); // shallow copy - let preset = presetManager.match(entity, graph); - let subtype = 'deprecated_tags'; - if (!preset) return []; if (!entity.hasInterestingTags()) return []; + let preset = presetManager.match(entity, graph); + if (!preset) return []; + + const oldTags = Object.assign({}, entity.tags); // shallow copy + let subtype = 'deprecated_tags'; + // Upgrade preset, if a replacement is available.. if (preset.replacement) { const newPreset = presetManager.item(preset.replacement);