Ticket #21286: 21286.patch

File 21286.patch, 16.5 KB (added by taylor.smock, 3 years ago)

Use ' instead of ft

  • resources/data/validator/combinations.mapcss

    Subject: [PATCH] #21286: Add validate rule min_height < height
    ---
    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
    diff --git a/resources/data/validator/combinations.mapcss b/resources/data/validator/combinations.mapcss
    a b  
    4747way[length_unit                ][!waterway],
    4848way[canal                      ][!waterway],
    4949way[have_riverbank             ][!waterway],
     50area[min_height                ][!height][/^(building|building:part)$/], /* #21286 */
     51area[building:min_level        ][!building:levels][/^(building|building:part)$/], /* #21286 */
    5052*[border_type                  ][!boundary],
    5153*[piste:difficulty             ][!piste:type],
    5254*[place                        ][!name][place!=islet][place!=plot][noname!=yes],
     
    10751077*[voltage:primary][voltage:secondary][transformer=generator][tag("voltage:secondary")<tag("voltage:primary")] {
    10761078  throwWarning: tr("{0} is lower than {1} on {2}.", "{1.key}", "{0.key}", "{2.tag}");
    10771079  group: tr("suspicious tag combination");
    1078 }
    1079  No newline at end of file
     1080}
     1081
     1082/* #21286 */
     1083area[/^(building|building:part)$/][height =~ /^[0-9]+(\.[0-9]+)?( m)?$/][min_height =~ /^[0-9]+(\.[0-9]+)?( m)?$/][get(split(" ", tag(height)), 0) <= get(split(" ", tag(min_height)), 0)],
     1084area[/^(building|building:part)$/][height =~ /^[0-9]+(\.[0-9]+)?\'?$/][min_height =~ /^[0-9]+(\.[0-9]+)?\'$/][replace(tag(height), "'", "") <= replace(tag(min_height), "'", "")],
     1085area[/^(building|building:part)$/][building:levels][building:min_level][tag("building:levels") <= tag("building:min_level")] {
     1086  throwWarning: tr("{0} is lower or equal to {1} on {2}", "{1.key}", "{2.key}", "{0.key}");
     1087  group: tr("suspicious tag combination");
     1088}
     1089
  • resources/data/validator/numeric.mapcss

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
    diff --git a/resources/data/validator/numeric.mapcss b/resources/data/validator/numeric.mapcss
    a b  
    6767  assertNoMatch: "node building:levels=0"; /* valid because there can be building:levels:underground > 0 or roof:levels > 0 */
    6868}
    6969
    70 *[height][height =~ /^[0-9]+(\.[0-9]+)?(( )*(metre|metres|meter|meters|Metre|Metres|Meter|Meters)|m)$/] {
     70*[height][height =~ /^[0-9]+(\.[0-9]+)?( *(metre|metres|meter|meters|Metre|Metres|Meter|Meters)|m)$/] {
    7171  throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}");
    7272  set height_meter_autofix;
    73   fixAdd: concat("height=", get(regexp_match("([0-9.]+)( )*(.+)",tag("height")),1)," m");
     73  fixAdd: concat("height=", get(regexp_match("([0-9.]+) *.+",tag("height")),1)," m");
    7474  assertMatch: "node height=6.78 meters";
    7575  assertMatch: "node height=5  metre";
    7676  assertMatch: "node height=2m";
    7777  assertNoMatch: "node height=2 m";
    7878  assertNoMatch: "node height=5";
    7979}
    80 *[height][height =~ /^[0-9]+(\.[0-9]+)?(( )*(foot|Foot|feet|Feet)|ft)$/] {
     80*[height][height =~ /^[0-9]+(\.[0-9]+)?( *(foot|Foot|feet|Feet|ft)| +')$/] {
    8181  throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}");
    8282  set height_foot_autofix;
    83   fixAdd: concat("height=", get(regexp_match("([0-9.]+)( )*(.+)",tag("height")),1)," ft");
     83  fixAdd: concat("height=", get(regexp_match("([0-9.]+) *.+",tag("height")),1),"'");
    8484  assertMatch: "node height=6.78 foot";
    8585  assertMatch: "node height=5  Feet";
    8686  assertMatch: "node height=2ft";
    87   assertNoMatch: "node height=2 ft";
     87  assertNoMatch: "node height=2'";
    8888  assertNoMatch: "node height=5";
    8989}
    90 *[height][height =~ /^[0-9]+,[0-9][0-9]?( (m|ft))?$/] {
     90*[height][height =~ /^[0-9]+,[0-9][0-9]?( (m|ft)|')?$/] {
    9191  throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
    9292  fixAdd: concat("height=", replace(tag("height"), ",", "."));
    9393  set height_separator_autofix;
     
    100100  assertNoMatch: "node height=4";
    101101}
    102102
    103 *[maxheight][maxheight =~ /^[1-9][0-9]*(\.[0-9]+)?(( )*(metre|metres|meter|meters|Metre|Metres|Meter|Meters)|m)$/] {
     103*[maxheight][maxheight =~ /^[1-9][0-9]*(\.[0-9]+)?( *(metre|metres|meter|meters|Metre|Metres|Meter|Meters)|m)$/] {
    104104  throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}");
    105105  set maxheight_meter_autofix;
    106   fixAdd: concat("maxheight=", get(regexp_match("([0-9.]+)( )*(.+)",tag("maxheight")),1)," m");
     106  fixAdd: concat("maxheight=", get(regexp_match("([0-9.]+) *.+",tag("maxheight")),1)," m");
    107107  assertMatch: "node maxheight=6.78 meters";
    108108  assertMatch: "node maxheight=5  metre";
    109109  assertMatch: "node maxheight=2m";
    110110  assertNoMatch: "node maxheight=2 m";
    111111  assertNoMatch: "node maxheight=5";
    112112}
    113 *[maxheight][maxheight =~ /^[0-9]+(\.[0-9]+)?(( )*(foot|Foot|feet|Feet)|ft)$/] {
     113*[maxheight][maxheight =~ /^[0-9]+(\.[0-9]+)?( *(foot|Foot|feet|Feet|ft)| +')$/] {
    114114  throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}");
    115115  set maxheight_foot_autofix;
    116   fixAdd: concat("maxheight=", get(regexp_match("([0-9.]+)( )*(.+)",tag("maxheight")),1)," ft");
     116  fixAdd: concat("maxheight=", get(regexp_match("([0-9.]+) *.+",tag("maxheight")),1),"'");
    117117  assertMatch: "node maxheight=6.78 foot";
    118118  assertMatch: "node maxheight=5  Feet";
    119119  assertMatch: "node maxheight=2ft";
    120   assertNoMatch: "node maxheight=2 ft";
     120  assertNoMatch: "node maxheight=2'";
    121121  assertNoMatch: "node maxheight=5";
    122122}
    123 *[maxheight][maxheight =~ /^[0-9]+,[0-9][0-9]?( (m|ft))?$/] {
     123*[maxheight][maxheight =~ /^[0-9]+,[0-9][0-9]?( (m|ft)|')?$/] {
    124124  throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
    125125  fixAdd: concat("maxheight=", replace(tag("maxheight"), ",", "."));
    126126  set maxheight_separator_autofix;
    127127  assertMatch: "node maxheight=5,5";
    128128  assertMatch: "node maxheight=12,00";
    129   assertMatch: "node maxheight=12,5 ft";
     129  assertMatch: "node maxheight=12,5'";
    130130  assertNoMatch: "node maxheight=12,000";
    131131  assertNoMatch: "node maxheight=3,50,5";
    132132  assertNoMatch: "node maxheight=3.5";
    133133  assertNoMatch: "node maxheight=4";
    134134}
    135135
    136 *[roof:height][roof:height =~ /^0*(\.0*)?( (m|ft))?$/][roof:shape=flat] {
     136*[roof:height][roof:height =~ /^0*(\.0*)?( (m|ft)|')?$/][roof:shape=flat] {
    137137  throwWarning: tr("{0} is unnecessary for {1}", "{0.tag}", "{2.tag}");
    138138  group: tr("unnecessary tag");
    139139  fixRemove: "{0.key}";
    140140  set zero_roof_height_flat;
    141141  assertMatch: "node roof:height=0 roof:shape=flat";
    142142  assertMatch: "node roof:shape=flat roof:height=\"00.00000 ft\" roof:shape=flat";
     143  assertMatch: "node roof:shape=flat roof:height=\"00.00000'\" roof:shape=flat";
    143144  assertNoMatch: "node roof:shape=flat roof:height=2 m roof:shape=flat";
    144145  assertNoMatch: "node roof:height=0 roof:shape=gabled";
    145146}
    146 *[roof:height][roof:height =~ /^[0-9]+(\.[0-9]+)?(( )*(metre|metres|meter|meters|Metre|Metres|Meter|Meters)|m)$/]!.zero_roof_height_flat {
     147*[roof:height][roof:height =~ /^[0-9]+(\.[0-9]+)?( *(metre|metres|meter|meters|Metre|Metres|Meter|Meters)|m)$/]!.zero_roof_height_flat {
    147148  throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}");
    148149  set roof_height_meter_autofix;
    149   fixAdd: concat("roof:height=", get(regexp_match("([0-9.]+)( )*(.+)",tag("roof:height")),1)," m");
     150  fixAdd: concat("roof:height=", get(regexp_match("([0-9.]+) *.+",tag("roof:height")),1)," m");
    150151  assertMatch: "node roof:height=6.78 meters";
    151152  assertMatch: "node roof:height=5  metre";
    152153  assertMatch: "node roof:height=2m";
    153154  assertNoMatch: "node roof:height=2 m";
    154155  assertNoMatch: "node roof:height=5";
    155156}
    156 *[roof:height][roof:height =~ /^[0-9]+(\.[0-9]+)?(( )*(foot|Foot|feet|Feet)|ft)$/]!.zero_roof_height_flat {
     157*[roof:height][roof:height =~ /^[0-9]+(\.[0-9]+)?( *(foot|Foot|feet|Feet|ft)| +')$/]!.zero_roof_height_flat {
    157158  throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}");
    158159  set roof_height_foot_autofix;
    159   fixAdd: concat("roof:height=", get(regexp_match("([0-9.]+)( )*(.+)",tag("roof:height")),1)," ft");
     160  fixAdd: concat("roof:height=", get(regexp_match("([0-9.]+) *.+",tag("roof:height")),1),"'");
    160161  assertMatch: "node roof:height=6.78 foot";
    161162  assertMatch: "node roof:height=5  Feet";
    162163  assertMatch: "node roof:height=2ft";
    163   assertNoMatch: "node roof:height=2 ft";
     164  assertMatch: "node roof:height=2 ft";
     165  assertNoMatch: "node roof:height=2'";
    164166  assertNoMatch: "node roof:height=5";
    165167}
    166 *[roof:height][roof:height =~ /^[0-9]+,[0-9][0-9]?( (m|ft))?$/] {
     168*[roof:height][roof:height =~ /^[0-9]+,[0-9][0-9]?( (m|ft)|')?$/] {
    167169  throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
    168170  fixAdd: concat("roof:height=", replace(tag("roof:height"), ",", "."));
    169171  set roof_height_separator_autofix;
     
    176178  assertNoMatch: "node roof:height=4";
    177179}
    178180
    179 *[maxlength][maxlength =~ /^[1-9][0-9]*(\.[0-9]+)?(( )*(metre|metres|meter|meters|Metre|Metres|Meter|Meters)|m)$/] {
     181*[maxlength][maxlength =~ /^[1-9][0-9]*(\.[0-9]+)?( *(metre|metres|meter|meters|Metre|Metres|Meter|Meters)|m)$/] {
    180182  throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}");
    181183  set maxlength_meter_autofix;
    182   fixAdd: concat("maxlength=", get(regexp_match("([0-9.]+)( )*(.+)",tag("maxlength")),1)," m");
     184  fixAdd: concat("maxlength=", get(regexp_match("([0-9.]+) *.+",tag("maxlength")),1)," m");
    183185  assertMatch: "node maxlength=6.78 meters";
    184186  assertMatch: "node maxlength=5  metre";
    185187  assertMatch: "node maxlength=2m";
    186188  assertNoMatch: "node maxlength=2 m";
    187189  assertNoMatch: "node maxlength=5";
    188190}
    189 *[maxlength][maxlength =~ /^[0-9]+(\.[0-9]+)?(( )*(foot|Foot|feet|Feet)|ft)$/] {
     191*[maxlength][maxlength =~ /^[0-9]+(\.[0-9]+)?( *(foot|Foot|feet|Feet|ft)| +')$/] {
    190192  throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}");
    191193  set maxlength_foot_autofix;
    192   fixAdd: concat("maxlength=", get(regexp_match("([0-9.]+)( )*(.+)",tag("maxlength")),1)," ft");
     194  fixAdd: concat("maxlength=", get(regexp_match("([0-9.]+) *.+",tag("maxlength")),1),"'");
    193195  assertMatch: "node maxlength=6.78 foot";
    194196  assertMatch: "node maxlength=5  Feet";
    195197  assertMatch: "node maxlength=2ft";
    196   assertNoMatch: "node maxlength=2 ft";
     198  assertNoMatch: "node maxlength=2'";
    197199  assertNoMatch: "node maxlength=5";
    198200}
    199 *[maxlength][maxlength =~ /^[0-9]+,[0-9][0-9]?( (m|ft))?$/] {
     201*[maxlength][maxlength =~ /^[0-9]+,[0-9][0-9]?( (m|ft)|')?$/] {
    200202  throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
    201203  fixAdd: concat("maxlength=", replace(tag("maxlength"), ",", "."));
    202204  set maxlength_separator_autofix;
     
    219221  assertNoMatch: "node width=2 m";
    220222  assertNoMatch: "node width=5";
    221223}
    222 *[width][width =~ /^[0-9]+(\.[0-9]+)?(( )*(foot|Foot|feet|Feet)|ft)$/] {
     224*[width][width =~ /^[0-9]+(\.[0-9]+)?( *(foot|Foot|feet|Feet|ft)| +')$/] {
    223225  throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}");
    224226  set width_foot_autofix;
    225   fixAdd: concat("width=", get(regexp_match("([0-9.]+)( )*(.+)",tag("width")),1)," ft");
     227  fixAdd: concat("width=", get(regexp_match("([0-9.]+) *.+",tag("width")),1),"'");
    226228  assertMatch: "node width=6.78 foot";
    227229  assertMatch: "node width=5  Feet";
    228230  assertMatch: "node width=2ft";
    229   assertNoMatch: "node width=2 ft";
     231  assertMatch: "node width=2 ft";
     232  assertMatch: "node width=2 '";
     233  assertNoMatch: "node width=2'";
    230234  assertNoMatch: "node width=5";
    231235}
    232 *[width][width =~ /^[0-9]+,[0-9][0-9]?( (m|ft))?$/] {
     236*[width][width =~ /^[0-9]+,[0-9][0-9]?( (m|ft)|')?$/] {
    233237  throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
    234238  fixAdd: concat("width=", replace(tag("width"), ",", "."));
    235239  set width_separator_autofix;
     
    241245  assertNoMatch: "node width=4";
    242246}
    243247
    244 *[maxwidth][maxwidth=~ /^[0-9]+(\.[0-9]+)?(( )*(metre|metres|meter|meters|Metre|Metres|Meter|Meters)|m)$/] {
     248*[maxwidth][maxwidth=~ /^[0-9]+(\.[0-9]+)?( *(metre|metres|meter|meters|Metre|Metres|Meter|Meters)|m)$/] {
    245249  throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}");
    246250  set maxwidth_meter_autofix;
    247   fixAdd: concat("maxwidth=", get(regexp_match("([0-9.]+)( )*(.+)",tag("maxwidth")),1)," m");
     251  fixAdd: concat("maxwidth=", get(regexp_match("([0-9.]+) *.+",tag("maxwidth")),1)," m");
    248252  assertMatch: "node maxwidth=6.78 meters";
    249253  assertMatch: "node maxwidth=5  metre";
    250254  assertMatch: "node maxwidth=2m";
    251255  assertNoMatch: "node maxwidth=2 m";
    252256  assertNoMatch: "node maxwidth=5";
    253257}
    254 *[maxwidth][maxwidth =~ /^[0-9]+(\.[0-9]+)?(( )*(foot|Foot|feet|Feet)|ft)$/] {
     258*[maxwidth][maxwidth =~ /^[0-9]+(\.[0-9]+)?( *(foot|Foot|feet|Feet|ft)| +')$/] {
    255259  throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}");
    256260  set maxwidth_foot_autofix;
    257   fixAdd: concat("maxwidth=", get(regexp_match("([0-9.]+)( )*(.+)",tag("maxwidth")),1)," ft");
     261  fixAdd: concat("maxwidth=", get(regexp_match("([0-9.]+)( )*(.+)",tag("maxwidth")),1),"'");
    258262  assertMatch: "node maxwidth=6.78 foot";
    259263  assertMatch: "node maxwidth=5  Feet";
    260264  assertMatch: "node maxwidth=2ft";
    261   assertNoMatch: "node maxwidth=2 ft";
     265  assertMatch: "node maxwidth=2 ft";
     266  assertMatch: "node maxwidth=2 '";
     267  assertNoMatch: "node maxwidth=2'";
    262268  assertNoMatch: "node maxwidth=5";
    263269}
    264 *[maxwidth][maxwidth =~ /^[0-9]+,[0-9][0-9]?( (m|ft))?$/] {
     270*[maxwidth][maxwidth =~ /^[0-9]+,[0-9][0-9]?( (m|ft)|')?$/] {
    265271  throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
    266272  fixAdd: concat("maxwidth=", replace(tag("maxwidth"), ",", "."));
    267273  set maxwidth_separator_autofix;
     
    299305  assertNoMatch: "node width=10'";
    300306}
    301307
     308*[min_height][min_height =~ /^-?[0-9]+(\.[0-9]+)?( *(metre|metres|meter|meters|Metre|Metres|Meter|Meters)|m)$/] {
     309  throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}");
     310  fixAdd: concat("min_height=", get(regexp_match("(-?[0-9.]+) *.+",tag("min_height")),1)," m");
     311  set min_height_meter_autofix;
     312  assertMatch: "node min_height=6.78 meters";
     313  assertMatch: "node min_height=5  metre";
     314  assertMatch: "node min_height=2m";
     315  assertNoMatch: "node min_height=2 m";
     316  assertNoMatch: "node min_height=5";
     317}
     318*[min_height][min_height =~ /^-?[0-9]+(\.[0-9]+)?( *(foot|Foot|feet|Feet|ft)| +')$/] {
     319  throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}");
     320  fixAdd: concat("min_height=", get(regexp_match("(-?[0-9.]+)( )*(.+)",tag("min_height")),1),"'");
     321  set min_height_foot_autofix;
     322  assertMatch: "node min_height=6.78 foot";
     323  assertMatch: "node min_height=5  Feet";
     324  assertMatch: "node min_height=2ft";
     325  assertMatch: "node min_height=2 ft";
     326  assertMatch: "node min_height=2 '";
     327  assertNoMatch: "node min_height=2'";
     328  assertNoMatch: "node min_height=5";
     329}
     330*[min_height][min_height =~ /^-?[0-9]+,[0-9][0-9]?( (m|ft)|')?$/] {
     331  throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
     332  fixAdd: concat("min_height=", replace(tag("min_height"), ",", "."));
     333  set min_height_separator_autofix;
     334  assertMatch: "node min_height=5,5";
     335  assertMatch: "node min_height=12,00";
     336  assertMatch: "node min_height=12,5 ft";
     337  assertMatch: "node min_height=12,5'";
     338  assertNoMatch: "node min_height=12,000";
     339  assertNoMatch: "node min_height=3,50,5";
     340  assertNoMatch: "node min_height=3.5";
     341  assertNoMatch: "node min_height=4";
     342}
     343*[min_height ][min_height  !~ /^(-?([0-9]+(\.[0-9]+)?( (m|ft))?)|(-?[1-9][0-9]*\'((10|11|[0-9])((\.[0-9]+)?)\")?))$/]!.min_height_separator_autofix!.min_height_meter_autofix!.min_height_foot_autofix {
     344  throwWarning: tr("unusual value of {0}: {1} is default; point is decimal separator; if units, put space then unit", "{0.key}", tr("meters"));
     345  assertMatch: "node min_height=\"12. m\"";
     346  assertNoMatch: "node min_height=-5";
     347}
     348
    302349*[maxaxleload][maxaxleload =~ /^[0-9]+,[0-9][0-9]?( (t|kg|st|lbs))?$/] {
    303350  throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
    304351  fixAdd: concat("maxaxleload=", replace(tag("maxaxleload"), ",", "."));