Changes between Initial Version and Version 1 of Ticket #21106, comment 6


Ignore:
Timestamp:
2021-07-13T11:13:35+02:00 (5 years ago)
Author:
Famlam

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #21106, comment 6

    initial v1  
    11> Then I would rather remove it without any warning for empty values.
    2 I would definitely be in favor of removing the warning altogether, but I could live with an info level "warning" about "missing" 'none'.
     2I would definitely be in favor of removing the warning altogether (and at minimum for splitting it up, as then I can ignore this validator rule while still having the validated part for any real error), but I could live with an info level "warning" about "Prefer 'none' over <nothing> for readability purposes".
     3
     4> On the other hand, I know that some users did misunderstand it and most of the issues of missing values (other rule) I find in the wild are caused by users removing the last | without any value after it.
     5Which is what validation of `lanes=*` vs. the number of `|`s could help with. If desired, it's quite a large chunk (more suitable for Java I guess as then you can just loop over it):
     6{{{
     7#!rule
     8way[lanes=2][/.+:lanes$/=~/^[^\|]*$/],
     9way[lanes=3][/.+:lanes$/=~/^([^\|]*\|){0,1}[^\|]*$/],
     10way[lanes=4][/.+:lanes$/=~/^([^\|]*\|){0,2}[^\|]*$/],
     11way[lanes=5][/.+:lanes$/=~/^([^\|]*\|){0,3}[^\|]*$/],
     12way[lanes=6][/.+:lanes$/=~/^([^\|]*\|){0,4}[^\|]*$/],
     13way[lanes=7][/.+:lanes$/=~/^([^\|]*\|){0,5}[^\|]*$/],
     14way[lanes=8][/.+:lanes$/=~/^([^\|]*\|){0,6}[^\|]*$/],
     15way[lanes=9][/.+:lanes$/=~/^([^\|]*\|){0,7}[^\|]*$/],
     16way[lanes:forward=2][/.+:lanes:forward$/=~/^[^\|]*$/],
     17way[lanes:forward=3][/.+:lanes:forward$/=~/^([^\|]*\|){0,1}[^\|]*$/],
     18way[lanes:forward=4][/.+:lanes:forward$/=~/^([^\|]*\|){0,2}[^\|]*$/],
     19way[lanes:forward=5][/.+:lanes:forward$/=~/^([^\|]*\|){0,3}[^\|]*$/],
     20way[lanes:forward=6][/.+:lanes:forward$/=~/^([^\|]*\|){0,4}[^\|]*$/],
     21way[lanes:forward=7][/.+:lanes:forward$/=~/^([^\|]*\|){0,5}[^\|]*$/],
     22way[lanes:forward=8][/.+:lanes:forward$/=~/^([^\|]*\|){0,6}[^\|]*$/],
     23way[lanes:forward=9][/.+:lanes:forward$/=~/^([^\|]*\|){0,7}[^\|]*$/],
     24way[lanes:backward=2][/.+:lanes:backward$/=~/^[^\|]*$/],
     25way[lanes:backward=3][/.+:lanes:backward$/=~/^([^\|]*\|){0,1}[^\|]*$/],
     26way[lanes:backward=4][/.+:lanes:backward$/=~/^([^\|]*\|){0,2}[^\|]*$/],
     27way[lanes:backward=5][/.+:lanes:backward$/=~/^([^\|]*\|){0,3}[^\|]*$/],
     28way[lanes:backward=6][/.+:lanes:backward$/=~/^([^\|]*\|){0,4}[^\|]*$/],
     29way[lanes:backward=7][/.+:lanes:backward$/=~/^([^\|]*\|){0,5}[^\|]*$/],
     30way[lanes:backward=8][/.+:lanes:backward$/=~/^([^\|]*\|){0,6}[^\|]*$/],
     31way[lanes:backward=9][/.+:lanes:backward$/=~/^([^\|]*\|){0,7}[^\|]*$/],
     32way[lanes:both_ways=2][/.+:lanes:both_ways$/=~/^[^\|]*$/],
     33way[lanes:both_ways=3][/.+:lanes:both_ways$/=~/^([^\|]*\|){0,1}[^\|]*$/],
     34way[lanes:both_ways=4][/.+:lanes:both_ways$/=~/^([^\|]*\|){0,2}[^\|]*$/],
     35way[lanes:both_ways=5][/.+:lanes:both_ways$/=~/^([^\|]*\|){0,3}[^\|]*$/],
     36way[lanes:both_ways=6][/.+:lanes:both_ways$/=~/^([^\|]*\|){0,4}[^\|]*$/],
     37way[lanes:both_ways=7][/.+:lanes:both_ways$/=~/^([^\|]*\|){0,5}[^\|]*$/],
     38way[lanes:both_ways=8][/.+:lanes:both_ways$/=~/^([^\|]*\|){0,6}[^\|]*$/],
     39way[lanes:both_ways=9][/.+:lanes:both_ways$/=~/^([^\|]*\|){0,7}[^\|]*$/] {
     40        throwWarning: tr("{0} is larger than the number of lanes in a *:lanes tag", "{0.tag}");
     41        group: tr("eigen filters");
     42        assertMatch: "way highway=primary oneway=yes lanes=2 bus:lanes=no";
     43        assertMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=no";
     44        assertMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=|no";
     45        assertMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=no|";
     46        assertMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=|no|";
     47        assertMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=|no| turn:lanes=left|through|through|right";
     48        assertMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=no||";
     49        assertMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=||no";
     50        assertMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=yes|no";
     51        assertMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=no|yes";
     52        assertMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=yes|no|yes";
     53        assertMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=no|yes|yes";
     54        assertMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=yes|yes|no";
     55        assertNoMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=no|yes|yes|yes";
     56        assertNoMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=no|||";
     57        assertNoMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=|no||";
     58        assertNoMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=|||no";
     59        assertNoMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=|||no turn:lanes=left|through|through|right";
     60        assertNoMatch: "way highway=primary oneway=yes lanes=4";
     61}
     62way[lanes=1][/.+:lanes$/=~/\|/],
     63way[lanes=2][/.+:lanes$/=~/^(.*\|){2}/],
     64way[lanes=3][/.+:lanes$/=~/^(.*\|){3}/],
     65way[lanes=4][/.+:lanes$/=~/^(.*\|){4}/],
     66way[lanes=5][/.+:lanes$/=~/^(.*\|){5}/],
     67way[lanes=6][/.+:lanes$/=~/^(.*\|){6}/],
     68way[lanes=7][/.+:lanes$/=~/^(.*\|){7}/],
     69way[lanes=8][/.+:lanes$/=~/^(.*\|){8}/],
     70way[lanes=9][/.+:lanes$/=~/^(.*\|){9}/],
     71way[lanes:forward=1][/.+:lanes:forward$/=~/\|/],
     72way[lanes:forward=2][/.+:lanes:forward$/=~/^(.*\|){2}/],
     73way[lanes:forward=3][/.+:lanes:forward$/=~/^(.*\|){3}/],
     74way[lanes:forward=4][/.+:lanes:forward$/=~/^(.*\|){4}/],
     75way[lanes:forward=5][/.+:lanes:forward$/=~/^(.*\|){5}/],
     76way[lanes:forward=6][/.+:lanes:forward$/=~/^(.*\|){6}/],
     77way[lanes:forward=7][/.+:lanes:forward$/=~/^(.*\|){7}/],
     78way[lanes:forward=8][/.+:lanes:forward$/=~/^(.*\|){8}/],
     79way[lanes:forward=9][/.+:lanes:forward$/=~/^(.*\|){9}/],
     80way[lanes:backward=1][/.+:lanes:backward$/=~/\|/],
     81way[lanes:backward=2][/.+:lanes:backward$/=~/^(.*\|){2}/],
     82way[lanes:backward=3][/.+:lanes:backward$/=~/^(.*\|){3}/],
     83way[lanes:backward=4][/.+:lanes:backward$/=~/^(.*\|){4}/],
     84way[lanes:backward=5][/.+:lanes:backward$/=~/^(.*\|){5}/],
     85way[lanes:backward=6][/.+:lanes:backward$/=~/^(.*\|){6}/],
     86way[lanes:backward=7][/.+:lanes:backward$/=~/^(.*\|){7}/],
     87way[lanes:backward=8][/.+:lanes:backward$/=~/^(.*\|){8}/],
     88way[lanes:backward=9][/.+:lanes:backward$/=~/^(.*\|){9}/],
     89way[lanes:both_ways=1][/.+:lanes:both_ways$/=~/\|/],
     90way[lanes:both_ways=2][/.+:lanes:both_ways$/=~/^(.*\|){2}/],
     91way[lanes:both_ways=3][/.+:lanes:both_ways$/=~/^(.*\|){3}/],
     92way[lanes:both_ways=4][/.+:lanes:both_ways$/=~/^(.*\|){4}/],
     93way[lanes:both_ways=5][/.+:lanes:both_ways$/=~/^(.*\|){5}/],
     94way[lanes:both_ways=6][/.+:lanes:both_ways$/=~/^(.*\|){6}/],
     95way[lanes:both_ways=7][/.+:lanes:both_ways$/=~/^(.*\|){7}/],
     96way[lanes:both_ways=8][/.+:lanes:both_ways$/=~/^(.*\|){8}/],
     97way[lanes:both_ways=9][/.+:lanes:both_ways$/=~/^(.*\|){9}/] {
     98        throwWarning: tr("{0} is smaller than the number of lanes in a *:lanes tag", "{0.tag}");
     99        group: tr("eigen filters");
     100        assertMatch: "way highway=primary oneway=yes lanes=1 bus:lanes=|no";
     101        assertMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=||||no";
     102        assertMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=|||no|";
     103        assertMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=||no||";
     104        assertMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=|no|||";
     105        assertMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=no||||";
     106        assertMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=yes|yes|yes|yes|no";
     107        assertMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=yes|yes|yes|no|yes";
     108        assertMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=yes|yes|no|yes|yes";
     109        assertMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=yes|no|yes|yes|yes";
     110        assertMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=no|yes|yes|yes|yes";
     111        assertMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=no|yes|yes|yes|yes turn:lanes=left|through|through|right";
     112        assertNoMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=no|yes|yes|yes";
     113        assertNoMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=no|||";
     114        assertNoMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=|no||";
     115        assertNoMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=|||no";
     116        assertNoMatch: "way highway=primary oneway=yes lanes=4 bus:lanes=|||no turn:lanes=left|through|through|right";
     117        assertNoMatch: "way highway=primary oneway=yes lanes=4";
     118}
     119}}}
     120But that's off-topic. Main point in my reply to this part is that a widely used syntax shouldn't be "forbidden", even if some users don't understand it (like many things: you have to learn it first). I guess TagInfo gives enough clues about the opinions of others?