[dead-code] chore: remove dead functions — 10 functions removed#20712
[dead-code] chore: remove dead functions — 10 functions removed#20712
Conversation
Remove unreachable functions identified by the deadcode static analyzer. Functions removed: - Compiler.GetArtifactManager (compiler_types.go) - EngineCatalog.DisplayNames (engine_definition.go) - Compiler.validateEngine (engine_validation.go) - getPlaywrightDockerImageVersion (mcp_playwright_config.go) - GetValidationConfigForType (safe_output_validation_config.go) - GetDefaultMaxForType (safe_output_validation_config.go) - buildTitlePrefixEnvVar (safe_outputs_jobs.go) - buildLabelsEnvVar (safe_outputs_jobs.go) - buildCategoryEnvVar (safe_outputs_jobs.go) - validateSecretReferences (secrets_validation.go) Also removed exclusive test functions that only tested the deleted functions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
@copilot compile and run tests |
|
@copilot merge main and recompile |
Results from commit
The Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot merge main and recompile |
Merged
Same result as above — the merge and recompile completed successfully locally (25 files changed from main, all 167 workflows recompiled, tests pass), but the branch protection rules are preventing the push to |
There was a problem hiding this comment.
Pull request overview
Removes unreachable Go functions (and their exclusive tests) as identified by the deadcode analyzer to reduce maintenance surface area.
Changes:
- Deleted 10 dead functions across
pkg/workflow/*. - Removed test cases that only exercised the deleted functions.
- Cleaned up related code (e.g., removed now-unused imports and helper functions).
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/compiler_types.go | Removes dead Compiler.GetArtifactManager accessor. |
| pkg/workflow/engine_definition.go | Removes dead EngineCatalog.DisplayNames helper. |
| pkg/workflow/engine_catalog_test.go | Removes tests that only covered the deleted DisplayNames method. |
| pkg/workflow/engine_validation.go | Removes dead Compiler.validateEngine method. |
| pkg/workflow/engine_validation_test.go | Removes tests that only covered the deleted validateEngine method. |
| pkg/workflow/error_message_quality_test.go | Removes test cases tied to deleted validation helpers. |
| pkg/workflow/mcp_playwright_config.go | Removes dead Playwright version helper and its import dependency. |
| pkg/workflow/version_field_test.go | Removes subtest that only covered the deleted Playwright version helper. |
| pkg/workflow/safe_output_validation_config.go | Removes dead exported helpers for per-type config lookup. |
| pkg/workflow/safe_output_validation_config_test.go | Removes tests that only covered the deleted exported helpers. |
| pkg/workflow/safe_outputs_jobs.go | Removes dead env-var builder helpers for safe-output jobs. |
| pkg/workflow/safe_output_helpers_test.go | Removes tests that only covered deleted safe-output env-var helpers. |
| pkg/workflow/secrets_validation.go | Removes dead validateSecretReferences function. |
| pkg/workflow/redact_secrets_test.go | Removes tests that only covered the deleted secret reference validator. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| // validateSingleEngineSpecification validates that only one engine field exists across all files | ||
| func (c *Compiler) validateSingleEngineSpecification(mainEngineSetting string, includedEnginesJSON []string) (string, error) { | ||
| var allEngines []string |
There was a problem hiding this comment.
The file-level documentation still lists validateEngine() as a validation function, but that method was removed in this change. Please update the header comment to reflect the current entry points (e.g., validateEngineInlineDefinition, EngineCatalog.Resolve, and validateSingleEngineSpecification) so the docs don’t reference a non-existent function.
Dead Code Removal
This PR removes unreachable Go functions identified by the
deadcodestatic analyzer.Functions Removed
Compiler.GetArtifactManagerpkg/workflow/compiler_types.goEngineCatalog.DisplayNamespkg/workflow/engine_definition.goCompiler.validateEnginepkg/workflow/engine_validation.gogetPlaywrightDockerImageVersionpkg/workflow/mcp_playwright_config.goGetValidationConfigForTypepkg/workflow/safe_output_validation_config.goGetDefaultMaxForTypepkg/workflow/safe_output_validation_config.gobuildTitlePrefixEnvVarpkg/workflow/safe_outputs_jobs.gobuildLabelsEnvVarpkg/workflow/safe_outputs_jobs.gobuildCategoryEnvVarpkg/workflow/safe_outputs_jobs.govalidateSecretReferencespkg/workflow/secrets_validation.goTests Removed
Exclusive test functions that only tested deleted functions were also removed:
TestEngineCatalog_DisplayNames(engine_catalog_test.go)TestValidateEngine,TestValidateEngineErrorMessageQuality,TestValidateEngineDidYouMean(engine_validation_test.go)TestMultipleEngineErrorMessageand 2 table entries (error_message_quality_test.go)TestValidateSecretReferences(redact_secrets_test.go)version_field_test.go)TestGetValidationConfigForType,TestGetDefaultMaxForType,TestMissingToolFieldOptional(safe_output_validation_config_test.go)TestBuildTitlePrefixEnvVar,TestBuildLabelsEnvVar,TestBuildCategoryEnvVar(safe_output_helpers_test.go)Verification
go build ./...— passesgo vet ./...— passesgo vet -tags=integration ./...— passesmake fmt— no changes neededgo test ./pkg/workflow/...— passesDead Function Count
Automated by Dead Code Removal workflow — https://github.com/github/gh-aw/actions/runs/23016756548