Modify

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#11234 closed enhancement (fixed)

Validator should warn when key is # or +

Reported by: daganzdaanda Owned by: team
Priority: normal Milestone: 15.04
Component: Core validator Version: tested
Keywords: mistyped key Cc: lists@…

Description

I've just been fixing a number of buildings that had a #=yes tag. ( https://www.openstreetmap.org/changeset/29472433 )
I tested adding this to a building, and the validator did not complain when I uploaded it.
Most probably these keys come from missing the "Enter" key on a German keyboard. I imagine that in the same way one could arrive at "+" as a key. There is no warning message for "+" as well.

Could you add a warning when there is a key "#" or "+"?

Maybe other keyboard layouts could be taken into account, too. Or be even more general and warn about all single letter keys, or keys with special letters apart from ":" and "_"

Attachments (0)

Change History (19)

comment:1 by Don-vip, 9 years ago

Milestone: 15.03
Type: defectenhancement

comment:2 by Klumbumbus, 9 years ago

# has 43 uses and + has 82. So I don't think we need special tests for those, but we can test for uncommon characters in general (which would include # and + then). Also the test for keys which are one character long sounds good. Are there keys with 2 characters?

in reply to:  2 comment:3 by Don-vip, 9 years ago

Replying to Klumbumbus:

Are there keys with 2 characters?

See http://taginfo.openstreetmap.org/reports/key_lengths

comment:4 by Klumbumbus, 9 years ago

There are:

  • ID - not documented, looks like some local imports on taginfo map
  • Id - not documented
  • kp - replaced by distance
  • pk - replaced by distance
  • to - used in public transport routes (from=* to=*)

So I think we could warn with "short key" for all keys with 2 or less characters except "to".

in reply to:  4 comment:5 by Don-vip, 9 years ago

Replying to Klumbumbus:

There are:

  • ID - not documented, looks like some local imports on taginfo map
  • Id - not documented
  • kp - replaced by distance
  • pk - replaced by distance
  • to - used in public transport routes (from=* to=*)

So I think we could warn with "short key" for all keys with 2 or less characters except "to".

Maybe allow "id" in lowercase too.

At the other side we should also issue a warning for extra long keys (>55 chars). The longest key I find somewhat acceptable is railway:milestone:emergency_brake_override:direction (52 chars)

in reply to:  4 ; comment:6 by Klumbumbus, 9 years ago

Someone has the regexp for the counts at hand?

in reply to:  6 comment:7 by Klumbumbus, 9 years ago

Replying to Klumbumbus:

Someone has the regexp for the counts at hand?

Or could we use the length() expression?

Last edited 9 years ago by Klumbumbus (previous) (diff)

comment:8 by Klumbumbus, 9 years ago

For character test I have this:

*[/=|\+|\/|&|<|>|;|'|"|%|#|@|\\|,|\./] {
  throwWarning: tr("key with uncommon character");
}

? | and { do not work, they produce exceptions in the console, even with leading \

Any improvements to this?

comment:9 by daganzdaanda, 9 years ago

Keys should not have any whitespace, so maybe check for the various possible spaces?
Would a check for unicode ranges be sensible? Either positive or negative?

This is a good overview of what's out there:
http://taginfo.openstreetmap.org/reports/characters_in_keys

in reply to:  9 comment:10 by Klumbumbus, 9 years ago

Replying to daganzdaanda:

Keys should not have any whitespace, so maybe check for the various possible spaces?

There is already a test for white spaces.

comment:11 by Klumbumbus, 9 years ago

The charadcter count somehow does bot work. I tried the following (and a hundred other possibilities):

*[/.{1,2}/] {
  throwWarning: tr("uncommon short key");
}
*[/.?.?/] {
  throwWarning: tr("uncommon short key");
}

What's wrong?

Version 0, edited 9 years ago by Klumbumbus (next)

comment:12 by Klumbumbus, 9 years ago

Milestone: 15.0315.04

comment:13 by Aun Johnsen <lists@…>, 9 years ago

Cc: lists@… added

comment:14 by Klumbumbus, 9 years ago

In 8185/josm:

see #11234 - add warning for some uncommon characters in keys

in reply to:  14 comment:15 by Klumbumbus, 9 years ago

Replying to Klumbumbus:

In 8185/josm:

see #11234 - add warning for some uncommon characters in keys

Improvements to this are very welcome.

comment:16 by stoecker, 9 years ago

@Klumbumbus:

Please open a defect ticket for the MapCSS issues you found and close this.

comment:17 by aceman, 9 years ago

Are those keys with Chinese characters valid? Is there a rule for keys only being a-z0-9 or something?

in reply to:  16 comment:18 by Klumbumbus, 9 years ago

Resolution: fixed
Status: newclosed

Replying to stoecker:

@Klumbumbus:

Please open a defect ticket for the MapCSS issues you found and close this.

see #11330

comment:19 by Klumbumbus, 9 years ago

In 8544/josm:

see #11234 - add { } ? * ^ $ to "key with uncommon character" test (availible since r8535)

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.