Skip to content

refactor: rework the MinimalVisibilityCommand regex#700

Merged
mivek merged 1 commit intomainfrom
refacto/minimal-visibility-regex
Jul 10, 2025
Merged

refactor: rework the MinimalVisibilityCommand regex#700
mivek merged 1 commit intomainfrom
refacto/minimal-visibility-regex

Conversation

@mivek
Copy link
Copy Markdown
Owner

@mivek mivek commented Jul 8, 2025

No description provided.

Copilot AI review requested due to automatic review settings July 8, 2025 20:08
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jul 8, 2025

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

Refactors the MinimalVisibilityCommand to use a more precise regex that captures numeric visibility and direction separately, normalizes input to uppercase before matching, and updates tests to align with these changes.

  • Clarified regex to explicitly capture the four-digit visibility and one- or two-letter compass directions
  • Uppercases input in execute and canParse and adjusts group indexing
  • Updated existing test and added parameterized tests for all uppercase directions

Reviewed Changes

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

File Description
metarParser-parsers/src/test/java/io/github/mivek/parser/MetarParserTest.java Changed expected minimal visibility direction from lowercase to uppercase
metarParser-parsers/src/test/java/io/github/mivek/command/common/MinimalVisibilityCommandTest.java Added parameterized tests for each uppercase compass direction
metarParser-parsers/src/main/java/io/github/mivek/command/common/MinimalVisibilityCommand.java Refactored regex, applied toUpperCase() on input, and split groups for digits and direction
Comments suppressed due to low confidence (1)

metarParser-parsers/src/test/java/io/github/mivek/command/common/MinimalVisibilityCommandTest.java:13

  • Consider adding tests for lowercase direction inputs (e.g., "nw") to ensure the command correctly handles case-insensitive input after uppercasing.
    @ValueSource(strings = {"NW", "N","NE","E","SE","S","SW","W"})

@mivek mivek force-pushed the refacto/minimal-visibility-regex branch from f7ea459 to 558efa4 Compare July 8, 2025 20:17
@mivek mivek changed the title refacto: rework the MinimalVisibilityCommand regex refactor: rework the MinimalVisibilityCommand regex Jul 8, 2025
@mivek mivek merged commit b406370 into main Jul 10, 2025
11 of 12 checks passed
@mivek mivek deleted the refacto/minimal-visibility-regex branch July 10, 2025 19:42
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