Skip to content

feat: parse TAF messages without delivery time#701

Merged
mivek merged 1 commit intomainfrom
feat/support-non-delivery-time
Jul 11, 2025
Merged

feat: parse TAF messages without delivery time#701
mivek merged 1 commit intomainfrom
feat/support-non-delivery-time

Conversation

@mivek
Copy link
Copy Markdown
Owner

@mivek mivek commented Jul 10, 2025

When a TAF message does not contain a delivery time, the validity time is taken as delivery time.

Back-port of mivek/python-metar-taf-parser#73

When a TAF message does not contain a delivery time, the validity time is taken as delivery time.
Copilot AI review requested due to automatic review settings July 10, 2025 21:03
@github-actions
Copy link
Copy Markdown

Please check on sonarcloud https://sonarcloud.io/project/pull_requests_list?id=io.github.mivek%3AmetarParser that the PR does not add any issue.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the TAF parser to handle messages that omit an explicit delivery time by using the validity start as the delivery time.

  • parseDeliveryTime now returns a boolean indicating if the token was a delivery time, so the parser can skip tokens appropriately.
  • TAFParser uses the return value to decide whether to advance to the validity time token or reuse it.
  • A new unit test (testParseWithoutDeliveryTime) verifies the no-delivery-time scenario.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
metarParser-parsers/src/main/java/io/github/mivek/parser/TAFParser.java Adjusted index increment logic around delivery/validity tokens
metarParser-parsers/src/main/java/io/github/mivek/parser/AbstractWeatherCodeParser.java Changed parseDeliveryTime to return boolean and updated its logic
metarParser-parsers/src/test/java/io/github/mivek/parser/TAFParserTest.java Added a test for parsing a TAF message without an explicit delivery time
Comments suppressed due to low confidence (2)

metarParser-parsers/src/main/java/io/github/mivek/parser/AbstractWeatherCodeParser.java:51

  • [nitpick] The method name parseDeliveryTime doesn’t convey its boolean return semantics. Consider renaming to something like tryParseDeliveryTime or consumeDeliveryTimeIfPresent for clarity.
    boolean parseDeliveryTime(final AbstractWeatherCode weatherCode, final String time) {

metarParser-parsers/src/test/java/io/github/mivek/parser/TAFParserTest.java:960

  • It would be helpful to add a complementary test case where the TAF message includes an explicit delivery time (with minutes) to ensure the original behavior remains correct.
    void testParseWithoutDeliveryTime() throws ParseException {

@mivek mivek merged commit 182ff5e into main Jul 11, 2025
11 checks passed
@mivek mivek deleted the feat/support-non-delivery-time branch July 11, 2025 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants