Modify

Opened 6 months ago

Last modified 6 months ago

#17669 new enhancement

tag() in validator.mapcss should allow placeholders

Reported by: taylor.smock Owned by: team
Priority: normal Milestone:
Component: Core validator Version:
Keywords: template_report mapcss Cc:

Description

What steps will reproduce the problem?

*[/name/=~/.*([‘’]+).*/] {
  throwError: tr("Avoid using unicode '' in names (‘’) ({0})", "{0.key}");
  suggestAlternative: "'";
  fixAdd: concat("{0.key}", "=", tag("{0.key}"), " ", "{0.key}");
  assertNoMatch: "way name=\"Testing's Road\"";
  assertMatch: "way name=\"Testing‘s Road\"";
  assertMatch: "way name=\"Testing’s Road\"";
}

Test way:
way name=\"Testing‘s Road\"

What is the expected result?

I expect the name to become (with the above code) way name=\"Testing's Road name\".

What happens instead?

I get (with the above code) way name=\" name\".

Please provide any additional information below. Attach a screenshot if possible.

It does not appear to be a nested function issue (I checked with nested concats).

Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2019-04-28 04:36:41 +0200 (Sun, 28 Apr 2019)
Revision:15031
Build-Date:2019-04-28 02:37:58
URL:https://josm.openstreetmap.de/svn/trunk

Identification: JOSM/1.5 (15031 en) Mac OS X 10.14.4
OS Build number: Mac OS X 10.14.4 (18E226)
Memory Usage: 375 MB / 2048 MB (116 MB allocated, but free)
Java version: 12+33, Oracle Corporation, OpenJDK 64-Bit Server VM
Screen: Display 188945226 1920x1080, Display 69978068 2048x1152
Maximum Screen Size: 2048x1152
Dataset consistency test: No problems found

Plugins:
+ Mapillary (1.5.18)
+ apache-commons (34908)
+ apache-http (34908)
+ auto_tools (73)
+ buildings_tools (34982)
+ continuosDownload (82)
+ graphview (34977)
+ gson (34908)
+ highwayNameModification (1555020960)
+ imagery_offset_db (34908)
+ jna (34908)
+ junctionchecking (34977)
+ kaartvalidation (1554390132)
+ mapdust (${version.entry.commit.revision})
+ markseen (13)
+ openqa (1556288504)
+ osm-obj-info (51)
+ reverter (34977)
+ rex (53)
+ terracer (34977)
+ todo (30306)
+ utilsplugin2 (34977)

Map paint styles:
+ ${HOME}/workspace/osm/JOSM Paint Styles and Presets/Kaart-Styles.mapcss
+ https://josm.openstreetmap.de/josmfile?page=Styles/Coloured_Streets&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Styles/DestinationSignRelation&zip=1
+ https://raw.githubusercontent.com/species/josm-preset-traffic_sign_direction/master/direction.mapcss
+ https://josm.openstreetmap.de/josmfile?page=Styles/Lane_and_Road_Attributes&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Styles/Maxspeed&zip=1
+ https://raw.githubusercontent.com/OpenSidewalks/OpenSidewalks-Schema/master/open_sidewalks.mapcss

Validator rules:
+ ${HOME}/workspace/osm/kaart.validator.mapcss

