Skip to content

Remove stray space from Alabama postcode 36877 - #1957

Merged
kingthorin merged 1 commit into
datafaker-net:mainfrom
ChandraChaan:fix/us-postcode-space-pr
Nov 4, 2026
Merged

kingthorin merged 1 commit into
datafaker-net:mainfrom
ChandraChaan:fix/us-postcode-space-pr

Conversation

@ChandraChaan

Copy link
Copy Markdown
Contributor

_US.yml has " 36877" (with a leading space) in postcode_by_state.AL, between "36875" and "36879". It is the only entry in the US postcode_by_state lists that is not five digits, and the county table in the same file has '36877'. Address.zipCodeByState returns the value untrimmed, so for Alabama it can return a code with a leading space.

This removes the space. I also added UsPostcodesByStateTest, which loads _US.yml and checks that every postcode_by_state entry matches [0-9]{5}. AddressTest.testZipCodeByState checks the same pattern, but it picks a random state and a random code, so it almost never hits this one entry.

I couldn't run Maven locally, so I ran the build on a fork:

  • Test only, without the fix: Java CI fails on JDK 25 / ubuntu with UsPostcodesByStateTest.everyPostcodeByStateHasFiveDigits ... [postcodes of AL] listing " 36877". The other jobs of that run were cancelled after that failure.
  • Test with the fix: Java CI passes on 13 of 16 jobs, including the new test on JDK 17, 21, 25 and 27 on ubuntu, ubuntu-arm and windows, and on macOS with JDK 25. The three remaining macOS jobs (JDK 17, 21 and 27) were cancelled before any step ran, so they gave no result.

The commit in this PR is the squashed form of the fix branch (identical tree).

_US.yml listed " 36877" with a leading space in
postcode_by_state.AL, the only entry among the US postcodes that is not
five digits. Address.zipCodeByState returns the value as is, so it could
return the space-prefixed code for AL. The county table in the same
file has '36877'.

Fix the entry and add a test that checks every US postcode_by_state
entry has five digits.
@what-the-diff

what-the-diff Bot commented Nov 4, 2026

Copy link
Copy Markdown

PR Summary

  • Adds validation for US postcode data
    The new test checks that every state has at least one postcode and that all listed postcodes use the expected five-digit format. This helps catch missing or incorrectly formatted data.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.40%. Comparing base (ca770ef) to head (806db0e).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1957      +/-   ##
============================================
- Coverage     92.41%   92.40%   -0.02%     
  Complexity     3579     3579              
============================================
  Files           348      348              
  Lines          7081     7081              
  Branches        694      694              
============================================
- Hits           6544     6543       -1     
  Misses          371      371              
- Partials        166      167       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kingthorin
kingthorin merged commit 43aaf85 into datafaker-net:main Nov 4, 2026
15 of 17 checks passed
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.

4 participants