Modify

Opened 4 years ago

Closed 4 years ago

Last modified 4 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 Changed 4 years ago by Don-vip

Milestone: 15.03
Type: defectenhancement

comment:2 Changed 4 years ago by Klumbumbus

# 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?

comment:3 in reply to:  2 Changed 4 years ago by Don-vip

Replying to Klumbumbus:

Are there keys with 2 characters?

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

comment:4 Changed 4 years ago by 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".

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

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)

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

Someone has the regexp for the counts at hand?

comment:7 in reply to:  6 Changed 4 years ago by Klumbumbus

Replying to Klumbumbus:

Someone has the regexp for the counts at hand?

Or could we use the length() expression?

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

comment:8 Changed 4 years ago by Klumbumbus

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 Changed 4 years ago by daganzdaanda

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

comment:10 in reply to:  9 Changed 4 years ago by Klumbumbus

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

The charadcter count somehow does not 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?

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

comment:12 Changed 4 years ago by Klumbumbus

Milestone: 15.0315.04

comment:13 Changed 4 years ago by Aun Johnsen <lists@…>

Cc: lists@… added

comment:14 Changed 4 years ago by Klumbumbus

In 8185/josm:

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

comment:15 in reply to:  14 Changed 4 years ago by Klumbumbus

Replying to Klumbumbus:

In 8185/josm:

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

Improvements to this are very welcome.

comment:16 Changed 4 years ago by stoecker

@Klumbumbus:

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

comment:17 Changed 4 years ago by aceman

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

comment:18 in reply to:  16 Changed 4 years ago by Klumbumbus

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

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.

Add Comment


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

 
Note: See TracTickets for help on using tickets.