[cpf-gen] Create package to generate valid CPF - #23
Conversation
Co-authored-by: Cursor Grok 4.5 <cursoragent@cursor.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cursor Grok 4.5 <cursoragent@cursor.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cursor Grok 4.5 <cursoragent@cursor.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cursor Grok 4.5 <cursoragent@cursor.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Added email contact, refined summary, and added detailed description for CPF generation utility. Included source code URI in metadata. Co-authored-by: Cursor Grok 4.5 <cursoragent@cursor.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
…ling Added core functionality for generating valid CPF identifiers, including a new `CpfGenerator` class and associated options management through `CpfGeneratorOptions`. Introduced custom error handling for API misuse and domain validation. Updated module structure to enhance usability and maintainability. - Implemented `cpf_gen` method for simplified CPF generation. - Added error classes for type mismatches and validation failures. - Created utility functions for option handling and prefix validation. This update enhances the CPF generation utility, providing a robust API for users. Co-authored-by: Cursor Grok 4.5 <cursoragent@cursor.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Updated the test suite for the CPF generation functionality by introducing comprehensive tests for the `CpfGen` class. Added tests for generating valid CPF identifiers with various options, including format and prefix handling. Implemented error handling tests to ensure proper exceptions are raised for invalid argument combinations and type mismatches. - Refactored existing tests to improve coverage and clarity. - Added new test files for `CpfGeneratorOptions` and error classes. - Ensured all edge cases for CPF generation and validation are covered. This update strengthens the reliability of the CPF generation utility through rigorous testing. Co-authored-by: Cursor Grok 4.5 <cursoragent@cursor.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cursor Grok 4.5 <cursoragent@cursor.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cursor Grok 4.5 <cursoragent@cursor.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cursor Grok 4.5 <cursoragent@cursor.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (10)
📝 WalkthroughWalkthroughThe PR replaces the ChangesCPF generator release
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant CpfGen
participant CpfGenerator
participant CpfDV
Caller->>CpfGen: cpf_gen(options, keywords)
CpfGen->>CpfGenerator: initialize and generate
CpfGenerator->>CpfGenerator: resolve options and build base CPF
CpfGenerator->>CpfDV: compute check digits
CpfDV-->>CpfGenerator: check digits or DomainError
CpfGenerator-->>Caller: CPF result
CpfGenerator->>CpfGenerator: retry after DomainError
Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/cpf-gen/README.md`:
- Line 1: Add a top-level H1 before the cover image in
packages/cpf-gen/README.md and use “cpf-gen” as its title; make the
corresponding change in packages/cpf-gen/README.pt.md with a
Portuguese-equivalent title.
- Line 96: Update the option-conflict descriptions to consistently specify
non-nil keywords: in packages/cpf-gen/README.md at lines 96, 179, and 185, and
packages/cpf-gen/README.pt.md at lines 81, 164, and 170. Apply the requested
non-nil qualifier to each detailed description and summary-table trigger without
changing the documented behavior.
In `@packages/cpf-gen/README.pt.md`:
- Line 3: Translate the remaining English text in README.pt.md into Portuguese,
including the documentation link text near the top and the two inline code
comments at the referenced locations. Preserve the existing link target, code
behavior, and formatting.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 4378c6f1-39e5-4ee3-adf6-b8e7a7361716
📒 Files selected for processing (21)
packages/br-utilities/Gemfilepackages/cpf-gen/CHANGELOG.mdpackages/cpf-gen/Gemfilepackages/cpf-gen/README.mdpackages/cpf-gen/README.pt.mdpackages/cpf-gen/cpf-gen.gemspecpackages/cpf-gen/src/cpf-gen.rbpackages/cpf-gen/src/cpf-gen/cpf_gen.rbpackages/cpf-gen/src/cpf-gen/cpf_generator.rbpackages/cpf-gen/src/cpf-gen/cpf_generator_options.rbpackages/cpf-gen/src/cpf-gen/errors.rbpackages/cpf-gen/src/cpf-gen/types.rbpackages/cpf-gen/src/cpf-gen/utils.rbpackages/cpf-gen/tests/cpf_gen.spec.rbpackages/cpf-gen/tests/cpf_generator.spec.rbpackages/cpf-gen/tests/cpf_generator_options.spec.rbpackages/cpf-gen/tests/errors.spec.rbpackages/cpf-gen/tests/utils.spec.rbpackages/cpf-utilities/Gemfilepackages/cpf-val/Gemfilepackages/cpf-val/cpf-val.gemspec
💤 Files with no reviewable changes (4)
- packages/cpf-val/Gemfile
- packages/cpf-utilities/Gemfile
- packages/br-utilities/Gemfile
- packages/cpf-gen/Gemfile
Adjustment as per @coderabbitai review comment at #23 (comment). Co-authored-by: CodeRabbit AI <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Cursor Grok 4.5 <cursoragent@cursor.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Adjustment as per @coderabbitai review comment at #23 (comment). Co-authored-by: CodeRabbit AI <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Cursor Grok 4.5 <cursoragent@cursor.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Adjustment as per @coderabbitai review comment at #23 (comment). Co-authored-by: CodeRabbit AI <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Cursor Grok 4.5 <cursoragent@cursor.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Adjustment as per @coderabbitai review comment at #23 (comment). Co-authored-by: CodeRabbit AI <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Cursor Grok 4.5 <cursoragent@cursor.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Adjustment as per @coderabbitai review comment at #23 (comment). Co-authored-by: CodeRabbit AI <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Cursor Grok 4.5 <cursoragent@cursor.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Adjustment as per @coderabbitai review comment at #23 (comment). Co-authored-by: CodeRabbit AI <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Cursor Grok 4.5 <cursoragent@cursor.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Adjustment as per @coderabbitai review comment at #23 (comment). Co-authored-by: CodeRabbit AI <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Cursor Grok 4.5 <cursoragent@cursor.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Adjustment as per @coderabbitai review comment at #23 (comment). Co-authored-by: CodeRabbit AI <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Cursor Grok 4.5 <cursoragent@cursor.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Adjustment as per @coderabbitai review comment at #23 (comment). Co-authored-by: CodeRabbit AI <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Cursor Grok 4.5 <cursoragent@cursor.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Adjustment as per @coderabbitai review comment at #23 (comment). Co-authored-by: CodeRabbit AI <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Cursor Grok 4.5 <cursoragent@cursor.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Summary by CodeRabbit
CpfGen.cpf_gen, with numeric or masked output, optional prefixes, and keyword/option configuration.