Modify

Opened 3 years ago

Closed 3 years ago

Last modified 3 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 Changed 3 years ago by Klumbumbus

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 Changed 3 years ago by Klumbumbus

Milestone: 20.10

comment:3 Changed 3 years ago by skyper

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 3 years ago by skyper (previous) (diff)

comment:4 Changed 3 years ago by gaben

Resolution: fixed
Status: closedreopened

comment:5 Changed 3 years ago by Famlam

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 Changed 3 years ago by gaben

Probably not, but it seems very edge case.

comment:7 in reply to:  3 ; Changed 3 years ago by Klumbumbus

Replying to skyper:

In general we miss cases without leading numbers like .25meters, now.

This is catched by the rules without autofix.

comment:8 in reply to:  7 ; Changed 3 years ago by 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?

comment:9 Changed 3 years ago by Klumbumbus

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 Changed 3 years ago by Klumbumbus

In 17267/josm:

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

comment:11 in reply to:  8 Changed 3 years ago by Klumbumbus

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 Changed 3 years ago by Klumbumbus

In 17268/josm:

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

comment:13 Changed 3 years ago by Don-vip

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.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.