Enforce tolowerequalfold by converting case-insensitive comparisons to strings.EqualFold#37256
Merged
Merged
Conversation
6 tasks
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Convert ToLower/ToUpper equality to strings.EqualFold
Enforce Jun 6, 2026
tolowerequalfold by converting case-insensitive comparisons to strings.EqualFold
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enables enforcement of the tolowerequalfold custom analyzer in CI and updates remaining case-insensitive string equality patterns to use strings.EqualFold, removing now-redundant temporary lowercased variables where applicable.
Changes:
- Enabled
-tolowerequalfoldin the custom linter CI flags to make the analyzer enforceable. - Replaced
strings.ToLower/ToUpper(... ) ==/!= ...comparison patterns withstrings.EqualFold(...)across workflow, parser, and CLI callsites. - Simplified a few callsites by removing intermediate
lower*variables that were only used for comparisons.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/strings.go | Switches a case-insensitive tool-name compare to strings.EqualFold. |
| pkg/workflow/resolve.go | Reworks workflow ID/display-name case-insensitive matching to use strings.EqualFold and removes redundant lowercased temporaries. |
| pkg/workflow/repo_memory_validation.go | Uses strings.EqualFold for reserved branch-prefix detection. |
| pkg/workflow/notify_comment.go | Uses strings.EqualFold to match frontmatter feature keys against the group-concurrency flag. |
| pkg/workflow/features.go | Uses strings.EqualFold for case-insensitive feature flag matching (frontmatter + environment). |
| pkg/parser/yaml_import.go | Uses strings.EqualFold for action definition filename detection (action.yml / action.yaml). |
| pkg/parser/schema_suggestions.go | Uses strings.EqualFold for exact schema field-name matching before fuzzy suggestions. |
| pkg/cli/outcome_eval_review.go | Uses strings.EqualFold for detecting "APPROVED" review state without uppercasing. |
| pkg/cli/import_url_fetcher.go | Uses strings.EqualFold for HTTPS scheme gating before attaching auth headers. |
| pkg/cli/forecast.go | Uses strings.EqualFold for case-insensitive remote workflow name matching. |
| pkg/cli/codespace.go | Uses strings.EqualFold for CODESPACES=true detection. |
| pkg/cli/add_workflow_resolution.go | Uses strings.EqualFold when scanning on: [ ... ] for workflow_dispatch. |
| .github/workflows/cgo.yml | Adds -tolowerequalfold to enforced custom linter flags. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 13/13 changed files
- Comments generated: 0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tolowerequalfoldwas registered but not CI-enforced; remaining true-positiveToLower/ToUpperequality patterns blocked rollout. This PR replaces those comparisons withstrings.EqualFoldand enables analyzer enforcement in custom lint CI flags.Analyzer enforcement
-tolowerequalfoldto custom linter flags in.github/workflows/cgo.yml.Case-insensitive comparison conversions
strings.ToLower(...) == .../!= ...withstrings.EqualFold(...)across the listed parser/workflow/cli callsites (including multi-compare branches in workflow resolution and HTTPS scheme validation).EqualFold.Guard behavior preserved
strings.ToLower(x) == x/!= x) in:pkg/workflow/tools_validation_github.gopkg/cli/logs_report_tools.gopkg/cli/codemod_discussion_trigger_categories.goAdditional repo-local violations resolved for enforcement
-tolowerequalfoldin:pkg/workflow/features.gopkg/cli/codespace.gopkg/cli/outcome_eval_review.go