#19907 closed defect (fixed)
numeric.mapcss regex and silent fail of fixAdd
Reported by: | frodrigo | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | 20.11 |
Component: | Core validator | Version: | |
Keywords: | Cc: |
Description
The meter part
https://josm.openstreetmap.de/browser/josm/trunk/resources/data/validator/numeric.mapcss#L156
https://josm.openstreetmap.de/browser/josm/trunk/resources/data/validator/numeric.mapcss#L188
it is not done like the feet part
https://josm.openstreetmap.de/browser/josm/trunk/resources/data/validator/numeric.mapcss#L166
https://josm.openstreetmap.de/browser/josm/trunk/resources/data/validator/numeric.mapcss#L198
The regex meter ([0-9]*\.?[0-9]*) match event without any number ("m" what the regex) while the feet one ([0-9]+\.?[0-9]*) require at least a number.
If the rule matchs without number the following regex in the fixAdd does not have match. It looks like to me, JOSM silently fails on the fixAdd error.
I found this with the Osmose MapCSS implementation. On Osmose the fixAdd fails with an error.
Attachments (0)
Change History (13)
comment:1 by , 4 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 by , 4 years ago
Milestone: | → 20.10 |
---|
follow-up: 7 comment:3 by , 4 years ago
maxheight
and maxlength
could be adjusted as cases with leading zero are missed, atm.
In general we miss cases without leading numbers like .25meters
, now. Think syntax need to be changed to e.g.:
*[width][width =~ /^([0-9]+\.?[0-9]*|\.[0-9]+)(( )*(metre|metres|meter|meters|Metre|Metres|Meter|Meters)|m)$/] {
comment:4 by , 4 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:5 by , 4 years ago
Perhaps also good to note - since they're now being adjusted - that the regexes in numeric.mapcss all consider "2. m" as valid. Not sure if that's supposed to happen.
follow-up: 8 comment:7 by , 4 years ago
Replying to skyper:
In general we miss cases without leading numbers like
.25meters
, now.
This is catched by the rules without autofix.
follow-up: 11 comment:8 by , 4 years ago
Replying to Klumbumbus:
Replying to skyper:
In general we miss cases without leading numbers like
.25meters
, now.
This is catched by the rules without autofix.
Are there reasons to not allow to autofix this case?
comment:11 by , 4 years ago
Replying to skyper:
Replying to Klumbumbus:
Replying to skyper:
In general we miss cases without leading numbers like
.25meters
, now.
This is catched by the rules without autofix.
Are there reasons to not allow to autofix this case?
After the "fixing" to .25 m
the value is still wrong, which not so nice. A manual fix by the user is required here anyway.
Creating a separate rule which fixes both errors together is not needed as there are probably very few such cases.
In 17145/josm: