Optimize oldTagIssues method by reordering the checks (#9434)

The hasInterestingTags skips most entities and is light to run - in contrary to presetManager.match
This commit is contained in:
Kamil Monicz
2022-12-20 18:53:09 +01:00
committed by GitHub
parent 37e2131ec5
commit 65da698886

View File

@@ -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);