Modify

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#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 Klumbumbus, 4 years ago

Resolution: fixed
Status: newclosed

In 17145/josm:

fix #19907 - Don't autofix width|maxwidth=metre|metres|meter|meters|Metre|Metres|Meter|Meters|m to width|maxwidth= metre| metres| meter| meters| Metre| Metres| Meter| Meters| m

comment:2 by Klumbumbus, 4 years ago

Milestone: 20.10

comment:3 by skyper, 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)$/] {
Last edited 4 years ago by skyper (previous) (diff)

comment:4 by gaben, 4 years ago

Resolution: fixed
Status: closedreopened

comment:5 by Famlam, 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.

comment:6 by gaben, 4 years ago

Probably not, but it seems very edge case.

in reply to:  3 ; comment:7 by Klumbumbus, 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.

in reply to:  7 ; comment:8 by skyper, 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:9 by Klumbumbus, 4 years ago

Resolution: fixed
Status: reopenedclosed

In 17266/josm:

fix #19907 - Adjust some numeric regular expessions to warn about cases with missing numbers after decimal separator (width=10'2." or maxheight=2. m), don't warn about values without inch (feet only)

comment:10 by Klumbumbus, 4 years ago

In 17267/josm:

see #19907 - Remove foot/inch from maxweight/maxaleload regular expressions

in reply to:  8 comment:11 by Klumbumbus, 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.

comment:12 by Klumbumbus, 4 years ago

In 17268/josm:

see #19907 - Avoid that the fix button of some numeric tests produces a still wrong value

comment:13 by Don-vip, 4 years ago

Milestone: 20.1020.11

Milestone renamed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.