Last errors/warnings:
- W: Expecting test '{0.key} is always in short tons (st)' (i.e., [*[maxweight][maxweight'REGEX'^[0-9.]+$][ParameterFunction~inside(class org.openstreetmap.josm.gui.mappaint.Environment,class java.lang.String <US>)], *[maxaxleload][maxaxleload'REGEX'^[0-9.]+$][ParameterFunction~inside(class org.openstreetmap.josm.gui.mappaint.Environment,class java.lang.String <US>)]]) to match way highway=residential maxweight=5.0 (i.e., TagMap[highway=residential,maxweight=5.0])
- W: Expecting test '{0.key} is always in short tons (st)' (i.e., [*[maxweight][maxweight'REGEX'^[0-9.]+$][ParameterFunction~inside(class org.openstreetmap.josm.gui.mappaint.Environment,class java.lang.String <US>)], *[maxaxleload][maxaxleload'REGEX'^[0-9.]+$][ParameterFunction~inside(class org.openstreetmap.josm.gui.mappaint.Environment,class java.lang.String <US>)]]) to match way highway=residential maxweight=5 (i.e., TagMap[highway=residential,maxweight=5])
- W: Expecting test '{0.key} is always in short tons (st)' (i.e., [*[maxweight][maxweight'REGEX'^[0-9.]+$][ParameterFunction~inside(class org.openstreetmap.josm.gui.mappaint.Environment,class java.lang.String <US>)], *[maxaxleload][maxaxleload'REGEX'^[0-9.]+$][ParameterFunction~inside(class org.openstreetmap.josm.gui.mappaint.Environment,class java.lang.String <US>)]]) to match way highway=residential maxweight=5.0 (i.e., TagMap[highway=residential,maxweight=5.0])
- W: Expecting test '{0.key} is always in short tons (st)' (i.e., [*[maxweight][maxweight'REGEX'^[0-9.]+$][ParameterFunction~inside(class org.openstreetmap.josm.gui.mappaint.Environment,class java.lang.String <US>)], *[maxaxleload][maxaxleload'REGEX'^[0-9.]+$][ParameterFunction~inside(class org.openstreetmap.josm.gui.mappaint.Environment,class java.lang.String <US>)]]) to match way highway=residential maxweight=5 (i.e., TagMap[highway=residential,maxweight=5])
- W: Expecting test '{0.key} is always in short tons (st)' (i.e., [*[maxweight][maxweight'REGEX'^[0-9.]+$][ParameterFunction~inside(class org.openstreetmap.josm.gui.mappaint.Environment,class java.lang.String <US>)], *[maxaxleload][maxaxleload'REGEX'^[0-9.]+$][ParameterFunction~inside(class org.openstreetmap.josm.gui.mappaint.Environment,class java.lang.String <US>)]]) to match way highway=residential maxweight=5.0 (i.e., TagMap[highway=residential,maxweight=5.0])
- W: Expecting test '{0.key} is always in short tons (st)' (i.e., [*[maxweight][maxweight'REGEX'^[0-9.]+$][ParameterFunction~inside(class org.openstreetmap.josm.gui.mappaint.Environment,class java.lang.String <US>)], *[maxaxleload][maxaxleload'REGEX'^[0-9.]+$][ParameterFunction~inside(class org.openstreetmap.josm.gui.mappaint.Environment,class java.lang.String <US>)]]) to match way highway=residential maxweight=5 (i.e., TagMap[highway=residential,maxweight=5])
- W: Expecting test 'Avoid using unicode ' in names (‘’) ({0.key})' (i.e., [*[name'REGEX'.*([‘’']+).*]]) to not match way name="Testing's Road" (i.e., TagMap[name=Testing's Road])
- W: Expecting test '{0.key} is always in short tons (st)' (i.e., [*[maxweight][maxweight'REGEX'^[0-9.]+$][ParameterFunction~inside(class org.openstreetmap.josm.gui.mappaint.Environment,class java.lang.String <US>)], *[maxaxleload][maxaxleload'REGEX'^[0-9.]+$][ParameterFunction~inside(class org.openstreetmap.josm.gui.mappaint.Environment,class java.lang.String <US>)]]) to match way highway=residential maxweight=5.0 (i.e., TagMap[highway=residential,maxweight=5.0])
- W: Expecting test '{0.key} is always in short tons (st)' (i.e., [*[maxweight][maxweight'REGEX'^[0-9.]+$][ParameterFunction~inside(class org.openstreetmap.josm.gui.mappaint.Environment,class java.lang.String <US>)], *[maxaxleload][maxaxleload'REGEX'^[0-9.]+$][ParameterFunction~inside(class org.openstreetmap.josm.gui.mappaint.Environment,class java.lang.String <US>)]]) to match way highway=residential maxweight=5 (i.e., TagMap[highway=residential,maxweight=5])
- E: Thread main-worker-0 raised java.lang.IllegalArgumentException: bytes must be >= 0

Attachments (0)

Change History (4)

comment:1 Changed 6 months ago by Don-vip

Component: Core mappaintCore validator
Keywords: template_report, mapcsstemplate_report mapcss

comment:2 Changed 6 months ago by Don-vip

Owner: changed from team to taylor.smock
Status: newneedinfo

Why don't you use "{0.tag}" instead of tag("{0.key}")?

comment:3 Changed 6 months ago by taylor.smock

I'm using a regex instead of a set value. {0.tag} gives name=.*([‘’]+).* and {0.value} gives .*([‘’]+).*. This indicated (to me) that the {0.tag}/{0.value} give the value as written in the test, not in the actual object. Since I'm not the only person writing validator.mapcss checks, I figured that changing the behavior of tag("{0.key}") would be the least likely to break other validator.mapcss checks publicly available (some might depend upon the current behavior of {0.tag}/{0.value}).

comment:4 Changed 6 months ago by Don-vip

Owner: changed from taylor.smock to team
Status: needinfonew

OK

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set.
to The owner will be changed from team to the specified user.
The owner will change to taylor.smock
as duplicate The resolution will be set to duplicate.The specified ticket will be cross-referenced with this ticket
The owner will be changed from team to anonymous.

Add Comment


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

 
Note: See TracTickets for help on using tickets.