#21041 closed defect (fixed)
Some test not evaluated in preset validator
Reported by: | Famlam | Owned by: | Don-vip |
---|---|---|---|
Priority: | normal | Milestone: | 21.06 |
Component: | Core | Version: | latest |
Keywords: | template_report validator presets | Cc: | simon04 |
Description (last modified by )
What steps will reproduce the problem?
- Enable "Run data validator on user input
- Add the following mapcss validator rule (to reproduce this problem easily)
way[highway][waylength()<1] { throwWarning: tr("This way is less than 1 m"); }
- Select any existing highway (clearly larger than 1 m). I chose way 24511833
- Click the preset corresponding to the highway setting (in this case the preset for tertiary roads)
What is the expected result?
Validator in presets dialog knows way length
What happens instead?
Validator in preset dialog doesn't know waylength (but pretends it knows and that it's short ;) )
Please provide any additional information below. Attach a screenshot if possible.
This feature was introduced in #19078
Edit: it also triggers if you use [waylength()=0] instead of [waylength()<1] so apparently it thinks the way is exactly 0m long.
URL:https://josm.openstreetmap.de/svn/trunk Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b Last:Changed Date: 2021-06-02 22:03:39 +0200 (Wed, 02 Jun 2021) Build-Date:2021-06-02 20:11:30 Revision:17919 Relative:URL: ^/trunk Identification: JOSM/1.5 (17919 nl) Windows 10 64-Bit OS Build number: Windows 10 Home 2009 (19043) Memory Usage: 534 MB / 1820 MB (164 MB allocated, but free) Java version: 1.8.0_291-b10, Oracle Corporation, Java HotSpot(TM) 64-Bit Server VM Look and Feel: com.sun.java.swing.plaf.windows.WindowsLookAndFeel Screen: \Display0 1920×1080 (scaling 1.00×1.00) Maximum Screen Size: 1920×1080 Best cursor sizes: 16×16→32×32, 32×32→32×32 System property file.encoding: Cp1252 System property sun.jnu.encoding: Cp1252 Locale info: nl_NL Numbers with default locale: 1234567890 -> 1234567890 Dataset consistency test: No problems found Plugins: + OpeningHoursEditor (35640) + SimplifyArea (35640) + imagery_offset_db (35640) + pt_assistant (1ff2e15) + reverter (35732) + tageditor (35640) + turnlanes-tagging (288) + undelete (35640) + utilsplugin2 (35691) Tagging presets: + http://mijndev.openstreetmap.nl/~allroads/JOSM/Presets/NL-Fiets.zip Map paint styles: - https://josm.openstreetmap.de/josmfile?page=Styles/Lane_and_Road_Attributes&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/PublicTransport&zip=1 + %UserProfile%\Documents\tijdelijke bestanden\josm-eigen.mappaint.mapcss + https://josm.openstreetmap.de/josmfile?page=Styles/Sidewalks&zip=1 Validator rules: + %UserProfile%\Documents\tijdelijke bestanden\josm-eigen.validator.mapcss Last errors/warnings: - 00007.469 E: Lokaliseren van afbeelding 'bus.png' mislukt
Attachments (2)
Change History (14)
by , 4 years ago
Attachment: | Waylength error.png added |
---|
comment:1 by , 4 years ago
Description: | modified (diff) |
---|
comment:2 by , 4 years ago
comment:3 by , 4 years ago
Owner: | changed from | to
---|---|
Status: | new → needinfo |
Cannot reproduce with latest. I get the informal warning about waterways and the mentioned rule about short highways leads to a warning. Additionally waylength()
works with search if set to mapcss.
I do not really understand how presets come into play and I can only guess you are using match_expression=""
which is broken, see #20843. May you, please, add a complete preset example demonstrating the problem. Thanks
Relative:URL: ^/trunk Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b Last:Changed Date: 2021-06-22 22:57:10 +0200 (Tue, 22 Jun 2021) Revision:17942 Build-Date:2021-06-23 01:31:04 URL:https://josm.openstreetmap.de/svn/trunk
comment:4 by , 4 years ago
Hello Skyper,
I do not use any custom presets, I just use the (existing, unmodified) preset for highway=tertiary.
In #19078 a new feature was introduced that runs validation within the presets window, i.e. to warn you if you enter a bad value (for which you have to enable the setting described in the first step of 'how to reproduce').
This is fully unrelated to the button "validate" (to run the validator outside of the presets window) or "search": they work fine with waylength().
See the step by step how-to that I'll upload now
comment:5 by , 4 years ago
Owner: | changed from | to
---|---|
Status: | needinfo → new |
Oh sorry, I disabled that feature as it uses too much resources. Now, I can reproduce, thanks.
There are more problems as deleting the name=*
from your example should give another warning Unnamed ways
which I do not get.
comment:6 by , 4 years ago
Keywords: | waylength removed |
---|---|
Summary: | waylength not evaluated in preset validator → Some test not evaluated in preset validator |
Looking at #19078 again, I am not sure if all mapcss are supported, yet.
comment:7 by , 4 years ago
Perhaps good to mention that the check for unnamed ways is a java test (except for highway=unclassified, which is a mapcss check :confused: )
In UntaggedWay.java
comment:8 by , 4 years ago
You are right about "unnamed ways". I rechecked and found other mapcss rules not working like Overlapping Areas
:
area:closed:areaStyle ⧉ area:closed:areaStyle { throwOther: tr("Overlapping Areas"); }
or Public Transport GTFS: conflicting tags - `{0}` conflicts with `{1}` of the `route_master` relation.
:
*[gtfs:route_id ][count(split(";", tag("gtfs:route_id"))) > 1], *[gtfs:shape_id ][count(split(";", tag("gtfs:shape_id"))) > 1], *[gtfs:trip_id ][count(split(";", tag("gtfs:trip_id"))) > 1], *[gtfs:trip_id:sample][count(split(";", tag("gtfs:trip_id:sample"))) > 1] { throwOther: tr("Multiple values `{0}` for `{1}=*`.", "{0.value}", "{0.key}"); group: tr("Public Transport GTFS: value syntax"); set MultipleID; assertMatch: "relation gtfs:route_id=7-342-j1j-1;7-342-j1j-5"; assertNoMatch: "relation gtfs:route_id=7-342-j1j-1.H"; } relation!.MultipleID[count(split(";", parent_tag("gtfs:route_id"))) == 1] { set NoMultiId; } relation[gtfs:route_id ][!(parent_tag("gtfs:route_id") == tag("gtfs:route_id"))].NoMultiId, relation[gtfs:shape_id ][!gtfs:route_id][!(parent_tag("gtfs:route_id") == get(regexp_match("(.+)\\.\\d+\\.[HR]$", tag("gtfs:shape_id")), 1))].NoMultiId, relation[gtfs:trip_id ][!gtfs:route_id][!gtfs:shape_id][!(parent_tag("gtfs:route_id") == get(regexp_match("^\\d+\\.T[023A]\\.(.+)\\.\\d+\\.[HR]$", tag("gtfs:trip_id")), 1))].NoMultiId, relation[gtfs:trip_id:sample][!gtfs:route_id][!gtfs:shape_id][!(parent_tag("gtfs:route_id") == get(regexp_match("^\\d+\\.T[023A]\\.(.+)\\.\\d+\\.[HR]$", tag("gtfs:trip_id:sample")), 1))].NoMultiId { throwWarning: tr("`{0}` conflicts with `{1}` of the `route_master` relation.", "{0.tag}", "gtfs:route_id=*"); group: tr("Public Transport GTFS: conflicting tags");
comment:9 by , 4 years ago
In TaggingPresetValidation, primitives being checked are first cloned, but it results in empty ways and relations:
static OsmPrimitive clone(OsmPrimitive original) { if (original instanceof Node) { return new Node(((Node) original)); } else if (original instanceof Way) { return new Way(((Way) original), false, false); } else if (original instanceof Relation) { return new Relation(((Relation) original), false, false); } else { throw new IllegalStateException(); } }
comment:10 by , 4 years ago
Milestone: | → 21.06 |
---|---|
Owner: | changed from | to
Status: | new → assigned |
Currently one internal rule is affected in combinations.mapcss