-
Notifications
You must be signed in to change notification settings - Fork 374
[dead-code] chore: remove dead functions — 4 functions removed #23882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -30,7 +30,7 @@ func TestNewErrorCollector(t *testing.T) { | |||
| collector := NewErrorCollector(tt.failFast) | ||||
| require.NotNil(t, collector, "Collector should be created") | ||||
| assert.Equal(t, tt.failFast, collector.failFast, "Fail-fast setting should match") | ||||
| assert.False(t, collector.HasErrors(), "New collector should have no errors") | ||||
| assert.Equal(t, 0, collector.Count(), "New collector should have no errors") | ||||
| assert.Equal(t, 0, collector.Count(), "New collector should have zero count") | ||||
|
||||
| assert.Equal(t, 0, collector.Count(), "New collector should have zero count") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,20 +75,6 @@ func parseSafeScriptsConfig(scriptsMap map[string]any) map[string]*SafeScriptCon | |
| return result | ||
| } | ||
|
|
||
| // extractSafeScriptsFromFrontmatter extracts safe-scripts configuration from frontmatter. | ||
| func extractSafeScriptsFromFrontmatter(frontmatter map[string]any) map[string]*SafeScriptConfig { | ||
| if safeOutputs, exists := frontmatter["safe-outputs"]; exists { | ||
| if safeOutputsMap, ok := safeOutputs.(map[string]any); ok { | ||
| if scripts, exists := safeOutputsMap["scripts"]; exists { | ||
| if scriptsMap, ok := scripts.(map[string]any); ok { | ||
| return parseSafeScriptsConfig(scriptsMap) | ||
| } | ||
| } | ||
| } | ||
| } | ||
| return make(map[string]*SafeScriptConfig) | ||
| } | ||
|
|
||
| // isSafeScriptName returns true if the script name is safe for use as a filename component. | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing |
||
| // It rejects names that contain path separators or ".." sequences that could lead to | ||
| // path traversal when the generated filename is passed to require() at runtime. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,39 +68,6 @@ func TestParseSafeScriptsConfigNilMap(t *testing.T) { | |
| } | ||
|
|
||
| // TestExtractSafeScriptsFromFrontmatter verifies extraction from frontmatter | ||
| func TestExtractSafeScriptsFromFrontmatter(t *testing.T) { | ||
| frontmatter := map[string]any{ | ||
| "safe-outputs": map[string]any{ | ||
| "scripts": map[string]any{ | ||
| "my-handler": map[string]any{ | ||
| "description": "A custom handler", | ||
| // Users write only the body — no module.exports or main declaration needed | ||
| "script": "return async (m) => ({ success: true });", | ||
| }, | ||
| }, | ||
| }, | ||
| } | ||
|
|
||
| result := extractSafeScriptsFromFrontmatter(frontmatter) | ||
|
|
||
| require.Len(t, result, 1, "Should have one script") | ||
| script, exists := result["my-handler"] | ||
| require.True(t, exists, "Should have my-handler script") | ||
| assert.Equal(t, "A custom handler", script.Description, "Description should match") | ||
| } | ||
|
|
||
| // TestExtractSafeScriptsFromFrontmatterEmpty verifies empty result when no scripts | ||
| func TestExtractSafeScriptsFromFrontmatterEmpty(t *testing.T) { | ||
| frontmatter := map[string]any{ | ||
| "safe-outputs": map[string]any{ | ||
| "create-issue": map[string]any{}, | ||
| }, | ||
| } | ||
|
|
||
| result := extractSafeScriptsFromFrontmatter(frontmatter) | ||
| assert.Empty(t, result, "Should return empty map when no scripts") | ||
| } | ||
|
|
||
| // TestBuildCustomSafeOutputScriptsJSON verifies JSON generation for script env var | ||
| func TestBuildCustomSafeOutputScriptsJSON(t *testing.T) { | ||
|
Comment on lines
70
to
72
|
||
| data := &WorkflowData{ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good change — using
collector.Count()directly instead of the removedHasErrors()method makes the intent clearer and eliminates the need for a separate predicate method.