Skip to content

[feature/47] :: applied the camelcase naming convention#48

Merged
wellfernandes merged 30 commits intodevelopfrom
feature/47-apply-the-camel-case-naming-convention
Jul 27, 2025
Merged

[feature/47] :: applied the camelcase naming convention#48
wellfernandes merged 30 commits intodevelopfrom
feature/47-apply-the-camel-case-naming-convention

Conversation

@wellfernandes
Copy link
Copy Markdown
Member

@wellfernandes wellfernandes commented Jun 26, 2025

  • applied camelcase naming convention
  • reorganized examples
  • updated the README

#47

Summary by CodeRabbit

  • New Features

    • Introduced a centralized mock data generator with a language-aware interface for generating various mock entities.
    • Added a new example demonstrating the use of the fluent mock data generator interface.
  • Documentation

    • Updated usage examples and instructions in both English and Portuguese documentation to reflect new and improved interfaces.
    • Clarified and reorganized example directories for better guidance.
  • Refactor

    • Standardized error handling by replacing string constants with error variables across multiple entities.
    • Updated several struct fields and function signatures for improved consistency and idiomatic Go usage.
    • Streamlined function implementations for clarity and simplicity.
  • Tests

    • Adjusted test error handling to allow continued execution after errors.
  • Chores

    • Renamed and reorganized example entry points and internal utility packages for clarity.

@wellfernandes wellfernandes self-assigned this Jun 26, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jun 26, 2025

Walkthrough

This update introduces a centralized Mocker struct for language-aware mock data generation, streamlines error handling by converting string constants to error variables, and refactors example and documentation files to demonstrate the new fluent interface. Several generator functions and structs are updated for improved idiomatic Go usage and consistency.

Changes

File(s) Change Summary
README.md, docs/localization/pt/README-PT.md Updated usage examples to demonstrate the new Mocker interface; clarified example organization and instructions.
pkg/mocai/mocker.go Added new Mocker struct with methods for generating various mock entities with language awareness.
examples/mocker/main.go Added new example program using the fluent Mocker interface to generate and print mock data.
examples/specific/main.go, main.go Refactored example entry point: renamed function, changed package, updated CLI constants usage, and adjusted Gender field.
pkg/mocai/entities/person/errors.go, pkg/mocai/entities/phone/errors.go Converted error string constants to error variables using errors.New.
pkg/mocai/entities/person/generator.go, pkg/mocai/entities/gender/gender.go Changed Gender field in Person struct and generator to pointer type; updated error returns to use error variables.
pkg/mocai/entities/company/countries/errors.go, .../brazilian_company.go Added and used a predefined error variable for no company names available.
pkg/mocai/entities/phone/generator.go, pkg/mocai/entities/cpf/generator.go Updated error handling to use error variables directly; simplified returns.
pkg/mocai/entities/address/generator.go, .../vote_registration/countries/brazilian_vote_registration.go Streamlined return statements by removing intermediate variables.
pkg/mocai/entities/company/generator.go, .../national_id/countries/brazilian_national_id.go Minor formatting adjustments (blank lines); no logic changes.
pkg/mocai/entities/company/countries/generator_test.go Changed test error handling from t.Fatalf to t.Errorf to allow continued execution.
internal/cli/cli_constants.go, internal/cli/utils.go Changed package name to cli; updated function calls and imports accordingly.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Mocker
    participant EntityPkg as Entity Package (e.g., Address, Person)
    User->>Mocker: NewMocker("ptbr")
    Note right of Mocker: Sets language via translations package
    User->>Mocker: Address()
    Mocker->>EntityPkg: GenerateAddress()
    EntityPkg-->>Mocker: *Address
    Mocker-->>User: *Address
    User->>Mocker: Phone()
    Mocker->>EntityPkg: GeneratePhone()
    EntityPkg-->>Mocker: *Phone
    Mocker-->>User: *Phone
Loading

Possibly related PRs

  • #41: Both PRs modify or extend company mock generation, with this PR introducing a central Mocker interface that wraps company generation.
  • #19: Both PRs revise README usage examples, but this PR simplifies and centralizes them using the new Mocker interface.
  • #44: Both PRs are related through national ID generation, with this PR wrapping national ID generation in the new Mocker interface.

Suggested labels

enhancement

Suggested reviewers

  • DODOSUBI

Poem

A rabbit hopped to mock and play,
With Mocker now, it’s easier today!
Fluent calls in every tongue,
Address and Person, all neatly strung.
Errors now are truly neat—
Mocking data can’t be beat!
🐇✨


📜 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 1cb26d4 and d6bd9cc.

