Relax some more regex for tag parsing, (to support 'key=*')

Also implement parsing error 231 - layer conflict
This commit is contained in:
Bryan Housel
2019-01-02 13:39:21 -05:00
parent 2ec02f369f
commit 9557c0204a
6 changed files with 39 additions and 171 deletions
+4 -3
View File
@@ -673,7 +673,7 @@ en:
description: 'There is more than one node in this spot. Node IDs: {var1}.'
30:
title: 'Non-closed areas'
description: 'This way is tagged with "{var1}={var2}" and should be a closed loop.'
description: 'This way is tagged with "{var1}" and should be a closed loop.'
40:
title: 'Impossible oneways'
description: 'The first node {var1} of this oneway is not connected to any other way.'
@@ -688,7 +688,7 @@ en:
description: 'This node is very close but not connected to way {var1}.'
60:
title: 'Deprecated tags'
description: 'This {var1} uses deprecated tag "{var2}={var3}". Please use "{var4}" instead.'
description: 'This {var1} uses deprecated tag "{var2}". Please use "{var3}" instead.'
70:
title: 'Missing tags'
description: 'This {var1} has an empty tag: "{var2}".'
@@ -752,6 +752,7 @@ en:
description: 'This node is a junction of ways on different layers.'
231:
description: 'This node is a junction of ways on different layers: {var1}.'
layer: '(layer: {layer})'
232:
description: 'This {var1} is tagged with "layer={var2}". This need not be an error but it looks strange.'
270:
@@ -792,7 +793,7 @@ en:
description: '"from" and "to" members of turn restrictions need to be ways. {var1}.'
295:
title: 'Restriction "via" is not on the way ends'
description: '"via" (node {var1}) is not the first or the last member of "from" (way {var2}).'
description: '"via" (node {var1}) is not the first or the last member of "{var2}" (way {var3}).'
296:
title: 'Wrong restriction angle'
description: 'Restriction type is "{var1}" but angle is {var2} degrees. Maybe the restriction type is not appropriate?'
+15 -123
View File
@@ -10,8 +10,8 @@
"30": {
"title": "non-closed_areas",
"severity": "error",
"description": "This way is tagged with '$1=$2' and should be closed-loop.",
"regex": "'([\\w:]+)=(\\w+)'"
"description": "This way is tagged with '$1' and should be closed-loop.",
"regex": "'(.+)'"
},
"40": {
"title": "dead-ended one-ways",
@@ -47,8 +47,8 @@
"60": {
"title": "depreciated tags",
"severity": "warning",
"description": "This $1 uses deprecated tag $2 = $3. Please use $4 instead!",
"regex": "This (node|way|relation) uses deprecated tag '([\\w:]+)=(.+)'\\. Please use "(.+)" instead"
"description": "This $1 uses deprecated tag $2. Please use $3 instead!",
"regex": "This (node|way|relation) uses deprecated tag '(.+)'\\. Please use "(.+)""
},
"70": {
"title": "missing tags",
@@ -74,11 +74,11 @@
"title": "missing tags",
"severity": "error",
"description": "This $1 has an empty tag: $2",
"regex": "This (node|way|relation) has an empty tag: "([\\w:]+)=""
"regex": "This (node|way|relation) has an empty tag: "(.+)=""
},
"75": {
"description": "This (node|way|relation) has a name \\((.+)\\) but no other tag",
"regex": "This (node|way|relation) has a name \\((.+)\\) but no other tag"
"regex": "This (node|way|relation) has a name \\((.+)\\)"
},
"90": {
"title": "motorways without ref",
@@ -95,7 +95,7 @@
"title": "point of interest without name",
"severity": "error",
"description": "This node is tagged as $1 and therefore needs a name tag",
"regex": "as ([\\w:]+) and"
"regex": "as (.+) and"
},
"120": {
"title": "ways without nodes",
@@ -131,124 +131,16 @@
"190": {
"title": "intersections without junctions",
"severity": "error",
"description": "Finds way crossings on same layer without common node as a junction"
},
"191": {
"title": "highway-highway",
"severity": "error",
"description": "This (highway) intersects the (highway) #(\\d+) but there is no junction node",
"description": "This $1 intersects the $2 #$3 but there is no junction node",
"IDs": ["", "", "w"],
"regex": "This (highway) intersects the (highway) #(\\d+) but"
},
"192": {
"title": "highway-waterway",
"severity": "error",
"description": "This (highway|waterway) intersects the (highway|waterway) #(\\d+)",
"IDs": ["", "", "w"],
"regex": "This (highway|waterway) intersects the (highway|waterway) #(\\d+)"
},
"193": {
"title": "highway-riverbank",
"severity": "error",
"description": "This (highway|riverbank) intersects the (highway|riverbank) #(\\d+)",
"IDs": ["", "", "w"],
"regex": "This (highway|riverbank) intersects the (highway|riverbank) #(\\d+)"
},
"194": {
"title": "waterway-waterway",
"severity": "error",
"description": "This (waterway) intersects the (waterway) #(\\d+) but there is no junction node",
"IDs": ["", "","w"],
"regex": "This (waterway) intersects the (waterway) #(\\d+) but there is no junction node"
},
"195": {
"title": "cycleway-cycleway",
"severity": "error",
"description": "This (cycleway/footpath) intersects the (cycleway/footpath) #(\\d+) but there is no junction node",
"IDs": ["", "","w"],
"regex": "This (cycleway/footpath) intersects the (cycleway/footpath) #(\\d+) but there is no junction node"
},
"196": {
"title": "highway-cycleway",
"severity": "error",
"description": "This (highway|cycleway/footpath) intersects the (highway|cycleway/footpath) #(\\d+) but there is no junction node",
"IDs": ["", "","w"],
"regex": "This (highway|cycleway/footpath) intersects the (highway|cycleway/footpath) #(\\d+) but there is no junction node"
},
"197": {
"title": "cycleway-waterway",
"severity": "error",
"description": "This (waterway|cycleway/footpath) intersects the (waterway|cycleway/footpath) #(\\d+)",
"IDs": ["", "","w"],
"regex": "This (waterway|cycleway/footpath) intersects the (waterway|cycleway/footpath) #(\\d+)"
},
"198": {
"title": "cycleway-riverbank",
"severity": "error",
"description": "This (riverbank|cycleway/footpath) intersects the (riverbank|cycleway/footpath) #(\\d+)",
"IDs": ["", "","w"],
"regex": "This (riverbank|cycleway/footpath) intersects the (riverbank|cycleway/footpath) #(\\d+)"
"regex": "This (.+) intersects the (.+) #(\\d+)"
},
"200": {
"title": "overlapping ways",
"severity": "error",
"description": "Finds overlapping ways on same layer"
},
"201": {
"title": "highway-highway",
"severity": "error",
"description": "This (highway) overlaps the (highway) #(\\d+)",
"IDs": ["", "","w"],
"regex": "This (highway) overlaps the (highway) #(\\d+)"
},
"202": {
"title": "highway-waterway",
"severity": "error",
"description": "This (highway|waterway) overlaps the (highway|waterway) #(\\d+)",
"IDs": ["", "","w"],
"regex": "This (highway|waterway) overlaps the (highway|waterway) #(\\d+)"
},
"203": {
"title": "highway-riverbank",
"severity": "error",
"description": "This (highway|riverbank) overlaps the (highway|riverbank) #(\\d+)",
"IDs": ["", "","w"],
"regex": "This (highway|riverbank) overlaps the (highway|riverbank) #(\\d+)"
},
"204": {
"title": "waterway-waterway",
"severity": "error",
"description": "This (waterway) overlaps the (waterway) #(\\d+)",
"IDs": ["", "","w"],
"regex": "This (waterway) overlaps the (waterway) #(\\d+)"
},
"205": {
"title": "cycleway-cycleway",
"severity": "error",
"description": "This (cycleway/footpath) overlaps the (cycleway/footpath) #(\\d+)",
"IDs": ["", "","w"],
"regex": "This (cycleway/footpath) overlaps the (cycleway/footpath) #(\\d+)"
},
"206": {
"title": "highway-cycleway",
"severity": "error",
"description": "This (highway|cycleway/footpath) overlaps the (highway|cycleway/footpath) #(\\d+)",
"IDs": ["", "","w"],
"regex": "This (highway|cycleway/footpath) overlaps the (highway|cycleway/footpath) #(\\d+)"
},
"207": {
"title": "cycleway-waterway",
"severity": "error",
"description": "This (waterway|cycleway/footpath) overlaps the (waterway|cycleway/footpath) #(\\d+)",
"IDs": ["", "","w"],
"regex": "This (waterway|cycleway/footpath) overlaps the (waterway|cycleway/footpath) #(\\d+)"
},
"208": {
"title": "cycleway-riverbank",
"severity": "error",
"description": "This (riverbank|cycleway/footpath) overlaps the (riverbank|cycleway/footpath) #(\\d+)",
"IDs": ["", "","w"],
"regex": "This (riverbank|cycleway/footpath) overlaps the (riverbank|cycleway/footpath) #(\\d+)"
"description": "This $1 overlaps the $2 #$3",
"regex": "This (.+) overlaps the (.+) #(\\d+)"
},
"210": {
"title": "loopings",
@@ -289,7 +181,7 @@
"severity": "error",
"description": "This node is a junction of ways on different layers: $1",
"IDs": ["231"],
"regex": "layers: ((?:#\\d+\\(-?\\d+\\),?)+)"
"regex": "layers: (.+)"
},
"232": {
"title": "strange layers",
@@ -369,9 +261,9 @@
"295": {
"title": "via is not on the way ends",
"severity": "error",
"description": "via (node #$1) is not the first or the last member of from (way #$2)",
"description": "via (node #$1) is not the first or the last member of (from|to) (way #$3)",
"IDs": ["n","w"],
"regex": "via \\(node #(\\d+)\\) is not the first or the last member of from \\(way #(\\d+)\\)"
"regex": "via \\(node #(\\d+)\\) is not the first or the last member of (from|to) \\(way #(\\d+)\\)"
},
"296": {
"title": "wrong restriction angle",
@@ -412,7 +304,7 @@
"title": "wrong direction",
"severity": "error",
"description": "If this ((?:mini_)?roundabout) is in a country with (left|right)-hand traffic then its orientation goes the wrong way around",
"regex": "If this ((?:mini_)?roundabout) is in a country with (left|right)-hand traffic then its orientation goes the wrong way around"
"regex": "this ((?:mini_)?roundabout) is in a country with (left|right)-hand"
},
"313": {
"title": "faintly connected",
+5 -4
View File
@@ -815,7 +815,7 @@
},
"30": {
"title": "Non-closed areas",
"description": "This way is tagged with \"{var1}={var2}\" and should be a closed loop."
"description": "This way is tagged with \"{var1}\" and should be a closed loop."
},
"40": {
"title": "Impossible oneways",
@@ -836,7 +836,7 @@
},
"60": {
"title": "Deprecated tags",
"description": "This {var1} uses deprecated tag \"{var2}={var3}\". Please use \"{var4}\" instead."
"description": "This {var1} uses deprecated tag \"{var2}\". Please use \"{var3}\" instead."
},
"70": {
"title": "Missing tags",
@@ -923,7 +923,8 @@
"description": "This node is a junction of ways on different layers."
},
"231": {
"description": "This node is a junction of ways on different layers: {var1}."
"description": "This node is a junction of ways on different layers: {var1}.",
"layer": "(layer: {layer})"
},
"232": {
"description": "This {var1} is tagged with \"layer={var2}\". This need not be an error but it looks strange."
@@ -978,7 +979,7 @@
},
"295": {
"title": "Restriction \"via\" is not on the way ends",
"description": "\"via\" (node {var1}) is not the first or the last member of \"from\" (way {var2})."
"description": "\"via\" (node {var1}) is not the first or the last member of \"{var2}\" (way {var3})."
},
"296": {
"title": "Wrong restriction angle",
+13 -21
View File
@@ -120,7 +120,7 @@ function tokenReplacements(d) {
function parseError(group, idType) {
function fillPlaceholder(d) {
function linkEntity(d) {
return '<span><a class="kr_error_description-id">' + d + '</a></span>';
}
@@ -131,7 +131,7 @@ function parseError(group, idType) {
items.forEach(function(item) {
// ID has # at the front
var id = fillPlaceholder('n' + item.slice(1));
var id = linkEntity('n' + item.slice(1));
newList.push(id);
});
@@ -141,24 +141,16 @@ function parseError(group, idType) {
// arbitrary way list of form: #ID(layer),#ID(layer),#ID(layer)...
function parseError231(list) {
var newList = [];
var items = list.split(',');
// unfortunately 'layer' can itself contain commas, so we split on '),'
var items = list.split('),');
items.forEach(function(item) {
var id;
var layer;
// item of form "#ID(layer)"
item = item.split('(');
// ID has # at the front
id = item[0].slice(1);
id = fillPlaceholder('w' + id);
// layer has trailing )
layer = item[1].slice(0,-1);
// TODO: translation
newList.push(id + ' (layer: ' + layer + ')');
var match = item.match(/\#(\d+)\((.+)\)?/);
if (match !== null && match.length > 2) {
newList.push(linkEntity('w' + match[1])
+ t('QA.keepRight.errorTypes.231.layer', { layer: match[2] })
);
}
});
return newList.join(', ');
@@ -185,7 +177,7 @@ function parseError(group, idType) {
// ID has # at the front
id = item[2].slice(1);
id = fillPlaceholder(idType + id);
id = linkEntity(idType + id);
item = [role, item[1], id].join(' ');
newList.push(item);
@@ -201,7 +193,7 @@ function parseError(group, idType) {
items.forEach(function(item) {
// ID has # at the front
var id = fillPlaceholder('n' + item.slice(1));
var id = linkEntity('n' + item.slice(1));
newList.push(id);
});
@@ -213,7 +205,7 @@ function parseError(group, idType) {
case 'n':
case 'w':
case 'r':
group = fillPlaceholder(idType + group);
group = linkEntity(idType + group);
break;
// some errors have more complex ID lists/variance
case '211':
+1 -10
View File
@@ -14,16 +14,7 @@ export function uiKeepRightDetails(context) {
if (!d) return unknown;
var errorType = d.error_type;
var template = errorTypes[errorType];
if (!template) return unknown;
// if there is a parent, save its error type e.g.:
// Error 191 = "highway-highway"
// Error 190 = "intersections without junctions" (parent)
var parentErrorType = (Math.floor(errorType / 10) * 10).toString();
var parentTemplate = errorTypes[parentErrorType];
if (!parentTemplate) return unknown;
var parentErrorType = d.parent_error_type
var et = dataEn.QA.keepRight.errorTypes[errorType];
var pt = dataEn.QA.keepRight.errorTypes[parentErrorType];
+1 -10
View File
@@ -13,16 +13,7 @@ export function uiKeepRightHeader() {
if (!d) return unknown;
var errorType = d.error_type;
var template = errorTypes[errorType];
if (!template) return unknown;
// if there is a parent, save its error type e.g.:
// Error 191 = "highway-highway"
// Error 190 = "intersections without junctions" (parent)
var parentErrorType = (Math.floor(errorType / 10) * 10).toString();
var parentTemplate = errorTypes[parentErrorType];
if (!parentTemplate) return unknown;
var parentErrorType = d.parent_error_type
var et = dataEn.QA.keepRight.errorTypes[errorType];
var pt = dataEn.QA.keepRight.errorTypes[parentErrorType];