Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Old Dominion support #103

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Old Dominion support #103

wants to merge 4 commits into from

Conversation

cgunther
Copy link

@cgunther cgunther commented Jul 11, 2024

I've been maintaining this for a while privately, but figured it was worth trying to upstream.

I'm not confident on the actual regex for the tracking numbers, as this is largely based just on some example tracking (pro) numbers I've seen. I've gradually had to tweak the regex to accommodate new tracking numbers.

One of the valid tracking numbers I included (78045768393) does match both Old Dominion and DHL, however DHL's website doesn't recognize the tracking number, so maybe DHL is too loose (or maybe it's a possible DHL number, they just haven't used it yet).

Summary by CodeRabbit

  • New Features

    • Added support for Old Dominion Freight Line and Old Dominion Guaranteed Shipment tracking numbers.
  • Enhancements

    • Implemented Luhn algorithm for checksum validation of tracking numbers.

…zing them

Maybe the third digit is irrelevant and just coincidental that our
existing data always had 777?
The old URL redirects to something new, but not that actually offers the
tracking you'd be looking for.
…zing them

This does introduce a conflict with DHL, however.
Copy link

coderabbitai bot commented Jul 11, 2024

Walkthrough

The changes introduce new configurations for Old Dominion Freight Line tracking numbers and add a Luhn algorithm validation method to spec_helper.rb. Configurations include regex patterns, validation methods, and tracking URLs. The Luhn algorithm method is incorporated into the ChecksumValidations module for enhanced validation processes.

Changes

Files Change Summary
couriers/old_dominion.json Introduced configurations for Old Dominion Freight Line, including regex patterns and tracking URLs.
spec/spec_helper.rb Added a validates_luhn? method in the ChecksumValidations module for Luhn algorithm validation.

Poem

In code we trust, our paths aligned,
With regex true and Luhn refined,
Old Dominion’s track now set,
In digital realms, our goals are met.
🎉✨ Keep on coding, swift and bright,
We journey forth from day to night. 🌙🚀


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 939580e and a3a13e4.

Files selected for processing (2)
  • couriers/old_dominion.json (1 hunks)
  • spec/spec_helper.rb (2 hunks)
Additional comments not posted (5)
couriers/old_dominion.json (4)

2-19: Configuration for "Old Dominion" looks good.

The regex pattern, validation method, and tracking URL are correctly defined.


36-49: Configuration for "Old Dominion Guaranteed Shipment" looks good.

The regex pattern, validation method, and tracking URL are correctly defined.


21-32: Verify test numbers for "Old Dominion".

Ensure that the provided test numbers adequately cover various scenarios, including edge cases.

Verification successful

Test numbers for "Old Dominion" verified.

The couriers/old_dominion.json file contains both valid and invalid test numbers, covering various formats and scenarios.

  • File: couriers/old_dominion.json
  • Lines: 21-32
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that test numbers cover various scenarios for "Old Dominion".

# Test: Check the presence of valid and invalid test numbers.
rg --type json -A 5 $'\"valid\": \[
  \"07209562763\",
  \" 0 7 2 0 9 5 6 2 7 6 3 \",
  \"77767553207\",
  \"77806528897\",
  \"78045768393\"
\]'

Length of output: 326


Script:

#!/bin/bash
# Description: Verify that test numbers cover various scenarios for "Old Dominion".

# Test: Check the presence of valid and invalid test numbers with multiline mode enabled.
rg --type json --multiline -A 5 $'\"valid\": \[
  \"07209562763\",
  \" 0 7 2 0 9 5 6 2 7 6 3 \",
  \"77767553207\",
  \"77806528897\",
  \"78045768393\"
\]'

Length of output: 146


Script:

#!/bin/bash
# Description: Verify the presence of the `valid` and `invalid` keys and their values in the `old_dominion.json` file.

# Search for the `valid` key in the file and display its context.
rg --type json --multiline -A 10 '"valid": \['

# Search for the `invalid` key in the file and display its context.
rg --type json --multiline -A 5 '"invalid": \['

Length of output: 21486


51-59: Verify test numbers for "Old Dominion Guaranteed Shipment".

Ensure that the provided test numbers adequately cover various scenarios, including edge cases.

spec/spec_helper.rb (1)

18-37: Implementation of validates_luhn? looks correct.

The method correctly implements the Luhn algorithm for checksum validation.

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.

None yet

1 participant