Skip to content

[dead-code] chore: remove dead functions — 1 function removed#29303

Merged
pelikhan merged 1 commit intomainfrom
chore/remove-dead-functions-parseLabelsFromConfig-f8946949f4f28225
Apr 30, 2026
Merged

[dead-code] chore: remove dead functions — 1 function removed#29303
pelikhan merged 1 commit intomainfrom
chore/remove-dead-functions-parseLabelsFromConfig-f8946949f4f28225

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Dead Code Removal

This PR removes unreachable Go functions identified by the deadcode static analyzer.

Functions Removed

Function File
parseLabelsFromConfig pkg/workflow/config_helpers.go

Tests Removed

  • TestParseLabelsFromConfig in pkg/workflow/config_parsing_helpers_test.go (exclusively tested the deleted function)

Verification

  • go build ./... — passes
  • go vet ./... — passes
  • go vet -tags=integration ./... — passes
  • make fmt — no changes needed

Dead Function Count

  • Before this batch: 7 functions (2 confirmed WASM false positives: CompileToYAML, ParseWorkflowString; 4 more WASM-referenced: WithSkipValidation, WithNoEmit, WithWorkflowIdentifier, WithVersion)
  • Removed in this PR: 1 function
  • Remaining: ~0 genuinely dead functions

Automated by Dead Code Removal workflow — https://github.com/github/gh-aw/actions/runs/25164525401

Generated by Dead Code Removal Agent · ● 999.7K ·

  • expires on May 3, 2026, 12:17 PM UTC

Remove unreachable function identified by the deadcode static analyzer.
parseLabelsFromConfig was only called from test files and has been
replaced by direct usage of ParseStringArrayFromConfig where needed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review April 30, 2026 13:43
Copilot AI review requested due to automatic review settings April 30, 2026 13:43
@pelikhan pelikhan merged commit 11307f2 into main Apr 30, 2026
19 checks passed
@pelikhan pelikhan deleted the chore/remove-dead-functions-parseLabelsFromConfig-f8946949f4f28225 branch April 30, 2026 13:44
Copy link
Copy Markdown
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

Removes a dead/unreachable helper for parsing labels from workflow config maps, along with its dedicated unit test.

Changes:

  • Deleted parseLabelsFromConfig from pkg/workflow/config_helpers.go.
  • Removed TestParseLabelsFromConfig from pkg/workflow/config_parsing_helpers_test.go.
Show a summary per file
File Description
pkg/workflow/config_helpers.go Removes the now-dead parseLabelsFromConfig wrapper function.
pkg/workflow/config_parsing_helpers_test.go Removes the unit test that exclusively targeted the deleted helper.

Copilot's findings

Tip

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

Comments suppressed due to low confidence (1)

pkg/workflow/config_parsing_helpers_test.go:97

  • Deleting TestParseLabelsFromConfig removes the only direct test coverage for ParseStringArrayFromConfig behavior around missing keys vs empty slices and mixed-type filtering (the deleted helper was just a thin wrapper). Consider keeping a table-driven test that exercises ParseStringArrayFromConfig directly (e.g., with key "labels") to preserve these regressions checks.
func TestParseTitlePrefixFromConfig(t *testing.T) {
	tests := []struct {
		name     string
		input    map[string]any
		expected string
  • Files reviewed: 2/2 changed files
  • Comments generated: 1

Comment on lines 123 to 127
return nil
}

// parseLabelsFromConfig extracts and validates labels from a config map
// Returns a slice of label strings, or nil if labels is not present or invalid
func parseLabelsFromConfig(configMap map[string]any) []string {
return ParseStringArrayFromConfig(configMap, "labels", configHelpersLog)
}

// extractStringFromMap is a generic helper that extracts and validates a string value from a map
// Returns the string value, or empty string if not present or invalid
@github-actions github-actions Bot mentioned this pull request Apr 30, 2026
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