Skip to content

chore: [#423] optimize variables name#1290

Merged
hwbrzzl merged 2 commits intomasterfrom
bowen/#423-2
Dec 9, 2025
Merged

chore: [#423] optimize variables name#1290
hwbrzzl merged 2 commits intomasterfrom
bowen/#423-2

Conversation

@hwbrzzl
Copy link
Contributor

@hwbrzzl hwbrzzl commented Dec 8, 2025

📑 Description

Related issue: goravel/goravel#423

This pull request refactors the codebase to standardize path naming conventions and improve the setup process for multiple packages. The main changes include renaming singular path variables to their plural forms throughout the code, updating setup scripts to use a unified Setup interface, and ensuring consistency in how modules and package names are retrieved and used.

Path Naming Standardization

  • Renamed all singular path variables (e.g., support.Config.Paths.Model, support.Config.Paths.Event) to their plural forms (e.g., support.Config.Paths.Models, support.Config.Paths.Events) across the codebase, affecting command handlers and configuration methods. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16]

Setup Script Refactoring

  • Updated setup scripts in multiple packages (auth, cache, crypt, database, event, filesystem) to use the new Setup interface, replacing direct calls to packages.GetModulePath() and packages.GetModuleNameFromArgs(os.Args) with methods from the Setup object for improved consistency and maintainability. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]

Setup Interface Enhancement

  • Enhanced the Setup interface in contracts/packages/setup.go by adding method documentation and new methods (Execute, ModulePath, PackageName, Install, Uninstall) to formalize and clarify the setup workflow.

Consistency Improvements

  • Ensured all configuration and facade modifications use the correct package name and module path by retrieving them from the Setup object, reducing potential errors and improving code clarity. [1] [2] [3] [4] [5] [6] [7] [8] [9]

These changes collectively make the codebase more maintainable and consistent, especially as the project grows to support more packages and features.

✅ Checks

  • Added test cases for my code

@hwbrzzl hwbrzzl closed this Dec 9, 2025
@hwbrzzl hwbrzzl reopened this Dec 9, 2025
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.50.

Benchmark suite Current: eb936ad Previous: d735058 Ratio
Benchmark_DecryptString 5834 ns/op 2032 B/op 16 allocs/op 2425 ns/op 2032 B/op 16 allocs/op 2.41
Benchmark_DecryptString - ns/op 5834 ns/op 2425 ns/op 2.41

This comment was automatically generated by workflow using github-action-benchmark.

@codecov
Copy link

codecov bot commented Dec 9, 2025

Codecov Report

❌ Patch coverage is 13.88889% with 248 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.14%. Comparing base (6610223) to head (eb936ad).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
http/setup/setup.go 0.00% 22 Missing ⚠️
grpc/setup/setup.go 0.00% 19 Missing ⚠️
queue/setup/setup.go 0.00% 19 Missing ⚠️
route/setup/setup.go 0.00% 19 Missing ⚠️
mail/setup/setup.go 0.00% 16 Missing ⚠️
session/setup/setup.go 0.00% 16 Missing ⚠️
auth/setup/setup.go 0.00% 15 Missing ⚠️
filesystem/setup/setup.go 0.00% 13 Missing ⚠️
log/setup/setup.go 0.00% 13 Missing ⚠️
testing/setup/setup.go 0.00% 13 Missing ⚠️
... and 12 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1290      +/-   ##
==========================================
+ Coverage   68.91%   69.14%   +0.23%     
==========================================
  Files         265      265              
  Lines       15732    15671      -61     
==========================================
- Hits        10841    10836       -5     
+ Misses       4424     4368      -56     
  Partials      467      467              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hwbrzzl hwbrzzl marked this pull request as ready for review December 9, 2025 03:16
@hwbrzzl hwbrzzl requested a review from a team as a code owner December 9, 2025 03:16
Copilot AI review requested due to automatic review settings December 9, 2025 03:16
@hwbrzzl hwbrzzl merged commit cd189be into master Dec 9, 2025
17 of 19 checks passed
@hwbrzzl hwbrzzl deleted the bowen/#423-2 branch December 9, 2025 03:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors variable names across the codebase for improved consistency and clarity. The main changes include pluralizing path configuration field names (e.g., CommandCommands, ModelModels) and restructuring package setup utilities to use instance methods instead of global functions.

Key changes:

  • Pluralized all path configuration field names in support.Paths struct for grammatical consistency
  • Moved GetModulePath() and GetPackageName() from global functions to instance methods on the Setup interface
  • Relocated PackageName() utility to support/env package for better organization
  • Simplified facade installation logic by removing conditional WhenFacade/WhenNoFacades wrappers in most setup files

Reviewed changes

Copilot reviewed 51 out of 51 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
support/variable.go Renamed all path fields from singular to plural form (e.g., Command→Commands, Model→Models) and updated documentation
support/env/env.go Added PackageName() function relocated from packages.Setup for better package organization
support/env/env_test.go Added test coverage for the new PackageName() function
packages/setup.go Removed global utility functions (GetModulePath, GetPackageName, GetModuleNameFromArgs) and converted to instance methods
packages/setup_test.go Removed tests for deprecated global functions
contracts/packages/setup.go Added ModulePath() to Setup interface and enhanced documentation for all methods
mocks/packages/Setup.go Generated mock implementation for new ModulePath() method
foundation/configuration/paths.go Updated all setter methods to use pluralized path field names
foundation/configuration/paths_test.go Updated test assertions to verify pluralized field names
foundation/application.go Updated ModelPath() to reference Models instead of Model
foundation/console/*.go Updated console commands to use pluralized path fields and env.PackageName()
database/migration/creator.go Updated migration path reference to use Migrations instead of Migration
database/console/*.go Updated all make commands to use pluralized path field names
database/setup/setup.go Refactored to use setup instance methods and removed WhenFacade conditional wrappers
/console/.go Updated all console make commands across modules to use pluralized path configuration fields
*/setup/setup.go Refactored all module setup files to use Setup instance methods and simplified facade installation logic

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants