Always flag tags as incomplete rather than outdated when the changes are purely additive

This commit is contained in:
Quincy Morgan
2019-11-25 11:14:59 -05:00
parent 9f8e88a2ff
commit be6e69c2e2
2 changed files with 9 additions and 11 deletions

View File

@@ -478,8 +478,8 @@ A feature does not have enough tags to define what it is.
A feature has nonstandard tags.
* `deprecated_tags`: the feature has tags listed in `deprecated.json` or matches a preset with a `replacement` property
* `incomplete_tags`: the feature does not have all tags from the `addTags` property of its matching preset
* `deprecated_tags`: the feature has tags that should be replaced or removed, as specified in `deprecated.json` or the `replacement` property of a preset
* `incomplete_tags`: the feature has tags that indicate it should also have some other tags
* `noncanonical_brand`: the feature indicates it should match a name-suggestion-index entry but does not have all of the given tags
* `old_multipolygon`: the feature is a multipolygon relation with its defining tags set on its outer member way

View File

@@ -32,7 +32,6 @@ export function validationOutdatedTags(context) {
function oldTagIssues(entity, graph) {
var oldTags = Object.assign({}, entity.tags); // shallow copy
var preset = context.presets().match(entity, graph);
var explicitPresetUpgrade = preset.replacement;
var subtype = 'deprecated_tags';
// upgrade preset..
@@ -58,9 +57,6 @@ export function validationOutdatedTags(context) {
Object.keys(preset.addTags).forEach(function(k) {
if (!newTags[k]) {
newTags[k] = preset.addTags[k];
if (!explicitPresetUpgrade) {
subtype = 'incomplete_tags';
}
}
});
}
@@ -121,15 +117,19 @@ export function validationOutdatedTags(context) {
}
}
// determine diff
var tagDiff = utilTagDiff(oldTags, newTags);
if (!tagDiff.length) return [];
var isOnlyAddingTags = tagDiff.every(function(d) {
return d.type === '+';
});
var prefix = '';
if (subtype === 'noncanonical_brand') {
prefix = 'noncanonical_brand.';
} else if (subtype === 'incomplete_tags') {
} else if (subtype === 'deprecated_tags' && isOnlyAddingTags) {
subtype = 'incomplete_tags';
prefix = 'incomplete.';
}
@@ -181,9 +181,7 @@ export function validationOutdatedTags(context) {
var messageID = 'issues.outdated_tags.' + prefix + 'message';
if (subtype === 'noncanonical_brand' && tagDiff.every(function(d) {
return d.type === '+';
})) {
if (subtype === 'noncanonical_brand' && isOnlyAddingTags) {
messageID += '_incomplete';
}