Ticket #11253: josm_11253_validator.patch

File josm_11253_validator.patch, 2.2 KB (added by skyper, 6 years ago)

validator patch

  • src/org/openstreetmap/josm/resources/data/validator/numeric.mapcss

     
    5959  assertNoMatch: "node maxheight=16'3\"";
    6060}
    6161
     62/* maxstay=0 is unclear. Was in presets, see #11253 */
     63*[maxstay=0] {
     64  throwWarning: tr("{0} is unclear.", "maxstay");
     65  suggestAlternative: "maxstay=unlimited or maxstay=no";
     66  assertMatch: "node maxstay=0";
     67  assertMatch: "way maxstay=0";
     68  assertNoMatch: "node maxstay=2";
     69  assertNoMatch: "way maxstay=no";
     70}
     71
     72/* maxstay needs unit. Was in presets without it, see #11253 */
     73*[maxstay][maxstay !~ /^(([0-9]+\.?[0-9]*( (minute|minutes|hour|hours|h|day|days|d|year|years|a)))|(no|unlimited|0))$/] {
     74  throwWarning: tr("{0}: no default unit; only positive values; period is separator; space between value and unit", "maxstay");
     75  assertMatch: "way maxstay=something";
     76  assertMatch: "way maxstay=-5";
     77  assertMatch: "node maxstay=180";
     78  assertMatch: "way maxstay=66minutes";
     79  assertNoMatch: "node maxstay=0";
     80  assertNoMatch: "way maxstay=no";
     81  assertNoMatch: "node maxstay=unlimited";
     82  assertNoMatch: "way maxstay=66 minutes";
     83  assertNoMatch: "way maxstay=2.5 hours";
     84  assertNoMatch: "node maxstay=7 h";
     85}
     86
    6287way[width][width !~ /^(([0-9]+\.?[0-9]*( [a-z]+)?)|([0-9]+\'([0-9]+\.?[0-9]*\")?))$/] {
    6388  throwWarning: tr("{0}: meters is default; period is separator; if units, put space then unit", "width");
    6489  assertMatch: "way width=something";
     
    80105  assertNoMatch: "way maxwidth=2.5";
    81106  assertNoMatch: "way maxwidth=7 ft";
    82107}
     108
    83109way[maxspeed][maxspeed !~ /^(signals|none|unposted|variable|walk|[1-9][0-9]*( [a-z]+)?|[A-Z][A-Z]:(urban|rural|living_street|motorway))$/],
    84110way[maxspeed:forward][maxspeed:forward !~ /^(signals|none|unposted|variable|walk|[1-9][0-9]*( [a-z]+)?|[A-Z][A-Z]:(urban|rural|living_street|motorway))$/],
    85111way[maxspeed:backward][maxspeed:backward !~ /^(signals|none|unposted|variable|walk|[1-9][0-9]*( [a-z]+)?|[A-Z][A-Z]:(urban|rural|living_street|motorway))$/] {