-
Notifications
You must be signed in to change notification settings - Fork 106
Closed
Description
Objective
Rename conflicting ValidatePermissions functions to clarify their distinct purposes and prevent confusion.
Context
Two different ValidatePermissions functions exist with different signatures:
pkg/workflow/imports.go:347- Part of Compiler, validates permissions from included filespkg/workflow/permissions_validator.go:92- Standalone function using PermissionsValidator
This creates confusion when calling validation functions and makes the codebase harder to navigate.
Part of issue #3435.
Approach
1. Analyze function purposes
Review both functions to understand their specific responsibilities:
imports.goversion: Validates permissions when merging included filespermissions_validator.goversion: General permission validation
2. Rename for clarity
Rename the imports.go function to ValidateIncludedPermissions to reflect its specific purpose of validating permissions from included files.
Keep the permissions_validator.go function as ValidatePermissions since it's the general-purpose validator.
3. Update all callers
- Find all references to the renamed function
- Update function calls to use the new name
- Update any related documentation or comments
4. Add documentation
Add clear comments explaining:
- When to use
ValidatePermissions(general validation) - When to use
ValidateIncludedPermissions(when merging includes)
Files to Modify
pkg/workflow/imports.go- Rename function fromValidatePermissionstoValidateIncludedPermissions- All files that call
imports.go's ValidatePermissions function - Add documentation comments to both functions
Acceptance Criteria
- Function in
imports.gorenamed toValidateIncludedPermissions - All callers of the renamed function updated
- Both functions have clear documentation explaining their distinct purposes
- All tests pass (
make test-unit) - No confusion between the two validation functions
- Code builds successfully
Related to [refactor] 🔧 Semantic Function Clustering Analysis - Code Organization Opportunities #3435
AI generated by Plan Command for #3435
Reactions are currently unavailable