[cnpj-utils] Create package to consolidate itilities for CNPJ - #25
Conversation
Co-authored-by: Cursor Grok 4.5 <cursoragent@cursor.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
- Introduced a new class structure for CNPJ formatting, generation, and validation. - Added nested modules for CNPJ formatter, generator, and validator. - Implemented error handling for argument combinations. - Updated versioning and documentation for the new API structure. Co-authored-by: Cursor Grok 4.5 <cursoragent@cursor.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
- Removed outdated `cnpj_utilities.spec.rb` file. - Added a new `cnpj_utils.spec.rb` file containing a complete behavioral suite for CnpjUtils. - The new tests cover formatting, generation, and validation functionalities with various option handling scenarios. - Enhanced structure and clarity of tests to align with the unified API for CNPJ handling. 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>
- Documented structure and conventions for re-export files in aggregator gems like `*-utilities` and `br-utilities`. - Included specifications for default singleton and class helpers, emphasizing mutable constants and class-method aliases. - Provided a reference example with `cnpj-utilities` to illustrate the implementation. Co-authored-by: Cursor Grok 4.5 <cursoragent@cursor.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (21)
📝 WalkthroughWalkthroughAdds the ChangesCnpjUtils façade
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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/cnpj-utilities/cnpj-utilities.gemspec`:
- Line 17: Update the gemspec’s spec.files definition to include README.pt.md
alongside the existing packaged documentation files, while preserving the
existing file-existence filtering and source inclusion behavior.
In `@packages/cnpj-utilities/README.pt.md`:
- Line 81: Corrija o fragmento do link interno na seção sobre tabelas de opções
para usar o slug gerado pelo título “Pacotes incluídos”, alterando
`#pacotes-incluidos` para `#pacotes-incluídos` e preservando o restante do
texto.
In `@packages/cnpj-utilities/src/cnpj-utilities/cnpj_utils.rb`:
- Around line 58-59: Replace the raw TypeError raised by normalize_settings with
the package’s TypeMismatchError, preserving the existing message and Hash
validation. Define TypeMismatchError in errors.rb as a TypeError subclass
including the CnpjUtils::Error marker, and add this exception to the `@raise`
documentation for initialize.
🪄 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 Plus
Run ID: e4ccefc3-f58c-4cea-a6b6-c9ad7624a92a
📒 Files selected for processing (14)
AGENTS.mdpackages/cnpj-utilities/CHANGELOG.mdpackages/cnpj-utilities/README.mdpackages/cnpj-utilities/README.pt.mdpackages/cnpj-utilities/cnpj-utilities.gemspecpackages/cnpj-utilities/src/cnpj-utilities.rbpackages/cnpj-utilities/src/cnpj-utilities/cnpj_fmt.rbpackages/cnpj-utilities/src/cnpj-utilities/cnpj_gen.rbpackages/cnpj-utilities/src/cnpj-utilities/cnpj_utils.rbpackages/cnpj-utilities/src/cnpj-utilities/cnpj_val.rbpackages/cnpj-utilities/src/cnpj-utilities/errors.rbpackages/cnpj-utilities/src/cnpj-utilities/version.rbpackages/cnpj-utilities/tests/cnpj_utilities.spec.rbpackages/cnpj-utilities/tests/cnpj_utils.spec.rb
💤 Files with no reviewable changes (1)
- packages/cnpj-utilities/tests/cnpj_utilities.spec.rb
… files - Added 'README.pt.md' and 'CHANGELOG.md' to the list of files in the gemspec for better documentation accessibility.
- Added 'README.pt.md' and 'CHANGELOG.md' to the list of files in the gemspec for better documentation accessibility.
- Added 'README.pt.md' and 'CHANGELOG.md' to the list of files in the gemspec for better documentation accessibility.
- Added 'README.pt.md' and 'CHANGELOG.md' to the list of files in the gemspec for better documentation accessibility.
- Added 'README.pt.md' and 'CHANGELOG.md' to the list of files in the gemspec for better documentation accessibility.
…files - Added 'README.pt.md' and 'CHANGELOG.md' to the list of files in the gemspec for better documentation accessibility.
…iles - Added 'README.pt.md' and 'CHANGELOG.md' to the list of files in the gemspec for better documentation accessibility.
Fix as per @coderabbitai review comment at #25 (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>
…ings Fix as per @coderabbitai review comment at hhttps://github.com//pull/25#discussion_r3640031712. 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>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/cnpj-utilities/README.md`:
- Around line 280-284: Update the public custom-error documentation in
packages/cnpj-utilities/README.md (lines 280-284) and
packages/cnpj-utilities/README.pt.md (lines 265-269) to show each error’s
complete inheritance chain, including explicit CnpjUtils::Error marker-module
inclusion, before the category, trigger, examples, and rescue/callback guidance.
Keep the English and Portuguese documentation aligned while preserving their
respective languages.
🪄 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 Plus
Run ID: ab299edf-3bfd-48de-afe5-5700a918731a
📒 Files selected for processing (13)
packages/br-utilities/br-utilities.gemspecpackages/cnpj-utilities/CHANGELOG.mdpackages/cnpj-utilities/README.mdpackages/cnpj-utilities/README.pt.mdpackages/cnpj-utilities/cnpj-utilities.gemspecpackages/cnpj-utilities/src/cnpj-utilities/cnpj_utils.rbpackages/cnpj-utilities/src/cnpj-utilities/errors.rbpackages/cnpj-utilities/tests/cnpj_utils.spec.rbpackages/cpf-dv/cpf-dv.gemspecpackages/cpf-fmt/cpf-fmt.gemspecpackages/cpf-gen/cpf-gen.gemspecpackages/cpf-utilities/cpf-utilities.gemspecpackages/cpf-val/cpf-val.gemspec
Adjustment as per @coderabbitai review comment at #25 (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>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/cnpj-utilities/README.md`:
- Around line 284-287: Complete the public error documentation in
packages/cnpj-utilities/README.md (lines 284-287) and apply the equivalent
Portuguese correction in packages/cnpj-utilities/README.pt.md (lines 269-272).
For both files, document each error’s full inheritance through StandardError,
explicit Error marker inclusion, precise non-nil trigger conditions, usage
examples, and rescue/callback guidance at four granularity levels; distinguish
CnpjUtils::Error from component errors that propagate unchanged.
🪄 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 Plus
Run ID: 40f4e31f-16e4-405e-a5aa-f650840db55e
📒 Files selected for processing (3)
packages/cnpj-utilities/CHANGELOG.mdpackages/cnpj-utilities/README.mdpackages/cnpj-utilities/README.pt.md
…vior Adjustment as per @coderabbitai review comment at #25 (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>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/cnpj-utilities/README.md`:
- Around line 286-289: Update resolve_settings to guard with an explicit nil
check so false is treated as provided settings input and undergoes type-mismatch
and ambiguous-keyword validation. Add regression coverage for
CnpjUtils.new(false), and update the corresponding documentation in
packages/cnpj-utilities/README.md (lines 286-289) and
packages/cnpj-utilities/README.pt.md (lines 271-274) so both English and
Portuguese pages reflect the non-nil settings contract.
🪄 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 Plus
Run ID: 79f1663b-6af7-4128-bf21-ebc48b34e4a4
📒 Files selected for processing (3)
packages/cnpj-utilities/CHANGELOG.mdpackages/cnpj-utilities/README.mdpackages/cnpj-utilities/README.pt.md
Adjustment as per @coderabbitai review comment at #25 (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>
Fix as per @coderabbitai review comment at #25 (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>
…ings Fix as per @coderabbitai review comment at hhttps://github.com//pull/25#discussion_r3640031712. 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 #25 (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>
…vior Adjustment as per @coderabbitai review comment at #25 (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 #25 (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>
Resolves #6
Summary by CodeRabbit
CnpjUtilsfaçade with a sharedCnpjUtils::DEFAULT, configurable instances, and per-call override behavior.CnpjUtils, along with scoped error types for misuse.CnpjUtils, plus aggregator re-export conventions.cnpj-utilitiesversion/dependency bounds.