From 9fca611ec1f5fa3af83eb7e603b0246501e2a718 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Tue, 31 Dec 2019 22:23:09 +0000 Subject: [PATCH] Add support for even more Osmose error types - Conflicting tags - Orthographic errors (excess whitespace and all capital names) - Deprecated tagging - Bad use of the "area" tag --- css/65_data.css | 4 ++++ data/core.yaml | 22 ++++++++++++++++++- data/qa_errors.json | 13 +++++++++++ dist/locales/en.json | 31 ++++++++++++++++++++++++++- modules/services/osmose.js | 10 ++++----- svg/fontawesome/fas-sort-alpha-up.svg | 1 + svg/fontawesome/fas-yin-yang.svg | 1 + 7 files changed, 75 insertions(+), 7 deletions(-) create mode 100644 svg/fontawesome/fas-sort-alpha-up.svg create mode 100644 svg/fontawesome/fas-yin-yang.svg diff --git a/css/65_data.css b/css/65_data.css index 503fca1a7..21461c37a 100644 --- a/css/65_data.css +++ b/css/65_data.css @@ -177,15 +177,19 @@ .osmose.item-3040, .osmose.item-3090, .osmose.item-3161, +.osmose.item-3200, .osmose.item-3220, .osmose.item-3250 { color: #2D9359; } +.osmose.item-4010, +.osmose.item-4030, .osmose.item-4080 { color: #F2F230; } +.osmose.item-5010, .osmose.item-5070 { color: #EC0000; } diff --git a/data/core.yaml b/data/core.yaml index fbc6491c9..67a7f6912 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -868,7 +868,7 @@ en: description: '{0} should be on the highway or part of an "enforcement" relation.' 2110-21101: title: 'Unknown Named Object' - description: '{0} has a name but no main tag.' + description: '{0} has a name but no feature tag.' 2110-21102: title: 'Missing Relation Type' description: '{0} is missing a "type" tag.' @@ -881,15 +881,35 @@ en: 3161: title: 'Missing Parking Access' description: 'There is no highway leading to {0}.' + 3200: + title: 'Invalid Area Tagging' + 3200-32001: + description: '{0} is tagged "area=yes", but this feature is an area by default.' + 3200-32002: + description: '{0} has an "area" tag, but no feature tag.' + 3200-32003: + description: '{0} is tagged "area=no", but this feature already isn''t an area.' 3220: title: 'All Access Allowed' description: '{0} has an "access=yes" or "access=permissive" tag which permits use by all transport modes (ski, horse, hazmat, etc.).' 3250-32501: title: 'Invalid Opening Hours' description: '{0} has an invalid value for the "opening_hours" tag.' + 4010: + title: 'Deprecated Tagging' + description: '{0} uses tag "{1}" which is deprecated in favour of "{2}".' + 4030-900: + title: 'Conflicting Tags' + description: '{0} is tagged with both "{1}" and "{2}".' 4080: title: 'Object Mapped Twice' description: '{0} and {1} both appear to represent the same object.' + 5010: + title: 'Orthographic Error' + 5010-803: + description: 'The "name" of {0} is written in all capitals.' + 5010-903: + description: 'The "name" of {0} has excessive space characters.' 5070-50703: title: 'Unexpected Symbol' description: '{0} has an unexpected symbol, {2}, in the "{1}" tag.' diff --git a/data/qa_errors.json b/data/qa_errors.json index 374d553ea..d73d98816 100644 --- a/data/qa_errors.json +++ b/data/qa_errors.json @@ -23,11 +23,16 @@ "3040", "3090", "3161", + "3200", "3220", "3250", + "4010", + "4030", "4080", + "5010", "7040", "7090", + "5010", "5070", "8300", "8360", @@ -57,12 +62,20 @@ "3090-3090": "fas-calendar-alt", "3161-1": "maki-parking", "3161-2": "maki-parking", + "3200-32001": "fas-vector-square", + "3200-32002": "fas-vector-square", + "3200-32003": "fas-vector-square", "3220-32200": "maki-roadblock", "3220-32201": "maki-roadblock", "3250-32501": "maki-watch", + "4010-4010": "maki-waste-basket", + "4010-40102": "maki-waste-basket", + "4030-900": "fas-yin-yang", "4080-1": "far-dot-circle", "4080-2": "far-dot-circle", "4080-3": "far-dot-circle", + "5010-803": "fas-sort-alpha-up", + "5010-903": "fas-rocket", "5070-50703": "fas-tint-slash", "5070-50704": "fas-code", "5070-50705": "fas-question", diff --git a/dist/locales/en.json b/dist/locales/en.json index d396d060b..1d212bee1 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -1054,14 +1054,24 @@ "title": "Missing Parking Access", "description": "There is no highway leading to {0}." }, + "3200": { + "title": "Invalid Area Tagging" + }, "3220": { "title": "All Access Allowed", "description": "{0} has an \"access=yes\" or \"access=permissive\" tag which permits use by all transport modes (ski, horse, hazmat, etc.)." }, + "4010": { + "title": "Deprecated Tagging", + "description": "{0} uses tag \"{1}\" which is deprecated in favour of \"{2}\"." + }, "4080": { "title": "Object Mapped Twice", "description": "{0} and {1} both appear to represent the same object." }, + "5010": { + "title": "Orthographic Error" + }, "7040": { "title": "Unfinished Power Line", "description": "A power line appears to be unfinished at {0}." @@ -1124,7 +1134,7 @@ }, "2110-21101": { "title": "Unknown Named Object", - "description": "{0} has a name but no main tag." + "description": "{0} has a name but no feature tag." }, "2110-21102": { "title": "Missing Relation Type", @@ -1138,10 +1148,29 @@ "title": "Invalid Date", "description": "{0} is tagged with an invalid date value: \"{1}\"." }, + "3200-32001": { + "description": "{0} is tagged \"area=yes\", but this feature is an area by default." + }, + "3200-32002": { + "description": "{0} has an \"area\" tag, but no feature tag." + }, + "3200-32003": { + "description": "{0} is tagged \"area=no\", but this feature already isn't an area." + }, "3250-32501": { "title": "Invalid Opening Hours", "description": "{0} has an invalid value for the \"opening_hours\" tag." }, + "4030-900": { + "title": "Conflicting Tags", + "description": "{0} is tagged with both \"{1}\" and \"{2}\"." + }, + "5010-803": { + "description": "The \"name\" of {0} is written in all capitals." + }, + "5010-903": { + "description": "The \"name\" of {0} has excessive space characters." + }, "5070-50703": { "title": "Unexpected Symbol", "description": "{0} has an unexpected symbol, {2}, in the \"{1}\" tag." diff --git a/modules/services/osmose.js b/modules/services/osmose.js index 74cb2c461..c0ccbe44c 100644 --- a/modules/services/osmose.js +++ b/modules/services/osmose.js @@ -3,7 +3,7 @@ import RBush from 'rbush'; import { dispatch as d3_dispatch } from 'd3-dispatch'; import { json as d3_json } from 'd3-fetch'; -import { dataEn } from '../../data'; +import { t } from '../util/locale'; import { geoExtent, geoVecAdd } from '../geo'; import { qaError } from '../osm'; import { utilRebind, utilTiler, utilQsString } from '../util'; @@ -143,8 +143,6 @@ export default { switch (d.item) { case 8300: case 8360: { - // Parts only exists for these error types - let { parts } = dataEn.QA.osmose.error_types[d.item]; let k = error_class; // First 17 classes are all speed limits @@ -153,7 +151,7 @@ export default { } // Setting elems here prevents UI error detail requests - d.replacements = [parts[k]]; + d.replacements = [t(`QA.osmose.error_types.${d.item}.parts.${k}`)]; d.elems = []; break; } @@ -174,7 +172,6 @@ export default { }); }, - // todo: &item=1090%2C1110%2C1120%2C3010%2C3020%2C3032%2C3050%2C3060%2C3091%2C3092%2C3150%2C3180%2C3190%2C3200%2C3210%2C4010%2C4030%2C5010%2C5020%2C5030%2C5040%2C5050%2C5080%2C6030%2C9000%2C9001 loadErrorDetail(d, callback) { // Error details only need to be fetched once if (d.elems !== undefined) { @@ -197,6 +194,9 @@ export default { const special = { '3040-3040': /Bad value for (.+)/i, '3090-3090': /Incorrect date "(.+)"/i, + '4010-4010': /Tag (.+) is deprecated: (.+)/i, + '4010-40102': /Tag (.+) is deprecated: (.+)/i, + '4030-900': /Conflict between tags: (.+), (.+)/i, '5070-50703': /"(.+)"=".+" unexpected symbol char \(.+, (.+)\)/i, '5070-50704': /Umbalanced (.+)/i, '5070-50705': /Unexpected char (.+)/i, diff --git a/svg/fontawesome/fas-sort-alpha-up.svg b/svg/fontawesome/fas-sort-alpha-up.svg new file mode 100644 index 000000000..8ebf95f8f --- /dev/null +++ b/svg/fontawesome/fas-sort-alpha-up.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/svg/fontawesome/fas-yin-yang.svg b/svg/fontawesome/fas-yin-yang.svg new file mode 100644 index 000000000..5d70c62f4 --- /dev/null +++ b/svg/fontawesome/fas-yin-yang.svg @@ -0,0 +1 @@ + \ No newline at end of file