Changes between Version 15 and Version 16 of Rules/PublicTransportGtfs


Ignore:
Timestamp:
2020-07-27T17:07:27+02:00 (6 years ago)
Author:
skyper
Comment:

warn about incomplete ref:IFOPT

Legend:

Unmodified
Added
Removed
Modified
  • Rules/PublicTransportGtfs

    v15 v16  
    241241*[network:guid ][network:guid  !~  /^([A-Z]{2}-){2}[a-zA-Z]{2}.*$/],
    242242*[operator:guid][operator:guid !~  /^([A-Z]{2}-){2}[a-zA-Z]{2}.*$/],
    243 *[gtfs:source_date][gtfs:source_date !~ /^20(1[7-9]|20)-(0[1-9]|1[0-2])-(3[01]|[12][0-9]|0[1-9])$/],
    244 *[ref:IFOPT   ][ref:IFOPT    !~ /^(gen:[0-9]{4}|[a-z]{2}:[0-9]{5}):[1-9][0-9]{0,4}(:[0-9]{1,2}(:([A-Z]+[ ]?)?[1-9][0-9]{0,2}[A-Z]?)?)?$/],
    245 *[gtfs:stop_id][gtfs:stop_id !~ /^(gen:[0-9]{4}|[a-z]{2}:[0-9]{4,5}):[1-9][0-9]{0,4}(:[0-9]{1,2}(:([A-Z]+[ ]?)?[1-9][0-9]{0,2}[A-Z]?)?)?$/] {
     243*[gtfs:source_date][gtfs:source_date !~ /^20(1[7-9]|20)-(0[1-9]|1[0-2])-(3[01]|[12][0-9]|0[1-9])$/] {
    246244  throwError: tr("Value `{0}` for `{1}=*` does not match value syntax.", "{0.value}", "{0.key}");
    247245/*  throwError: tr("Value `{0}` for `{1}=*` does not match value syntax `{2}`.", "{0.value}", "{0.key}", "{1.value}"); */
     
    256254  assertMatch:   "relation gtfs:source_date=2016-09-30";
    257255  assertNoMatch: "relation gtfs:source_date=2020-09-30";
     256}
     257/* ref:IFOPT, gtfs:stop_id, gtfs:feed, *:guid, gtfs:source_date */
     258/* FIXME: Get proper syntax as regex displayed. */
     259*[ref:IFOPT   ][ref:IFOPT    !~ /^(gen:[0-9]{4}|[a-z]{2}:[0-9]{5}):[1-9][0-9]{0,4}(:[0-9]{1,2}(:([A-Z]+[ ]?)?[1-9][0-9]{0,2}[A-Z]?)?)?$/],
     260*[gtfs:stop_id][gtfs:stop_id !~ /^(gen:[0-9]{4}|[a-z]{2}:[0-9]{4,5}):[1-9][0-9]{0,4}(:[0-9]{1,2}(:([A-Z]+[ ]?)?[1-9][0-9]{0,2}[A-Z]?)?)?$/] {
     261  throwError: tr("Value `{0}` for `{1}=*` does not match value syntax.", "{0.value}", "{0.key}");
     262/*  throwError: tr("Value `{0}` for `{1}=*` does not match value syntax `{2}`.", "{0.value}", "{0.key}", "{1.value}"); */
     263  group: tr("Public Transport GTFS: value syntax");
     264  set ErrorSyntaxIFOPT;
    258265  assertMatch:   "node ref:IFOPT=+1";
    259266  assertMatch:   "node ref:IFOPT=aa:aa:09";
     
    289296}
    290297
     298/* short ref:IFOPT */
     299node!.ErrorSyntaxIFOPT[ref:IFOPT        !~ /^.+(:.+){4}$/][ref:IFOPT   ][public_transport=stop_position],
     300node!.ErrorSyntaxIFOPT[gtfs:stop_id     !~ /^.+(:.+){4}$/][gtfs:stop_id][public_transport=platform],
     301node!.ErrorSyntaxIFOPT[ref:IFOPT        !~ /^.+(:.+){4}$/][ref:IFOPT   ][public_transport=platform],
     302node!.ErrorSyntaxIFOPT[gtfs:stop_id     !~ /^.+(:.+){4}$/][gtfs:stop_id][public_transport=platform],
     303way!.ErrorSyntaxIFOPT[ref:IFOPT         !~ /^.+(:.+){3}$/][ref:IFOPT   ][public_transport=platform],
     304way!.ErrorSyntaxIFOPT[gtfs:stop_id      !~ /^.+(:.+){3}$/][gtfs:stop_id][public_transport=platform],
     305relation!.ErrorSyntaxIFOPT[ref:IFOPT    !~ /^.+(:.+){3}$/][ref:IFOPT   ][public_transport][public_transport =~ /^(platform|stop_area)$/],
     306relation!.ErrorSyntaxIFOPT[gtfs:stop_id !~ /^.+(:.+){3}$/][gtfs:stop_id][public_transport][public_transport =~ /^(platform|stop_area)$/] {
     307  throwWarning: tr("Incomplete `{0}` on `{1}`.", "{2.tag}", "{3.tag}");
     308  group: tr("Public Transport GTFS: value syntax");
     309  assertMatch:   "node public_transport=platform ref:IFOPT=de:09162:1179:31";
     310  assertNoMatch: "node public_transport=platform ref:IFOPT=de:09162:1179:53:KIF 1";
     311  assertNoMatch: "node public_transport=platform ref:IFOPT=DDDD:09162:1179:3:KIF 1";
     312  assertNoMatch: "way public_transport=platform ref:IFOPT=de:09162:1179:21";
     313  assertMatch:   "relation public_transport=platform ref:IFOPT=de:09162:1179";
     314  assertNoMatch: "relation public_transport=platform ref:IFOPT=de:09162:1179:30";
     315  assertNoMatch: "relation public_transport=platform ref:IFOPT=de:09162:1179:30:KIF 1";
     316}
    291317
    292318/*  -----------------------