Ticket #21286: 21286.patch
| File 21286.patch, 16.5 KB (added by , 3 years ago) |
|---|
-
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 47 47 way[length_unit ][!waterway], 48 48 way[canal ][!waterway], 49 49 way[have_riverbank ][!waterway], 50 area[min_height ][!height][/^(building|building:part)$/], /* #21286 */ 51 area[building:min_level ][!building:levels][/^(building|building:part)$/], /* #21286 */ 50 52 *[border_type ][!boundary], 51 53 *[piste:difficulty ][!piste:type], 52 54 *[place ][!name][place!=islet][place!=plot][noname!=yes], … … 1075 1077 *[voltage:primary][voltage:secondary][transformer=generator][tag("voltage:secondary")<tag("voltage:primary")] { 1076 1078 throwWarning: tr("{0} is lower than {1} on {2}.", "{1.key}", "{0.key}", "{2.tag}"); 1077 1079 group: tr("suspicious tag combination"); 1078 } 1079 No newline at end of file 1080 } 1081 1082 /* #21286 */ 1083 area[/^(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)], 1084 area[/^(building|building:part)$/][height =~ /^[0-9]+(\.[0-9]+)?\'?$/][min_height =~ /^[0-9]+(\.[0-9]+)?\'$/][replace(tag(height), "'", "") <= replace(tag(min_height), "'", "")], 1085 area[/^(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 67 67 assertNoMatch: "node building:levels=0"; /* valid because there can be building:levels:underground > 0 or roof:levels > 0 */ 68 68 } 69 69 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)$/] { 71 71 throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}"); 72 72 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"); 74 74 assertMatch: "node height=6.78 meters"; 75 75 assertMatch: "node height=5 metre"; 76 76 assertMatch: "node height=2m"; 77 77 assertNoMatch: "node height=2 m"; 78 78 assertNoMatch: "node height=5"; 79 79 } 80 *[height][height =~ /^[0-9]+(\.[0-9]+)?( ( )*(foot|Foot|feet|Feet)|ft)$/] {80 *[height][height =~ /^[0-9]+(\.[0-9]+)?( *(foot|Foot|feet|Feet|ft)| +')$/] { 81 81 throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}"); 82 82 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),"'"); 84 84 assertMatch: "node height=6.78 foot"; 85 85 assertMatch: "node height=5 Feet"; 86 86 assertMatch: "node height=2ft"; 87 assertNoMatch: "node height=2 ft";87 assertNoMatch: "node height=2'"; 88 88 assertNoMatch: "node height=5"; 89 89 } 90 *[height][height =~ /^[0-9]+,[0-9][0-9]?( (m|ft) )?$/] {90 *[height][height =~ /^[0-9]+,[0-9][0-9]?( (m|ft)|')?$/] { 91 91 throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}"); 92 92 fixAdd: concat("height=", replace(tag("height"), ",", ".")); 93 93 set height_separator_autofix; … … 100 100 assertNoMatch: "node height=4"; 101 101 } 102 102 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)$/] { 104 104 throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}"); 105 105 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"); 107 107 assertMatch: "node maxheight=6.78 meters"; 108 108 assertMatch: "node maxheight=5 metre"; 109 109 assertMatch: "node maxheight=2m"; 110 110 assertNoMatch: "node maxheight=2 m"; 111 111 assertNoMatch: "node maxheight=5"; 112 112 } 113 *[maxheight][maxheight =~ /^[0-9]+(\.[0-9]+)?( ( )*(foot|Foot|feet|Feet)|ft)$/] {113 *[maxheight][maxheight =~ /^[0-9]+(\.[0-9]+)?( *(foot|Foot|feet|Feet|ft)| +')$/] { 114 114 throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}"); 115 115 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),"'"); 117 117 assertMatch: "node maxheight=6.78 foot"; 118 118 assertMatch: "node maxheight=5 Feet"; 119 119 assertMatch: "node maxheight=2ft"; 120 assertNoMatch: "node maxheight=2 ft";120 assertNoMatch: "node maxheight=2'"; 121 121 assertNoMatch: "node maxheight=5"; 122 122 } 123 *[maxheight][maxheight =~ /^[0-9]+,[0-9][0-9]?( (m|ft) )?$/] {123 *[maxheight][maxheight =~ /^[0-9]+,[0-9][0-9]?( (m|ft)|')?$/] { 124 124 throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}"); 125 125 fixAdd: concat("maxheight=", replace(tag("maxheight"), ",", ".")); 126 126 set maxheight_separator_autofix; 127 127 assertMatch: "node maxheight=5,5"; 128 128 assertMatch: "node maxheight=12,00"; 129 assertMatch: "node maxheight=12,5 ft";129 assertMatch: "node maxheight=12,5'"; 130 130 assertNoMatch: "node maxheight=12,000"; 131 131 assertNoMatch: "node maxheight=3,50,5"; 132 132 assertNoMatch: "node maxheight=3.5"; 133 133 assertNoMatch: "node maxheight=4"; 134 134 } 135 135 136 *[roof:height][roof:height =~ /^0*(\.0*)?( (m|ft) )?$/][roof:shape=flat] {136 *[roof:height][roof:height =~ /^0*(\.0*)?( (m|ft)|')?$/][roof:shape=flat] { 137 137 throwWarning: tr("{0} is unnecessary for {1}", "{0.tag}", "{2.tag}"); 138 138 group: tr("unnecessary tag"); 139 139 fixRemove: "{0.key}"; 140 140 set zero_roof_height_flat; 141 141 assertMatch: "node roof:height=0 roof:shape=flat"; 142 142 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"; 143 144 assertNoMatch: "node roof:shape=flat roof:height=2 m roof:shape=flat"; 144 145 assertNoMatch: "node roof:height=0 roof:shape=gabled"; 145 146 } 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 { 147 148 throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}"); 148 149 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"); 150 151 assertMatch: "node roof:height=6.78 meters"; 151 152 assertMatch: "node roof:height=5 metre"; 152 153 assertMatch: "node roof:height=2m"; 153 154 assertNoMatch: "node roof:height=2 m"; 154 155 assertNoMatch: "node roof:height=5"; 155 156 } 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 { 157 158 throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}"); 158 159 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),"'"); 160 161 assertMatch: "node roof:height=6.78 foot"; 161 162 assertMatch: "node roof:height=5 Feet"; 162 163 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'"; 164 166 assertNoMatch: "node roof:height=5"; 165 167 } 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)|')?$/] { 167 169 throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}"); 168 170 fixAdd: concat("roof:height=", replace(tag("roof:height"), ",", ".")); 169 171 set roof_height_separator_autofix; … … 176 178 assertNoMatch: "node roof:height=4"; 177 179 } 178 180 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)$/] { 180 182 throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}"); 181 183 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"); 183 185 assertMatch: "node maxlength=6.78 meters"; 184 186 assertMatch: "node maxlength=5 metre"; 185 187 assertMatch: "node maxlength=2m"; 186 188 assertNoMatch: "node maxlength=2 m"; 187 189 assertNoMatch: "node maxlength=5"; 188 190 } 189 *[maxlength][maxlength =~ /^[0-9]+(\.[0-9]+)?( ( )*(foot|Foot|feet|Feet)|ft)$/] {191 *[maxlength][maxlength =~ /^[0-9]+(\.[0-9]+)?( *(foot|Foot|feet|Feet|ft)| +')$/] { 190 192 throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}"); 191 193 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),"'"); 193 195 assertMatch: "node maxlength=6.78 foot"; 194 196 assertMatch: "node maxlength=5 Feet"; 195 197 assertMatch: "node maxlength=2ft"; 196 assertNoMatch: "node maxlength=2 ft";198 assertNoMatch: "node maxlength=2'"; 197 199 assertNoMatch: "node maxlength=5"; 198 200 } 199 *[maxlength][maxlength =~ /^[0-9]+,[0-9][0-9]?( (m|ft) )?$/] {201 *[maxlength][maxlength =~ /^[0-9]+,[0-9][0-9]?( (m|ft)|')?$/] { 200 202 throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}"); 201 203 fixAdd: concat("maxlength=", replace(tag("maxlength"), ",", ".")); 202 204 set maxlength_separator_autofix; … … 219 221 assertNoMatch: "node width=2 m"; 220 222 assertNoMatch: "node width=5"; 221 223 } 222 *[width][width =~ /^[0-9]+(\.[0-9]+)?( ( )*(foot|Foot|feet|Feet)|ft)$/] {224 *[width][width =~ /^[0-9]+(\.[0-9]+)?( *(foot|Foot|feet|Feet|ft)| +')$/] { 223 225 throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}"); 224 226 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),"'"); 226 228 assertMatch: "node width=6.78 foot"; 227 229 assertMatch: "node width=5 Feet"; 228 230 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'"; 230 234 assertNoMatch: "node width=5"; 231 235 } 232 *[width][width =~ /^[0-9]+,[0-9][0-9]?( (m|ft) )?$/] {236 *[width][width =~ /^[0-9]+,[0-9][0-9]?( (m|ft)|')?$/] { 233 237 throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}"); 234 238 fixAdd: concat("width=", replace(tag("width"), ",", ".")); 235 239 set width_separator_autofix; … … 241 245 assertNoMatch: "node width=4"; 242 246 } 243 247 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)$/] { 245 249 throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}"); 246 250 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"); 248 252 assertMatch: "node maxwidth=6.78 meters"; 249 253 assertMatch: "node maxwidth=5 metre"; 250 254 assertMatch: "node maxwidth=2m"; 251 255 assertNoMatch: "node maxwidth=2 m"; 252 256 assertNoMatch: "node maxwidth=5"; 253 257 } 254 *[maxwidth][maxwidth =~ /^[0-9]+(\.[0-9]+)?( ( )*(foot|Foot|feet|Feet)|ft)$/] {258 *[maxwidth][maxwidth =~ /^[0-9]+(\.[0-9]+)?( *(foot|Foot|feet|Feet|ft)| +')$/] { 255 259 throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}"); 256 260 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),"'"); 258 262 assertMatch: "node maxwidth=6.78 foot"; 259 263 assertMatch: "node maxwidth=5 Feet"; 260 264 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'"; 262 268 assertNoMatch: "node maxwidth=5"; 263 269 } 264 *[maxwidth][maxwidth =~ /^[0-9]+,[0-9][0-9]?( (m|ft) )?$/] {270 *[maxwidth][maxwidth =~ /^[0-9]+,[0-9][0-9]?( (m|ft)|')?$/] { 265 271 throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}"); 266 272 fixAdd: concat("maxwidth=", replace(tag("maxwidth"), ",", ".")); 267 273 set maxwidth_separator_autofix; … … 299 305 assertNoMatch: "node width=10'"; 300 306 } 301 307 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 302 349 *[maxaxleload][maxaxleload =~ /^[0-9]+,[0-9][0-9]?( (t|kg|st|lbs))?$/] { 303 350 throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}"); 304 351 fixAdd: concat("maxaxleload=", replace(tag("maxaxleload"), ",", "."));