📒 Files selected for processing (4)
  • examples/mocker/main.go (1 hunks)
  • examples/specific/main.go (4 hunks)
  • internal/cli/cli_constants.go (2 hunks)
  • internal/cli/utils.go (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • internal/cli/utils.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • examples/mocker/main.go
  • examples/specific/main.go
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: wellfernandes
PR: brazzcore/mocai#39
File: pkg/mocai/entities/certificate/countries/brazilian_certificates.go:3-7
Timestamp: 2025-03-21T14:36:42.742Z
Learning: In the mocai project, Go version higher than 1.20 is being used, which means the global random number generator (math/rand) is automatically seeded and rand.Seed() is not needed.
Learnt from: wellfernandes
PR: brazzcore/mocai#44
File: pkg/mocai/entities/national_id/countries/brazilian_national_id.go:10-10
Timestamp: 2025-04-03T19:13:54.833Z
Learning: For the mocai project, using math/rand is acceptable for generating mock data (like national IDs) since the data is fictitious and not intended for security-sensitive purposes.
Learnt from: BertBR
PR: brazzcore/mocai#31
File: pkg/mocai/entities/company/brazil/generator.go:42-43
Timestamp: 2025-03-11T21:56:28.660Z
Learning: In the mocai project, the constant `ERROR_GENERATING_BRAZILIAN_COMPANY` is defined in the `pkg/mocai/entities/company/brazil/errors.go` file and is accessible from other files in the same `company` package, such as `generator.go`.
internal/cli/cli_constants.go (2)
Learnt from: BertBR
PR: brazzcore/mocai#31
File: pkg/mocai/entities/company/brazil/generator.go:42-43
Timestamp: 2025-03-11T21:56:28.660Z
Learning: In the mocai project, the constant `ERROR_GENERATING_BRAZILIAN_COMPANY` is defined in the `pkg/mocai/entities/company/brazil/errors.go` file and is accessible from other files in the same `company` package, such as `generator.go`.
Learnt from: wellfernandes
PR: brazzcore/mocai#39
File: pkg/mocai/entities/certificate/countries/brazilian_certificates.go:3-7
Timestamp: 2025-03-21T14:36:42.742Z
Learning: In the mocai project, Go version higher than 1.20 is being used, which means the global random number generator (math/rand) is automatically seeded and rand.Seed() is not needed.
🧬 Code Graph Analysis (1)
internal/cli/cli_constants.go (1)
internal/cli/utils.go (1)
  • SupportsANSI (9-22)
🔇 Additional comments (3)
internal/cli/cli_constants.go (3)

1-1: LGTM: Package name change improves clarity.

The package name change from constants to cli is appropriate and follows Go conventions while better describing the package's purpose.


21-21: LGTM: Local function usage improves package organization.

The change from mocai.SupportsANSI() to the local SupportsANSI() function is appropriate. It reduces external dependencies while maintaining the same functionality, as confirmed by the implementation in internal/cli/utils.go.


4-38: Excellent refactoring: Clean package organization and maintained functionality.

The refactoring effectively consolidates CLI-related functionality while maintaining the same behavior. The ANSI escape code handling and CLI component definitions are well-structured and follow Go best practices.

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 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>, please review it.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 using 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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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
Copy Markdown

@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: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4679e96 and 7c28184.

📒 Files selected for processing (16)
  • README.md (1 hunks)
  • cmd/mocai/cli_constants.go (2 hunks)
  • docs/localization/pt/README-PT.md (1 hunks)
  • examples/main.go (4 hunks)
  • main.go (0 hunks)
  • pkg/mocai/entities/company/countries/brazilian_company.go (1 hunks)
  • pkg/mocai/entities/company/countries/errors.go (1 hunks)
  • pkg/mocai/entities/company/countries/generator_test.go (2 hunks)
  • pkg/mocai/entities/company/generator.go (0 hunks)
  • pkg/mocai/entities/cpf/generator.go (1 hunks)
  • pkg/mocai/entities/national_id/countries/brazilian_national_id.go (2 hunks)
  • pkg/mocai/entities/person/errors.go (1 hunks)
  • pkg/mocai/entities/person/generator.go (2 hunks)
  • pkg/mocai/entities/phone/errors.go (1 hunks)
  • pkg/mocai/entities/phone/generator.go (2 hunks)
  • pkg/mocai/entities/vote_registration/countries/brazilian_vote_registration.go (1 hunks)
💤 Files with no reviewable changes (2)
  • pkg/mocai/entities/company/generator.go
  • main.go
🧰 Additional context used
🧠 Learnings (2)
pkg/mocai/entities/company/countries/brazilian_company.go (1)
Learnt from: BertBR
PR: brazzcore/mocai#31
File: pkg/mocai/entities/company/brazil/generator.go:42-43
Timestamp: 2025-03-11T21:56:28.660Z
Learning: In the mocai project, the constant `ERROR_GENERATING_BRAZILIAN_COMPANY` is defined in the `pkg/mocai/entities/company/brazil/errors.go` file and is accessible from other files in the same `company` package, such as `generator.go`.
pkg/mocai/entities/company/countries/errors.go (1)
Learnt from: BertBR
PR: brazzcore/mocai#31
File: pkg/mocai/entities/company/brazil/generator.go:42-43
Timestamp: 2025-03-11T21:56:28.660Z
Learning: In the mocai project, the constant `ERROR_GENERATING_BRAZILIAN_COMPANY` is defined in the `pkg/mocai/entities/company/brazil/errors.go` file and is accessible from other files in the same `company` package, such as `generator.go`.
🧬 Code Graph Analysis (5)
cmd/mocai/cli_constants.go (1)
cmd/mocai/utils.go (1)
  • SupportsANSI (9-22)
pkg/mocai/entities/company/countries/brazilian_company.go (1)
pkg/mocai/entities/company/countries/errors.go (1)
  • ErrNoCompanyNamesAvailable (11-11)
pkg/mocai/entities/cpf/generator.go (1)
pkg/mocai/entities/cpf/errors.go (1)
  • ErrInvalidCPF (6-6)
pkg/mocai/entities/person/generator.go (1)
pkg/mocai/entities/person/errors.go (3)
  • ErrNoFirstNames (10-10)
  • ErrNoLastNames (11-11)
  • ErrGeneratingPerson (9-9)
pkg/mocai/entities/phone/generator.go (1)
pkg/mocai/entities/phone/errors.go (2)
  • ErrNoAreaCodes (10-10)
  • ErrGeneratingPhone (9-9)
🔇 Additional comments (22)
README.md (1)

66-66: Documentation correction aligns with code restructuring.

The instruction correctly specifies navigating to the examples folder before running the example, which aligns with the restructuring of examples from a function to a standalone main program.

cmd/mocai/cli_constants.go (2)

1-1: Package reorganization is well-executed.

The package name change from constants to mocai properly reflects the restructuring of constants into the cmd/mocai package.


21-21: Function call correctly updated for same-package access.

Removing the mocai. prefix is appropriate since SupportsANSI() is now in the same package (available in cmd/mocai/utils.go).

docs/localization/pt/README-PT.md (1)

64-64: Portuguese documentation properly synchronized with main README.

The instruction correctly specifies navigating to the examples folder, maintaining consistency with the main README documentation and the code restructuring.

examples/main.go (4)

1-1: Excellent restructuring to standalone executable.

Converting from examples package to main package makes the example code self-contained and easier to run, aligning with the updated documentation.


6-6: Import path correctly updated for package reorganization.

The import path change from pkg/mocai/constants to cmd/mocai properly reflects the restructuring where constants were moved to the cmd/mocai package.


17-17: Function rename to main creates proper entry point.

Renaming GenerateMockExample to main establishes the proper entry point for the standalone executable, eliminating the need for a separate main.go file at the repository root.


64-66: Constant references properly updated for new package structure.

The constants are now correctly accessed with the mocai. prefix, reflecting their relocation to the cmd/mocai package. This maintains consistency with the package reorganization.

Also applies to: 95-95

pkg/mocai/entities/national_id/countries/brazilian_national_id.go (1)

27-27: LGTM! Good formatting improvements.

The added blank lines improve code readability by logically separating different sections within the functions.

Also applies to: 69-69, 77-77

pkg/mocai/entities/company/countries/errors.go (1)

11-11: LGTM! Proper error variable definition.

Adding ErrNoCompanyNamesAvailable follows Go best practices by centralizing error definitions and using typed error variables instead of inline error creation.

pkg/mocai/entities/cpf/generator.go (1)

36-36: LGTM! Improved error handling consistency.

Returning the predefined ErrInvalidCPF error variable instead of creating a new error inline follows Go best practices and maintains consistency with the broader error handling refactoring.

pkg/mocai/entities/vote_registration/countries/brazilian_vote_registration.go (1)

58-62: LGTM! Good code simplification.

Removing the intermediate variable and returning the struct directly makes the code more concise while maintaining the same functionality.

pkg/mocai/entities/company/countries/brazilian_company.go (1)

29-29: LGTM - Proper use of predefined error variable.

The change correctly replaces inline error creation with the predefined ErrNoCompanyNamesAvailable error variable, which follows Go best practices for error handling.

pkg/mocai/entities/person/generator.go (3)

35-35: LGTM - Consistent use of predefined error variables.

The changes correctly replace inline error creation with predefined error variables (ErrNoFirstNames, ErrNoLastNames), which improves error handling consistency and follows Go best practices.

Also applies to: 39-39


62-62: LGTM - Proper error variable usage in formatted error.

The change correctly uses the predefined ErrGeneratingPerson error variable in the formatted error message, maintaining consistency with the error handling refactoring.


65-72: LGTM - Simplified return statement structure.

The direct return of the struct pointer and nil error is cleaner and more idiomatic than assigning to a variable first.

pkg/mocai/entities/phone/generator.go (2)

40-40: LGTM - Proper error variable usage.

The direct use of ErrGeneratingPhone in fmt.Errorf is correct and consistent with Go conventions.


43-46: LGTM - Simplified return statement structure.

The direct return of the struct pointer and nil error is cleaner and more idiomatic than assigning to a variable first.

pkg/mocai/entities/phone/errors.go (2)

3-3: LGTM - Required import for error variable definitions.

The errors import is correctly added to support the error variable definitions using errors.New().


8-11: LGTM - Proper conversion from string constants to error variables.

The conversion from string constants to typed error variables using errors.New() follows Go best practices and enables better error handling, comparison, and wrapping.

pkg/mocai/entities/person/errors.go (2)

3-3: LGTM - Required import for error variable definitions.

The errors import is correctly added to support the error variable definitions using errors.New().


8-12: LGTM - Proper conversion from string constants to error variables.

The conversion from string constants to typed error variables using errors.New() follows Go best practices and is consistent with similar changes in other entity packages.

Copy link
Copy Markdown

@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: 4

🧹 Nitpick comments (3)
pkg/mocai/entities/gender/gender.go (1)

32-32: Simplify pointer creation for better readability.

The current pointer conversion is functional but could be more readable.

Consider this cleaner approach:

-	return (*Gender)(&genderStr), nil
+	gender := Gender(genderStr)
+	return &gender, nil
docs/localization/pt/README-PT.md (1)

39-54: Fix formatting: Replace hard tabs with spaces.

The code blocks contain hard tabs that should be replaced with spaces for consistent formatting.

-	// specific
-	translations.SetLanguage("ptbr")
-	
-	addr, err := address.GenerateAddress()
-	if err != nil {
-		return err
-	}
-
-	addr.Street // retorna o nome da rua
+    // specific
+    translations.SetLanguage("ptbr")
+    
+    addr, err := address.GenerateAddress()
+    if err != nil {
+        return err
+    }
+
+    addr.Street // retorna o nome da rua

Apply similar spacing fixes to the mocker example block as well.

README.md (1)

41-56: Fix formatting: Replace hard tabs with spaces.

The code blocks use hard tabs instead of spaces, which should be standardized for consistent formatting.

-	// specific
-	translations.SetLanguage("ptbr")
-	
-	addr, err := address.GenerateAddress()
-	if err != nil {
-		return err
-	}
-
-	addr.Street // returns street name
+    // specific
+    translations.SetLanguage("ptbr")
+    
+    addr, err := address.GenerateAddress()
+    if err != nil {
+        return err
+    }
+
+    addr.Street // returns street name

Apply the same spacing fix to the mocker example block.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a75ce35 and a485e83.

📒 Files selected for processing (8)
  • README.md (1 hunks)
  • docs/localization/pt/README-PT.md (1 hunks)
  • examples/mocker/main.go (1 hunks)
  • examples/specific/main.go (4 hunks)
  • pkg/mocai/entities/address/generator.go (1 hunks)
  • pkg/mocai/entities/gender/gender.go (2 hunks)
  • pkg/mocai/entities/person/generator.go (3 hunks)
  • pkg/mocai/mocker.go (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • pkg/mocai/entities/address/generator.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/mocai/entities/person/generator.go
🧰 Additional context used
🧠 Learnings (7)
📓 Common learnings
Learnt from: BertBR
PR: brazzcore/mocai#31
File: pkg/mocai/entities/company/brazil/generator.go:42-43
Timestamp: 2025-03-11T21:56:28.660Z
Learning: In the mocai project, the constant `ERROR_GENERATING_BRAZILIAN_COMPANY` is defined in the `pkg/mocai/entities/company/brazil/errors.go` file and is accessible from other files in the same `company` package, such as `generator.go`.
Learnt from: wellfernandes
PR: brazzcore/mocai#44
File: pkg/mocai/entities/national_id/countries/brazilian_national_id.go:10-10
Timestamp: 2025-04-03T19:13:54.833Z
Learning: For the mocai project, using math/rand is acceptable for generating mock data (like national IDs) since the data is fictitious and not intended for security-sensitive purposes.
Learnt from: wellfernandes
PR: brazzcore/mocai#39
File: pkg/mocai/entities/certificate/countries/brazilian_certificates.go:3-7
Timestamp: 2025-03-21T14:36:42.742Z
Learning: In the mocai project, Go version higher than 1.20 is being used, which means the global random number generator (math/rand) is automatically seeded and rand.Seed() is not needed.
examples/mocker/main.go (3)
Learnt from: wellfernandes
PR: brazzcore/mocai#44
File: pkg/mocai/entities/national_id/countries/brazilian_national_id.go:10-10
Timestamp: 2025-04-03T19:13:54.833Z
Learning: For the mocai project, using math/rand is acceptable for generating mock data (like national IDs) since the data is fictitious and not intended for security-sensitive purposes.
Learnt from: BertBR
PR: brazzcore/mocai#31
File: pkg/mocai/entities/company/brazil/generator.go:42-43
Timestamp: 2025-03-11T21:56:28.660Z
Learning: In the mocai project, the constant `ERROR_GENERATING_BRAZILIAN_COMPANY` is defined in the `pkg/mocai/entities/company/brazil/errors.go` file and is accessible from other files in the same `company` package, such as `generator.go`.
Learnt from: wellfernandes
PR: brazzcore/mocai#39
File: pkg/mocai/entities/certificate/countries/brazilian_certificates.go:3-7
Timestamp: 2025-03-21T14:36:42.742Z
Learning: In the mocai project, Go version higher than 1.20 is being used, which means the global random number generator (math/rand) is automatically seeded and rand.Seed() is not needed.
pkg/mocai/entities/gender/gender.go (2)
Learnt from: wellfernandes
PR: brazzcore/mocai#39
File: pkg/mocai/entities/certificate/countries/brazilian_certificates.go:3-7
Timestamp: 2025-03-21T14:36:42.742Z
Learning: In the mocai project, Go version higher than 1.20 is being used, which means the global random number generator (math/rand) is automatically seeded and rand.Seed() is not needed.
Learnt from: BertBR
PR: brazzcore/mocai#31
File: pkg/mocai/entities/company/brazil/generator.go:42-43
Timestamp: 2025-03-11T21:56:28.660Z
Learning: In the mocai project, the constant `ERROR_GENERATING_BRAZILIAN_COMPANY` is defined in the `pkg/mocai/entities/company/brazil/errors.go` file and is accessible from other files in the same `company` package, such as `generator.go`.
examples/specific/main.go (3)
Learnt from: BertBR
PR: brazzcore/mocai#31
File: pkg/mocai/entities/company/brazil/generator.go:42-43
Timestamp: 2025-03-11T21:56:28.660Z
Learning: In the mocai project, the constant `ERROR_GENERATING_BRAZILIAN_COMPANY` is defined in the `pkg/mocai/entities/company/brazil/errors.go` file and is accessible from other files in the same `company` package, such as `generator.go`.
Learnt from: wellfernandes
PR: brazzcore/mocai#39
File: pkg/mocai/entities/certificate/countries/brazilian_certificates.go:3-7
Timestamp: 2025-03-21T14:36:42.742Z
Learning: In the mocai project, Go version higher than 1.20 is being used, which means the global random number generator (math/rand) is automatically seeded and rand.Seed() is not needed.
Learnt from: wellfernandes
PR: brazzcore/mocai#44
File: pkg/mocai/entities/national_id/countries/brazilian_national_id.go:10-10
Timestamp: 2025-04-03T19:13:54.833Z
Learning: For the mocai project, using math/rand is acceptable for generating mock data (like national IDs) since the data is fictitious and not intended for security-sensitive purposes.
pkg/mocai/mocker.go (3)
Learnt from: wellfernandes
PR: brazzcore/mocai#44
File: pkg/mocai/entities/national_id/countries/brazilian_national_id.go:10-10
Timestamp: 2025-04-03T19:13:54.833Z
Learning: For the mocai project, using math/rand is acceptable for generating mock data (like national IDs) since the data is fictitious and not intended for security-sensitive purposes.
Learnt from: BertBR
PR: brazzcore/mocai#31
File: pkg/mocai/entities/company/brazil/generator.go:42-43
Timestamp: 2025-03-11T21:56:28.660Z
Learning: In the mocai project, the constant `ERROR_GENERATING_BRAZILIAN_COMPANY` is defined in the `pkg/mocai/entities/company/brazil/errors.go` file and is accessible from other files in the same `company` package, such as `generator.go`.
Learnt from: wellfernandes
PR: brazzcore/mocai#39
File: pkg/mocai/entities/certificate/countries/brazilian_certificates.go:3-7
Timestamp: 2025-03-21T14:36:42.742Z
Learning: In the mocai project, Go version higher than 1.20 is being used, which means the global random number generator (math/rand) is automatically seeded and rand.Seed() is not needed.
README.md (3)
Learnt from: wellfernandes
PR: brazzcore/mocai#39
File: pkg/mocai/entities/certificate/countries/brazilian_certificates.go:3-7
Timestamp: 2025-03-21T14:36:42.742Z
Learning: In the mocai project, Go version higher than 1.20 is being used, which means the global random number generator (math/rand) is automatically seeded and rand.Seed() is not needed.
Learnt from: wellfernandes
PR: brazzcore/mocai#44
File: pkg/mocai/entities/national_id/countries/brazilian_national_id.go:10-10
Timestamp: 2025-04-03T19:13:54.833Z
Learning: For the mocai project, using math/rand is acceptable for generating mock data (like national IDs) since the data is fictitious and not intended for security-sensitive purposes.
Learnt from: BertBR
PR: brazzcore/mocai#31
File: pkg/mocai/entities/company/brazil/generator.go:42-43
Timestamp: 2025-03-11T21:56:28.660Z
Learning: In the mocai project, the constant `ERROR_GENERATING_BRAZILIAN_COMPANY` is defined in the `pkg/mocai/entities/company/brazil/errors.go` file and is accessible from other files in the same `company` package, such as `generator.go`.
docs/localization/pt/README-PT.md (3)
Learnt from: BertBR
PR: brazzcore/mocai#31
File: pkg/mocai/entities/company/brazil/generator.go:42-43
Timestamp: 2025-03-11T21:56:28.660Z
Learning: In the mocai project, the constant `ERROR_GENERATING_BRAZILIAN_COMPANY` is defined in the `pkg/mocai/entities/company/brazil/errors.go` file and is accessible from other files in the same `company` package, such as `generator.go`.
Learnt from: wellfernandes
PR: brazzcore/mocai#44
File: pkg/mocai/entities/national_id/countries/brazilian_national_id.go:10-10
Timestamp: 2025-04-03T19:13:54.833Z
Learning: For the mocai project, using math/rand is acceptable for generating mock data (like national IDs) since the data is fictitious and not intended for security-sensitive purposes.
Learnt from: wellfernandes
PR: brazzcore/mocai#39
File: pkg/mocai/entities/certificate/countries/brazilian_certificates.go:3-7
Timestamp: 2025-03-21T14:36:42.742Z
Learning: In the mocai project, Go version higher than 1.20 is being used, which means the global random number generator (math/rand) is automatically seeded and rand.Seed() is not needed.
🧬 Code Graph Analysis (3)
examples/mocker/main.go (5)
cmd/mocai/cli_constants.go (3)
  • HeaderMain (14-14)
  • SubHeader (15-15)
  • Footer (16-16)
pkg/mocai/mocker.go (1)
  • NewMocker (21-31)
pkg/mocai/entities/person/generator.go (1)
  • Person (14-21)
pkg/mocai/entities/address/generator.go (1)
  • Address (12-19)
pkg/mocai/entities/phone/generator.go (1)
  • Phone (12-15)
pkg/mocai/entities/gender/gender.go (2)
pkg/mocai/translations/translations.go (2)
  • GetLanguage (47-51)
  • Get (54-67)
pkg/mocai/entities/gender/errors.go (1)
  • ErrNoGenders (9-9)
examples/specific/main.go (2)
cmd/mocai/cli_constants.go (3)
  • HeaderMain (14-14)
  • SubHeader (15-15)
  • Footer (16-16)
pkg/mocai/entities/gender/gender.go (1)
  • Gender (10-10)
🪛 LanguageTool
README.md

[uncategorized] ~61-~61: Loose punctuation mark.
Context: ...y, organized by approach: - specific/: Examples using direct calls to each of ...

(UNLIKELY_OPENING_PUNCTUATION)


[style] ~61-~61: In American English, abbreviations like “etc.” require a period.
Context: ...le entities (e.g., phone.GeneratePhone, etc). - mocker/: Example using a main en...

(ETC_PERIOD)


[uncategorized] ~63-~63: Loose punctuation mark.
Context: ... phone.GeneratePhone, etc). - mocker/: Example using a main entry point `mocai...

(UNLIKELY_OPENING_PUNCTUATION)

docs/localization/pt/README-PT.md

[uncategorized] ~60-~60: Sinal de pontuação isolado.
Context: ...rganizados por abordagem: - specific/: Exemplos usando as funções diretas de c...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~60-~60: Se é uma abreviatura, falta um ponto. Se for uma expressão, coloque entre aspas.
Context: ...ckável do Mocaí (phone.GeneratePhone, etc). - mocker/: Exemplo usando um ponto...

(ABREVIATIONS_PUNCTUATION)


[uncategorized] ~62-~62: Sinal de pontuação isolado.
Context: ...phone.GeneratePhone, etc). - mocker/`: Exemplo usando um ponto de entrada prin...

(UNLIKELY_OPENING_PUNCTUATION)

🪛 markdownlint-cli2 (0.17.2)
README.md

41-41: Hard tabs
Column: 1

(MD010, no-hard-tabs)


42-42: Hard tabs
Column: 1

(MD010, no-hard-tabs)


43-43: Hard tabs
Column: 1

(MD010, no-hard-tabs)


44-44: Hard tabs
Column: 1

(MD010, no-hard-tabs)


45-45: Hard tabs
Column: 1

(MD010, no-hard-tabs)


46-46: Hard tabs
Column: 1

(MD010, no-hard-tabs)


47-47: Hard tabs
Column: 1

(MD010, no-hard-tabs)


49-49: Hard tabs
Column: 1

(MD010, no-hard-tabs)


53-53: Hard tabs
Column: 1

(MD010, no-hard-tabs)


54-54: Hard tabs
Column: 1

(MD010, no-hard-tabs)


55-55: Hard tabs
Column: 1

(MD010, no-hard-tabs)


56-56: Hard tabs
Column: 1

(MD010, no-hard-tabs)

docs/localization/pt/README-PT.md

39-39: Hard tabs
Column: 1

(MD010, no-hard-tabs)


40-40: Hard tabs
Column: 1

(MD010, no-hard-tabs)


41-41: Hard tabs
Column: 1

(MD010, no-hard-tabs)


42-42: Hard tabs
Column: 1

(MD010, no-hard-tabs)


43-43: Hard tabs
Column: 1

(MD010, no-hard-tabs)


44-44: Hard tabs
Column: 1

(MD010, no-hard-tabs)


45-45: Hard tabs
Column: 1

(MD010, no-hard-tabs)


47-47: Hard tabs
Column: 1

(MD010, no-hard-tabs)


51-51: Hard tabs
Column: 1

(MD010, no-hard-tabs)


52-52: Hard tabs
Column: 1

(MD010, no-hard-tabs)


53-53: Hard tabs
Column: 1

(MD010, no-hard-tabs)


54-54: Hard tabs
Column: 1

(MD010, no-hard-tabs)

🔇 Additional comments (13)
pkg/mocai/entities/gender/gender.go (3)

4-4: LGTM: Import change aligns with error handling update.

The switch from errors to fmt package is consistent with using fmt.Errorf for formatted error messages.


29-29: LGTM: Improved error formatting.

Using fmt.Errorf with formatted strings provides better error context than simple string concatenation.


24-24: *All GenerateRandomGender calls handle the new Gender return type

Both instances of GenerateRandomGender have been updated to use the pointer signature correctly:

  • pkg/mocai/mocker.go: Mocker.Gender now assigns and returns *gender.Gender.
  • pkg/mocai/entities/person/generator.go: the generator captures *Gender and propagates the pointer.

No further changes needed.

examples/specific/main.go (5)

1-1: LGTM: Package change enables standalone execution.

Converting from package examples to package main allows this example to run independently.


6-6: LGTM: Import alias provides clear namespace separation.

The cli alias for the CLI constants package improves code readability.


17-17: LGTM: Function renamed to standard main entry point.

Converting GenerateMockExample to main follows Go conventions for executable programs.


64-66: LGTM: Updated constants references.

The CLI constants are now properly referenced with the cli namespace.


68-68: LGTM: Gender dereference correctly handles pointer type.

The *p.Gender dereference is consistent with the updated Gender field being a pointer type in the Person struct.

examples/mocker/main.go (1)

1-33: LGTM: Excellent demonstration of the new Mocker interface.

This example clearly showcases the fluent interface approach with the new mocai.NewMocker struct. The code is well-structured with helpful comments explaining the usage patterns and demonstrates proper access to entity fields.

docs/localization/pt/README-PT.md (2)

38-56: LGTM: Documentation accurately reflects new API.

The updated examples clearly demonstrate both the direct entity usage and the new Mocker interface approaches.


58-67: LGTM: Clear explanation of example organization.

The explanation of the specific/ and mocker/ directories helps users understand the different approaches available.

README.md (2)

40-58: LGTM: Examples accurately demonstrate both API approaches.

The documentation effectively showcases both the direct entity usage and the new fluent Mocker interface.


59-68: LGTM: Clear structure explanation for examples.

The explanation of the reorganized examples directory helps users choose the appropriate approach for their needs.

Comment on lines +41 to +87
func (m *Mocker) Address() *address.Address {
a, _ := address.GenerateAddress()

return a
}

func (m *Mocker) Certificate() *certificate.Certificate {
c, _ := certificate.GenerateCertificate(false)

return c
}

func (m *Mocker) Company() *company.Company {
c, _ := company.GenerateCompany(false)

return c
}

func (m *Mocker) Gender() *gender.Gender {
g, _ := gender.GenerateRandomGender()

return g
}

func (m *Mocker) NationalID() *national_id.NationalID {
n, _ := national_id.GenerateNationalID(false)

return n
}

func (m *Mocker) Person() *person.Person {
p, _ := person.GeneratePerson()

return p
}

func (m *Mocker) Phone() *phone.Phone {
p, _ := phone.GeneratePhone()

return p
}

func (m *Mocker) VoteRegistration() *vote_registration.VoteRegistration {
v, _ := vote_registration.GenerateVoteRegistration(false)

return v
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider returning errors from entity generation methods.

All entity generation methods silently ignore errors, which could result in nil pointers being returned when generation fails. This makes debugging difficult and could lead to panics in user code.

Consider one of these approaches:

Option 1: Return errors to caller (recommended)

-func (m *Mocker) Address() *address.Address {
+func (m *Mocker) Address() (*address.Address, error) {
-	a, _ := address.GenerateAddress()
+	return address.GenerateAddress()
-
-	return a
 }

Option 2: Use panic for critical failures

 func (m *Mocker) Address() *address.Address {
-	a, _ := address.GenerateAddress()
+	a, err := address.GenerateAddress()
+	if err != nil {
+		panic(fmt.Sprintf("failed to generate address: %v", err))
+	}
 
 	return a
 }

Option 3: Log errors and return nil

 func (m *Mocker) Address() *address.Address {
-	a, _ := address.GenerateAddress()
+	a, err := address.GenerateAddress()
+	if err != nil {
+		fmt.Printf("warning: failed to generate address: %v\n", err)
+		return nil
+	}
 
 	return a
 }

The first option provides the most flexibility for error handling.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
func (m *Mocker) Address() *address.Address {
a, _ := address.GenerateAddress()
return a
}
func (m *Mocker) Certificate() *certificate.Certificate {
c, _ := certificate.GenerateCertificate(false)
return c
}
func (m *Mocker) Company() *company.Company {
c, _ := company.GenerateCompany(false)
return c
}
func (m *Mocker) Gender() *gender.Gender {
g, _ := gender.GenerateRandomGender()
return g
}
func (m *Mocker) NationalID() *national_id.NationalID {
n, _ := national_id.GenerateNationalID(false)
return n
}
func (m *Mocker) Person() *person.Person {
p, _ := person.GeneratePerson()
return p
}
func (m *Mocker) Phone() *phone.Phone {
p, _ := phone.GeneratePhone()
return p
}
func (m *Mocker) VoteRegistration() *vote_registration.VoteRegistration {
v, _ := vote_registration.GenerateVoteRegistration(false)
return v
}
func (m *Mocker) Address() (*address.Address, error) {
return address.GenerateAddress()
}
🤖 Prompt for AI Agents
In pkg/mocai/mocker.go between lines 41 and 87, the entity generation methods
ignore errors and always return the generated object, risking nil pointer
dereferences if generation fails. Modify these methods to return both the
generated entity and an error, propagating the error to the caller. Update the
method signatures to include an error return value and handle the error from the
generation functions accordingly, returning nil and the error if generation
fails.

Copy link
Copy Markdown

@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

🧹 Nitpick comments (6)
docs/localization/pt/README-PT.md (3)

38-48: Substitute hard tabs with spaces in the code block

markdownlint (MD010) is flagging every line in this snippet because it starts with a tab. Tabs also bloat diffs and render inconsistently across tools.

-	// specific
-	translations.SetLanguage("ptbr")
-	
-	addr, err := address.GenerateAddress()
-	if err != nil {
-		log.Println(err)
-	}
-
-	addr.Street // retorna o nome da rua
+// specific
+translations.SetLanguage("ptbr")
+
+addr, err := address.GenerateAddress()
+if err != nil {
+    log.Println(err)
+}
+
+addr.Street // retorna o nome da rua

50-59: Repeat-tab issue and missing import context

  1. Same MD010 complaint – replace tabs with spaces (see diff pattern above).
  2. Consider adding a minimal import stanza (even as a comment) so newcomers know which package provides mocai.NewMocker.
// import (
//     "github.com/brazzcore/mocai"
// )

62-66: Fix typo and punctuation in “Exemplos” section

  • “comoo” → “como”.
  • Add full stop after “etc.”.
  • Keep the project name spelling consistent (Mocai is used elsewhere without the accent).
-O diretório ***examples*** contém exemplos de comoo usar a biblioteca, organizados por abordagem:
+O diretório ***examples*** contém exemplos de como usar a biblioteca, organizados por abordagem:

-- `specific/`: Exemplos usando as funções diretas de cada entidade mockável do Mocaí (`phone.GeneratePhone`, etc).
+- `specific/`: Exemplos usando as funções diretas de cada entidade mockável do Mocai (por exemplo, `phone.GeneratePhone`, etc.).
README.md (3)

40-50: Replace leading tabs to comply with MD010

Same formatting issue as in the PT README. Convert the indentation to spaces to silence markdownlint and keep rendering consistent.

-	// specific
-	translations.SetLanguage("ptbr")
-	
-	addr, err := address.GenerateAddress()
-	if err != nil {
-		log.Println(err)
-	}
-
-	addr.Street // returns street name
+// specific
+translations.SetLanguage("ptbr")
+
+addr, err := address.GenerateAddress()
+if err != nil {
+    log.Println(err)
+}
+
+addr.Street // returns street name

52-61: Repeat the space-for-tab fix & add import cue

As above, replace tabs with spaces and optionally include a commented import block to clarify where mocai.NewMocker comes from for first-time readers.


63-67: Minor wording & punctuation clean-up in bullet list

LanguageTool flags an isolated punctuation mark and a missing period after “etc”. Suggested tweak:

-- `specific/`: Examples using direct calls to each of Mocaí's mockable entities (e.g., phone.GeneratePhone, etc).
+- `specific/`: Examples using direct calls to each of Mocai's mockable entities (e.g., `phone.GeneratePhone`, etc.).

This also standardises the accentless “Mocai” spelling used elsewhere in the English docs.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a485e83 and cee1791.

📒 Files selected for processing (4)
  • README.md (1 hunks)
  • docs/localization/pt/README-PT.md (1 hunks)
  • examples/mocker/main.go (1 hunks)
  • pkg/mocai/mocker.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • examples/mocker/main.go
  • pkg/mocai/mocker.go
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: BertBR
PR: brazzcore/mocai#31
File: pkg/mocai/entities/company/brazil/generator.go:42-43
Timestamp: 2025-03-11T21:56:28.660Z
Learning: In the mocai project, the constant `ERROR_GENERATING_BRAZILIAN_COMPANY` is defined in the `pkg/mocai/entities/company/brazil/errors.go` file and is accessible from other files in the same `company` package, such as `generator.go`.
Learnt from: wellfernandes
PR: brazzcore/mocai#44
File: pkg/mocai/entities/national_id/countries/brazilian_national_id.go:10-10
Timestamp: 2025-04-03T19:13:54.833Z
Learning: For the mocai project, using math/rand is acceptable for generating mock data (like national IDs) since the data is fictitious and not intended for security-sensitive purposes.
Learnt from: wellfernandes
PR: brazzcore/mocai#39
File: pkg/mocai/entities/certificate/countries/brazilian_certificates.go:3-7
Timestamp: 2025-03-21T14:36:42.742Z
Learning: In the mocai project, Go version higher than 1.20 is being used, which means the global random number generator (math/rand) is automatically seeded and rand.Seed() is not needed.
README.md (3)
Learnt from: wellfernandes
PR: brazzcore/mocai#44
File: pkg/mocai/entities/national_id/countries/brazilian_national_id.go:10-10
Timestamp: 2025-04-03T19:13:54.833Z
Learning: For the mocai project, using math/rand is acceptable for generating mock data (like national IDs) since the data is fictitious and not intended for security-sensitive purposes.
Learnt from: wellfernandes
PR: brazzcore/mocai#39
File: pkg/mocai/entities/certificate/countries/brazilian_certificates.go:3-7
Timestamp: 2025-03-21T14:36:42.742Z
Learning: In the mocai project, Go version higher than 1.20 is being used, which means the global random number generator (math/rand) is automatically seeded and rand.Seed() is not needed.
Learnt from: BertBR
PR: brazzcore/mocai#31
File: pkg/mocai/entities/company/brazil/generator.go:42-43
Timestamp: 2025-03-11T21:56:28.660Z
Learning: In the mocai project, the constant `ERROR_GENERATING_BRAZILIAN_COMPANY` is defined in the `pkg/mocai/entities/company/brazil/errors.go` file and is accessible from other files in the same `company` package, such as `generator.go`.
docs/localization/pt/README-PT.md (3)
Learnt from: BertBR
PR: brazzcore/mocai#31
File: pkg/mocai/entities/company/brazil/generator.go:42-43
Timestamp: 2025-03-11T21:56:28.660Z
Learning: In the mocai project, the constant `ERROR_GENERATING_BRAZILIAN_COMPANY` is defined in the `pkg/mocai/entities/company/brazil/errors.go` file and is accessible from other files in the same `company` package, such as `generator.go`.
Learnt from: wellfernandes
PR: brazzcore/mocai#44
File: pkg/mocai/entities/national_id/countries/brazilian_national_id.go:10-10
Timestamp: 2025-04-03T19:13:54.833Z
Learning: For the mocai project, using math/rand is acceptable for generating mock data (like national IDs) since the data is fictitious and not intended for security-sensitive purposes.
Learnt from: wellfernandes
PR: brazzcore/mocai#39
File: pkg/mocai/entities/certificate/countries/brazilian_certificates.go:3-7
Timestamp: 2025-03-21T14:36:42.742Z
Learning: In the mocai project, Go version higher than 1.20 is being used, which means the global random number generator (math/rand) is automatically seeded and rand.Seed() is not needed.
🪛 LanguageTool
README.md

[uncategorized] ~65-~65: Loose punctuation mark.
Context: ...y, organized by approach: - specific/: Examples using direct calls to each of ...

(UNLIKELY_OPENING_PUNCTUATION)


[style] ~65-~65: In American English, abbreviations like “etc.” require a period.
Context: ...le entities (e.g., phone.GeneratePhone, etc). - mocker/: Example using a main en...

(ETC_PERIOD)


[uncategorized] ~67-~67: Loose punctuation mark.
Context: ... phone.GeneratePhone, etc). - mocker/: Example using a main entry point `mocai...

(UNLIKELY_OPENING_PUNCTUATION)

docs/localization/pt/README-PT.md

[uncategorized] ~64-~64: Sinal de pontuação isolado.
Context: ...rganizados por abordagem: - specific/: Exemplos usando as funções diretas de c...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~64-~64: Se é uma abreviatura, falta um ponto. Se for uma expressão, coloque entre aspas.
Context: ...ckável do Mocaí (phone.GeneratePhone, etc). - mocker/: Exemplo usando um ponto...

(ABREVIATIONS_PUNCTUATION)


[uncategorized] ~66-~66: Sinal de pontuação isolado.
Context: ...phone.GeneratePhone, etc). - mocker/`: Exemplo usando um ponto de entrada prin...

(UNLIKELY_OPENING_PUNCTUATION)

🪛 markdownlint-cli2 (0.17.2)
README.md

41-41: Hard tabs
Column: 1

(MD010, no-hard-tabs)


42-42: Hard tabs
Column: 1

(MD010, no-hard-tabs)


43-43: Hard tabs
Column: 1

(MD010, no-hard-tabs)


44-44: Hard tabs
Column: 1

(MD010, no-hard-tabs)


45-45: Hard tabs
Column: 1

(MD010, no-hard-tabs)


46-46: Hard tabs
Column: 1

(MD010, no-hard-tabs)


47-47: Hard tabs
Column: 1

(MD010, no-hard-tabs)


49-49: Hard tabs
Column: 1

(MD010, no-hard-tabs)


53-53: Hard tabs
Column: 1

(MD010, no-hard-tabs)


54-54: Hard tabs
Column: 1

(MD010, no-hard-tabs)


55-55: Hard tabs
Column: 1

(MD010, no-hard-tabs)


56-56: Hard tabs
Column: 1

(MD010, no-hard-tabs)


57-57: Hard tabs
Column: 1

(MD010, no-hard-tabs)


58-58: Hard tabs
Column: 1

(MD010, no-hard-tabs)


59-59: Hard tabs
Column: 1

(MD010, no-hard-tabs)


60-60: Hard tabs
Column: 1

(MD010, no-hard-tabs)

docs/localization/pt/README-PT.md

39-39: Hard tabs
Column: 1

(MD010, no-hard-tabs)


40-40: Hard tabs
Column: 1

(MD010, no-hard-tabs)


41-41: Hard tabs
Column: 1

(MD010, no-hard-tabs)


42-42: Hard tabs
Column: 1

(MD010, no-hard-tabs)


43-43: Hard tabs
Column: 1

(MD010, no-hard-tabs)


44-44: Hard tabs
Column: 1

(MD010, no-hard-tabs)


45-45: Hard tabs
Column: 1

(MD010, no-hard-tabs)


47-47: Hard tabs
Column: 1

(MD010, no-hard-tabs)


51-51: Hard tabs
Column: 1

(MD010, no-hard-tabs)


52-52: Hard tabs
Column: 1

(MD010, no-hard-tabs)


53-53: Hard tabs
Column: 1

(MD010, no-hard-tabs)


54-54: Hard tabs
Column: 1

(MD010, no-hard-tabs)


55-55: Hard tabs
Column: 1

(MD010, no-hard-tabs)


56-56: Hard tabs
Column: 1

(MD010, no-hard-tabs)


57-57: Hard tabs
Column: 1

(MD010, no-hard-tabs)


58-58: Hard tabs
Column: 1

(MD010, no-hard-tabs)

Copy link
Copy Markdown

@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

🧹 Nitpick comments (4)
docs/localization/pt/README-PT.md (2)

38-48: Code sample is incomplete – missing package, imports and translations origin

The snippet compiles only after the user manually wraps it in a main package and adds the proper imports (log, github.com/brazzcore/mocai/pkg/mocai/address, github.com/brazzcore/mocai/pkg/mocai/translations).
Providing a minimal self-contained example avoids frustration for copy-paste readers.

 ```go
-// specific
+package main
+
+import (
+    "log"
+    "github.com/brazzcore/mocai/pkg/mocai/address"
+    "github.com/brazzcore/mocai/pkg/mocai/translations"
+)
+
+func main() {
+    // specific
 translations.SetLanguage("ptbr")

 addr, err := address.GenerateAddress()
 if err != nil {
     log.Println(err)
 }
 
 addr.Street // retorna o nome da rua
+}

62-66: Typo and punctuation in examples section

comoocomo, and add the missing full stop after “etc” for consistent Portuguese punctuation.

-O diretório ***examples*** contém exemplos de comoo usar a biblioteca, organizados por abordagem:
+O diretório ***examples*** contém exemplos de como usar a biblioteca, organizados por abordagem:
 
-- `specific/`: Exemplos usando as funções diretas de cada entidade mockável do Mocaí (`phone.GeneratePhone`, etc).
+- `specific/`: Exemplos usando as funções diretas de cada entidade mockável do Mocaí (`phone.GeneratePhone`, etc.).
README.md (2)

40-50: Provide self-contained Go example (imports + main)

Same concern as in the PT README – readers cannot run this snippet as-is. Including the minimal scaffolding improves developer experience.

 ```go
-// specific
+package main
+
+import (
+    "log"
+    "github.com/brazzcore/mocai/pkg/mocai/address"
+    "github.com/brazzcore/mocai/pkg/mocai/translations"
+)
+
+func main() {
+    // specific
 translations.SetLanguage("ptbr")
 
 addr, err := address.GenerateAddress()
 if err != nil {
     log.Println(err)
 }
 
 addr.Street // returns street name
+}

63-67: Minor wording & punctuation fixes in bullet list

Add period after “etc” (per English style) and drop the leading dash duplication picked up by LanguageTool.

-The ***examples*** folder contains samples of how to use the library, organized by approach:
+The ***examples*** folder contains samples of how to use the library, organized by approach:

-- `specific/`: Examples using direct calls to each of Mocaí's mockable entities (e.g., phone.GeneratePhone, etc).
+- `specific/`: Examples using direct calls to each of Mocaí's mockable entities (e.g., phone.GeneratePhone, etc.).
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8469a85 and 1cb26d4.

📒 Files selected for processing (2)
  • README.md (1 hunks)
  • docs/localization/pt/README-PT.md (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: BertBR
PR: brazzcore/mocai#31
File: pkg/mocai/entities/company/brazil/generator.go:42-43
Timestamp: 2025-03-11T21:56:28.660Z
Learning: In the mocai project, the constant `ERROR_GENERATING_BRAZILIAN_COMPANY` is defined in the `pkg/mocai/entities/company/brazil/errors.go` file and is accessible from other files in the same `company` package, such as `generator.go`.
Learnt from: wellfernandes
PR: brazzcore/mocai#44
File: pkg/mocai/entities/national_id/countries/brazilian_national_id.go:10-10
Timestamp: 2025-04-03T19:13:54.833Z
Learning: For the mocai project, using math/rand is acceptable for generating mock data (like national IDs) since the data is fictitious and not intended for security-sensitive purposes.
Learnt from: wellfernandes
PR: brazzcore/mocai#39
File: pkg/mocai/entities/certificate/countries/brazilian_certificates.go:3-7
Timestamp: 2025-03-21T14:36:42.742Z
Learning: In the mocai project, Go version higher than 1.20 is being used, which means the global random number generator (math/rand) is automatically seeded and rand.Seed() is not needed.
README.md (3)
Learnt from: wellfernandes
PR: brazzcore/mocai#44
File: pkg/mocai/entities/national_id/countries/brazilian_national_id.go:10-10
Timestamp: 2025-04-03T19:13:54.833Z
Learning: For the mocai project, using math/rand is acceptable for generating mock data (like national IDs) since the data is fictitious and not intended for security-sensitive purposes.
Learnt from: wellfernandes
PR: brazzcore/mocai#39
File: pkg/mocai/entities/certificate/countries/brazilian_certificates.go:3-7
Timestamp: 2025-03-21T14:36:42.742Z
Learning: In the mocai project, Go version higher than 1.20 is being used, which means the global random number generator (math/rand) is automatically seeded and rand.Seed() is not needed.
Learnt from: BertBR
PR: brazzcore/mocai#31
File: pkg/mocai/entities/company/brazil/generator.go:42-43
Timestamp: 2025-03-11T21:56:28.660Z
Learning: In the mocai project, the constant `ERROR_GENERATING_BRAZILIAN_COMPANY` is defined in the `pkg/mocai/entities/company/brazil/errors.go` file and is accessible from other files in the same `company` package, such as `generator.go`.
docs/localization/pt/README-PT.md (2)
Learnt from: BertBR
PR: brazzcore/mocai#31
File: pkg/mocai/entities/company/brazil/generator.go:42-43
Timestamp: 2025-03-11T21:56:28.660Z
Learning: In the mocai project, the constant `ERROR_GENERATING_BRAZILIAN_COMPANY` is defined in the `pkg/mocai/entities/company/brazil/errors.go` file and is accessible from other files in the same `company` package, such as `generator.go`.
Learnt from: wellfernandes
PR: brazzcore/mocai#44
File: pkg/mocai/entities/national_id/countries/brazilian_national_id.go:10-10
Timestamp: 2025-04-03T19:13:54.833Z
Learning: For the mocai project, using math/rand is acceptable for generating mock data (like national IDs) since the data is fictitious and not intended for security-sensitive purposes.
🪛 LanguageTool
README.md

[uncategorized] ~65-~65: Loose punctuation mark.
Context: ...y, organized by approach: - specific/: Examples using direct calls to each of ...

(UNLIKELY_OPENING_PUNCTUATION)


[style] ~65-~65: In American English, abbreviations like “etc.” require a period.
Context: ...le entities (e.g., phone.GeneratePhone, etc). - mocker/: Example using a main en...

(ETC_PERIOD)


[uncategorized] ~67-~67: Loose punctuation mark.
Context: ... phone.GeneratePhone, etc). - mocker/: Example using a main entry point `mocai...

(UNLIKELY_OPENING_PUNCTUATION)

docs/localization/pt/README-PT.md

[uncategorized] ~64-~64: Sinal de pontuação isolado.
Context: ...rganizados por abordagem: - specific/: Exemplos usando as funções diretas de c...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~64-~64: Se é uma abreviatura, falta um ponto. Se for uma expressão, coloque entre aspas.
Context: ...ckável do Mocaí (phone.GeneratePhone, etc). - mocker/: Exemplo usando um ponto...

(ABREVIATIONS_PUNCTUATION)


[uncategorized] ~66-~66: Sinal de pontuação isolado.
Context: ...phone.GeneratePhone, etc). - mocker/`: Exemplo usando um ponto de entrada prin...

(UNLIKELY_OPENING_PUNCTUATION)

Copy link
Copy Markdown
Collaborator

@DODOSUBI DODOSUBI left a comment

Choose a reason for hiding this comment

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

LGTM

import (
"github.com/brazzcore/mocai/pkg/mocai"
)
package mocai
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

As coisas dentro de cmd são sempre package main e não pode ser importadas em outros lugares

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Perfeito! Criei um diretório internal pra isso!

@wellfernandes wellfernandes requested a review from rluders July 10, 2025 22:24
@wellfernandes wellfernandes merged commit 920442f into develop Jul 27, 2025
2 checks passed
@wellfernandes wellfernandes deleted the feature/47-apply-the-camel-case-naming-convention branch July 27, 2025 23:50
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