Open Famlam opened 1 year ago
!.TunnelCulvertWithoutWaterway
should be consisted as true on non declared type, or the rule "unparsable" for the undeclard type ?
Please, can you check what JOSM does in this case?
In JOSM, the following rule matches everything, even though I have never declared any abcdef
*!.abcdef {
throwWarning: "x";
}
So indeed, .something
is always false (and !.something
is always true) until you've encountered a set something
line.
In fact, the current implementation in Osmose for unparsable rules (which JOSM doesn't have as they define the rules) has another related flaw, as it only checks if a set
has been declared once. However, if you have (extreme example) the following:
node[x=y] {
set abc; /* matches almost nothing, but is parsable by Osmose */
}
way > * {
set abc; /* matches any node of a way, but can't be parsed by Osmose */
}
node:unconnected {
set abc; /* matches any node not part of a way, but can't be parsed by Osmose */
}
node!.abc {
throwWarning: "X";
}
Then Osmose will throw a warning for all nodes, except nodes with x=y
, while JOSM won't do anything.
Probably the best is not to filter out rules that have an undeclared set
, but only to filter out rules where the set was declared in a rule that could not be parsed.
Probably the best is not to filter out rules that have an undeclared set, but only to filter out rules where the set was declared in a rule that could not be parsed.
Yes. I agree with that.
It still needs to be converted into a proper automated test case, but for manual testing, the following file could perhaps be useful:
Unfortunately I haven't been able to get it working properly yet.
We have a new, comparable, case: https://josm.openstreetmap.de/browser/josm/trunk/resources/data/validator/numeric.mapcss For this rule:
*[min_height ][min_height !~ /^(-?([0-9]+(\.[0-9]+)?( m)?)|(-?[1-9][0-9]*\'((10|11|[0-9])((\.[0-9]+)?)\")?))$/]!.min_height_separator_autofix!.min_height_meter_autofix!.min_height_foot_autofix {
throwWarning: tr("unusual value of {0}: {1} is default; point is decimal separator; if units, put space then unit", "{0.key}", tr("meters"));
assertMatch: "node min_height=\"12. m\"";
assertNoMatch: "node min_height=-5";
}
the selector min_height_foot_autofix
has never been defined. Since it's a negated selector, it works fine in JOSM. For us, the rule gets:
# Skip selector using undeclared class min_height_foot_autofix, min_height_meter_autofix, min_height_separator_autofix
(which by the way is slightly misleading: only min_height_foot_autofix
is undeclared).
~I'll blacklist the rule and add min_height
to Number.py instead; just filing it here for reference.~ EDIT: this rule will probably disappear again in the commit of https://josm.openstreetmap.de/ticket/17669
I tried to update the mapcss files in preparation for another PR, and saw the following line:
# Skip selector using undeclared class TunnelCulvertWithoutWaterway
in the py file for https://josm.openstreetmap.de/browser/josm/trunk/resources/data/validator/combinations.mapcssIt came from this rule:
# *[tunnel][!highway][!area:highway][!railway][!waterway][!piste:type][type!=tunnel][public_transport!=platform][route!=ferry][man_made!=pipeline][man_made!=goods_conveyor][man_made!=wildlife_crossing][man_made!=tunnel][power!=cable]!.TunnelCulvertWithoutWaterway
(which would match 1998 nodes if parsed correctly)TunnelCulvertWithoutWaterway
is however declared, just not fornode
/relation
:As it is only set for
way
rules, the mapcss2osmose script now discards anynode
/relation
rule that refers to it via!.TunnelCulvertWithoutWaterway
(The discarding was done in case it was declared in an "unparsable" rule)