Ticket #20960: josm_20960v2.patch

File josm_20960v2.patch, 9.6 KB (added by skyper, 2 years ago)

version 2: does not warn about waterway; rearrange some rules to use ordered placeholder numbers

  • resources/data/validator/combinations.mapcss

     
    158158  group: tr("missing tag");
    159159}
    160160
    161 /* {0.tag} without {1.key} (warning level), #18411, #18246, #20530 */
    162 way[railway=construction][!construction],
    163 way[highway=construction][!construction],
     161/* {0.tag} without {1.key} (warning level), #18411, #18246, #20530, #20960 */
     162way[railway=construction][!construction][!construction:railway],
     163way[highway=construction][!construction][!construction:highway],
     164area[building=construction][!construction][!construction:building],
     165area[landuse=construction][!construction][!construction:landuse],
    164166node[traffic_sign=maxspeed][!maxspeed][!/^maxspeed:.+/],
    165167*[actuator=manual][!handle],
    166168*[mechanical_driver=manual][!handle],
     
    267269  group: tr("missing tag");
    268270}
    269271
    270 /* {0.key} without {1.key}, {2.key} or {3.key} */
     272/* {0.key} without {1.key}, {2.key} or {3.key}, see #20960 */
     273way[construction][!highway][!railway][!waterway]!:closed,
     274area[construction][!building][!highway][!landuse]:closed,
    271275*[snowplowing][!highway][!amenity][!leisure] {
    272276  throwWarning: tr("{0} without {1}, {2} or {3}", "{0.key}", "{1.key}", "{2.key}", "{3.key}");
    273277  group: tr("missing tag");
     
    307311  group: tr("suspicious tag combination");
    308312}
    309313
    310 /* {0.tag} together with {1.tag}, see #18411, #17950, #17330, #17623, #17592, #17594, #17542, #16861, #16147, #10186, #18815 */
     314/* {0.tag} together with {1.tag}, see #18411, #17950, #17330, #17623, #17592, #17594, #17542, #16861, #16147, #10186, #18815, #20960 */
    311315*[barrier=kerb][kerb=no],
    312 way[highway=construction][construction=yes],
    313 way[railway=construction][construction=yes],
     316way[highway=construction][construction][construction=~/^(yes|minor|no)$/],
     317way[railway=construction][construction][construction=~/^(yes|minor|no)$/],
     318area[building=construction][construction][construction=~/^(yes|minor|no)$/],
     319area[landuse=construction][construction][construction=~/^(yes|minor|no)$/],
    314320*[man_made=bridge][bridge=yes],
    315321*[man_made=tunnel][tunnel=yes],
    316322*[amenity=police][police],
     
    435441  assertMatch: "node place=foo addr:housenumber=5 addr:postcode=12345";
    436442  assertNoMatch: "node place=foo  addr:postcode=12345";
    437443}
    438 *[!highway][postal_code]["addr:postcode"][postal_code=*"addr:postcode"] {
    439   throwWarning: tr("{0} together with {1}", "{1.key}", "{2.key}");
     444*[postal_code]["addr:postcode"][!highway][postal_code=*"addr:postcode"] {
     445  throwWarning: tr("{0} together with {1}", "{0.key}", "{1.key}");
    440446  group: tr("suspicious tag combination");
    441447}
    442 *[!highway][postal_code]["addr:postcode"][postal_code!=*"addr:postcode"] {
    443   throwWarning: tr("{0} together with {1} and conflicting values", "{1.key}", "{2.key}");
     448*[postal_code]["addr:postcode"][!highway][postal_code!=*"addr:postcode"] {
     449  throwWarning: tr("{0} together with {1} and conflicting values", "{0.key}", "{1.key}");
    444450  group: tr("suspicious tag combination");
    445451}
    446 way[highway][postal_code]["addr:postcode"][postal_code=*"addr:postcode"] {
    447   throwWarning: tr("{0} together with {1}", "{1.key}", "{2.key}");
     452way[postal_code]["addr:postcode"][highway][postal_code=*"addr:postcode"] {
     453  throwWarning: tr("{0} together with {1}", "{0.key}", "{1.key}");
    448454  group: tr("suspicious tag combination");
    449455  fixRemove: "addr:postcode";
    450456}
    451 way[highway][postal_code]["addr:postcode"][postal_code!=*"addr:postcode"] {
    452   throwWarning: tr("{0} together with {1} and conflicting values", "{1.key}", "{2.key}");
     457way[postal_code]["addr:postcode"][highway][postal_code!=*"addr:postcode"] {
     458  throwWarning: tr("{0} together with {1} and conflicting values", "{0.key}", "{1.key}");
    453459  group: tr("suspicious tag combination");
    454460}
    455 way[highway][highway!=services][highway!=rest_area][!postal_code]["addr:postcode"] {
    456   throwWarning: tr("{0} together with {1}", "{0.key}", "{4.key}");
     461way[highway]["addr:postcode"][highway!=services][highway!=rest_area][!postal_code] {
     462  throwWarning: tr("{0} together with {1}", "{0.key}", "{1.key}");
    457463  suggestAlternative: "postal_code";
    458464  group: tr("suspicious tag combination");
    459465  fixChangeKey: "addr:postcode=>postal_code";
     
    486492  group: tr("suspicious tag combination");
    487493}
    488494
    489 *[amenity][amenity =~ /^(restaurant|cafe|fast_food|pub|place_of_worship|school|university|hospital|library|theatre|courthouse|bank|cinema|pharmacy|fuel)$/][!name][noname!=yes] {
    490   throwOther: tr("{0} without {1}", "{0.tag}", "{2.key}");
     495*[amenity][!name][amenity =~ /^(restaurant|cafe|fast_food|pub|place_of_worship|school|university|hospital|library|theatre|courthouse|bank|cinema|pharmacy|fuel)$/][noname!=yes] {
     496  throwOther: tr("{0} without {1}", "{0.tag}", "{1.key}");
    491497  group: tr("missing tag");
    492498  assertMatch: "node amenity=restaurant";
    493499  assertNoMatch: "node amenity=restaurant noname=yes";
     
    613619}
    614620
    615621/* #11837 */
    616 way[layer][layer<0][bridge][bridge!=no][location!=underground][indoor!=yes][!tunnel],
    617 way[layer][layer>0][tunnel][tunnel!=no][location!=overground][indoor!=yes][!bridge] {
    618   throwWarning: tr("{0} together with {1}", "{2.tag}", "{0.tag}");
     622way[bridge][layer][layer<0][bridge!=no][location!=underground][indoor!=yes][!tunnel],
     623way[tunnel][layer][layer>0][tunnel!=no][location!=overground][indoor!=yes][!bridge] {
     624  throwWarning: tr("{0} together with {1}", "{0.tag}", "{1.tag}");
    619625  group: tr("suspicious tag combination");
    620626}
    621627
     
    655661  fixAdd: "unisex=yes";
    656662}
    657663
    658 /* {1.key} without {2.tag} see #13138, #14468 */
    659 way!:closed[water][natural!~/water|bay|strait/][water!=intermittent][amenity!=lavoir], /* water=intermittent is deprecated and has an own warning */
    660 area:closed[water][natural!~/water|bay|strait/][water!=intermittent][amenity!=lavoir] {
    661   throwWarning: tr("{0} without {1}", "{1.key}", "{2.tag}");
     664/* {0.key} without {1.tag} see #13138, #14468 */
     665way[water][natural!~/water|bay|strait/][water!=intermittent][amenity!=lavoir]!:closed, /* water=intermittent is deprecated and has an own warning */
     666area[water][natural!~/water|bay|strait/][water!=intermittent][amenity!=lavoir]:closed {
     667  throwWarning: tr("{0} without {1}", "{0.key}", "{1.tag}");
    662668  group: tr("missing tag");
    663669}
    664670
     
    707713}
    708714
    709715/* #10932, #19609 */
    710 way[highway][!lanes][/^.*:lanes$/][!source:lanes],
    711 way[highway][!lanes][/^.*:lanes:(forward|backward|both_ways)$/],
    712 way[highway][!lanes:both_ways][/^.*:lanes:both_ways$/] {
    713   throwWarning: tr("{0} without {1}", "{2.key}", "{1.key}");
     716way[/^.*:lanes$/][highway][!lanes][!source:lanes],
     717way[/^.*:lanes:(forward|backward|both_ways)$/][!lanes][highway],
     718way[/^.*:lanes:both_ways$/][!lanes:both_ways][highway] {
     719  throwWarning: tr("{0} without {1}", "{0.key}", "{1.key}");
    714720  group: tr("missing tag");
    715721  assertMatch: "way highway=primary turn:lanes=left|right";
    716722  assertMatch: "way highway=primary turn:lanes:forward=left|right";
    717723  assertNoMatch: "way highway=primary turn:lanes=left|right lanes=2";
    718724}
    719 way[highway][!lanes:forward][/^.*:lanes:forward$/][!lanes:backward][mod(tag(lanes),2)=0],
    720 way[highway][!lanes:backward][/^.*:lanes:backward$/][!lanes:forward][mod(tag(lanes),2)=0] {
    721   throwOther: tr("{0} without {1}", "{2.key}", "{1.key}");
     725way[/^.*:lanes:forward$/][!lanes:forward][!lanes:backward][highway][mod(tag(lanes),2)=0],
     726way[/^.*:lanes:backward$/][!lanes:backward][!lanes:forward][highway][mod(tag(lanes),2)=0] {
     727  throwOther: tr("{0} without {1}", "{0.key}", "{1.key}");
    722728  group: tr("missing tag");
    723729  assertMatch: "way highway=primary turn:lanes:forward=left|right lanes=2";
    724730  assertNoMatch: "way highway=primary turn:lanes:forward=left|right lanes:forward=2";
     
    837843  assertNoMatch: "way construction:building=house construction=house";
    838844}
    839845
    840 /* #18203 */
    841 way[construction][construction!=yes][construction!=minor][highway][highway!=construction] {
    842   throwWarning: tr("{0} together with {1}", "{3.tag}", "{0.tag}");
     846/* #18203, #20960 */
     847way[highway][construction][construction!~/^(yes|minor|no)$/][highway!=construction],
     848way[railway][construction][construction!~/^(yes|minor|no)$/][railway!=construction],
     849area[building][construction][construction!~/^(yes|minor|no)$/][building!=construction],
     850area[landuse][construction][construction!~/^(yes|minor|no)$/][landuse!=construction] {
     851  throwWarning: tr("{0} together with {1}", "{0.tag}", "{1.tag}");
    843852  group: tr("suspicious tag combination");
    844853}
    845854
     
    929938  assertNoMatch: "way highway=primary placement:backward=middle_of:1 placement:forward=transition";
    930939  assertNoMatch: "way highway=primary placement=middle_of:1 placement:backward=transition placement:forward=transition";
    931940}
    932 way[highway][placement][/^placement:.*$/]!.PlacementTransitionWarning,
    933 way[highway]["placement:forward"]["placement:backward"]!.PlacementTransitionWarning,
    934 way[highway]["placement:forward"]["placement:both_ways"]!.PlacementTransitionWarning,
    935 way[highway]["placement:backward"]["placement:both_ways"]!.PlacementTransitionWarning {
    936   throwError: tr("{0} together with {1}", "{1.key}", "{2.key}");
     941way[placement][/^placement:.*$/][highway]!.PlacementTransitionWarning,
     942way["placement:forward"]["placement:backward"][highway]!.PlacementTransitionWarning,
     943way["placement:forward"]["placement:both_ways"][highway]!.PlacementTransitionWarning,
     944way["placement:backward"]["placement:both_ways"][highway]!.PlacementTransitionWarning {
     945  throwError: tr("{0} together with {1}", "{0.key}", "{1.key}");
    937946  group: tr("suspicious tag combination");
    938947  assertMatch: "way highway=primary placement=left_of:2 placement:forward=right_of:1";
    939948  assertNoMatch: "way highway=primary placement:forward=right_of:1";