Skip to content

Conversation

@Shane32
Copy link
Owner

@Shane32 Shane32 commented Oct 13, 2025

No description provided.

@Shane32 Shane32 added this to the 1.7.1 milestone Oct 13, 2025
@Shane32 Shane32 self-assigned this Oct 13, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 13, 2025

📝 Walkthrough

Walkthrough

Replaced AlphanumericEncoder.CanEncode with AlphanumericEncoder.CanEncodeNonDigit in QRCodeGenerator.GetEncodingFromPlaintext, adjusting the alphanumeric detection for non-digit characters. Renamed the public method in AlphanumericEncoder and updated its XML docs. The logic remains unchanged aside from the method name and its use in encoding mode selection.

Changes

Cohort / File(s) Summary
Alphanumeric encoding pathway
QRCoder/QRCodeGenerator.cs, QRCoder/QRCodeGenerator/AlphanumericEncoder.cs
QRCodeGenerator now calls AlphanumericEncoder.CanEncodeNonDigit during encoding detection. AlphanumericEncoder’s public API was renamed from CanEncode to CanEncodeNonDigit; XML docs updated. No change to underlying encoding logic aside from the name used and adjusted control flow condition.

Sequence Diagram(s)

sequenceDiagram
    actor Caller
    participant Gen as QRCodeGenerator
    participant Alpha as AlphanumericEncoder

    Caller->>Gen: GetEncodingFromPlaintext(plaintext)
    activate Gen
    Gen->>Gen: Scan characters
    alt Digit-only branch
        Gen->>Gen: Select Numeric
    else Alphanumeric branch
        Gen->>Alpha: CanEncodeNonDigit(c)
        Alpha-->>Gen: bool
        Gen->>Gen: Select Alphanumeric if all pass
    else Fallback
        Gen->>Gen: Select Byte
    end
    Gen-->>Caller: EncodingMode
    deactivate Gen

    note right of Gen: Change: uses CanEncodeNonDigit for non-digit checks
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly describes the primary change—renaming the AlphanumericEncoder.CanEncode method—which directly corresponds to the updated method signature and related call sites in the changeset. It is concise, clear, and specific enough for a teammate browsing the history to immediately grasp the main update.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix_canencode

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a533b64 and 0e96645.

📒 Files selected for processing (2)
  • QRCoder/QRCodeGenerator.cs (1 hunks)
  • QRCoder/QRCodeGenerator/AlphanumericEncoder.cs (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
QRCoder/QRCodeGenerator.cs (1)
QRCoder/QRCodeGenerator/AlphanumericEncoder.cs (2)
  • AlphanumericEncoder (8-76)
  • CanEncodeNonDigit (41-41)
QRCoder/QRCodeGenerator/AlphanumericEncoder.cs (1)
QRCoder/QRCodeGenerator.cs (1)
  • IsInRange (763-764)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Test .NET Framework 4.6.2
  • GitHub Check: Test .NET Core 3.1
  • GitHub Check: Test .NET 6.0 Windows
  • GitHub Check: Test .NET Core 2.1
  • GitHub Check: Test .NET 5.0 Windows
  • GitHub Check: additional-tests
🔇 Additional comments (2)
QRCoder/QRCodeGenerator.cs (1)

753-753: LGTM! The method call aligns with the improved naming.

The call to CanEncodeNonDigit accurately reflects that this check is only performed for non-digit characters, as digits are already handled by the IsInRange(c, '0', '9') check on line 750.

QRCoder/QRCodeGenerator/AlphanumericEncoder.cs (1)

38-41: Excellent refactoring! The rename improves clarity.

The new name CanEncodeNonDigit accurately describes the method's behavior—it checks only for uppercase letters (A-Z) and special characters, not digits. This makes the precondition explicit: the method should only be called for non-digit characters. The updated XML documentation appropriately reflects this.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Shane32 Shane32 requested a review from gfoidl October 13, 2025 20:33
/// Checks if a non-digit character is present in the alphanumeric encoding table.
/// </summary>
public static bool CanEncode(char c) => IsInRange(c, 'A', 'Z') || Array.IndexOf(_alphanumEncTable, c) >= 0;
public static bool CanEncodeNonDigit(char c) => IsInRange(c, 'A', 'Z') || Array.IndexOf(_alphanumEncTable, c) >= 0;
Copy link
Owner Author

Choose a reason for hiding this comment

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

IsInRange(c, '0', '9') is purposely omitted because it is not required by the caller. So I'm renaming the function to be more appropriately named.

@Shane32 Shane32 merged commit f7c9426 into master Oct 13, 2025
8 checks passed
@Shane32 Shane32 deleted the fix_canencode branch October 13, 2025 21:00
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.

3 participants