fix: Fix opengrep config file name#202
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a mechanism to map legacy tool names to their current equivalents (e.g., mapping "semgrep" to "opengrep") when adding tools in config/config.go. The review feedback highlights that mutating the input configs slice in-place can cause unexpected side effects for the caller, and suggests resolving aliases on a copy instead. Additionally, it points out that AddToolWithDefaultVersion must also handle these legacy aliases to prevent lookup failures.
There was a problem hiding this comment.
Pull request overview
Adds a legacy tool name alias mapping so that semgrep entries in user configurations are transparently resolved to opengrep when AddTools is called, allowing older codacy.yaml files referencing semgrep to keep working after the rename.
Changes:
- Introduces a
toolNameAliasesmap (semgrep→opengrep). - Rewrites incoming
ToolConfig.Namevalues through the alias map at the start ofAddTools.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Duplication | 0 |
🟢 Coverage 58.33% diff coverage · +0.07% coverage variation
Metric Results Coverage variation ✅ +0.07% coverage variation (-0.50%) Diff coverage ✅ 58.33% diff coverage (50.00%) Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (799aab5) Report Missing Report Missing Report Missing Head commit (932e4eb) 6211 (+11) 1502 (+7) 24.18% (+0.07%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#202) 12 7 58.33% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%1 Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.
AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
Pull Request Overview
This PR introduces tool name aliasing to support the transition from 'semgrep' to 'opengrep'. While the implementation logic appears correct, the core logic for mapping these names in config.go has zero test coverage, which is high-risk given the primary intent of the fix.
Furthermore, the integration test runners (run.sh and run.ps1) have been modified to skip comparisons for semgrep.yaml and opengrep.yaml. This effectively blinds the CI suite to regressions in configuration file generation. Instead of suppressing these checks, the expected test artifacts should be updated to reflect the new naming convention. The PR also contains significant churn in integration test YAML files without a descriptive summary to explain the side effects of these changes.
About this PR
- Systemic risk: The logic introduced for mapping legacy tool names to 'opengrep' has no unit test coverage. As this is the core functionality of the PR, it should be verified with automated tests prior to merging.
- The PR description is empty. Please provide context regarding the extensive changes in the 'expected' YAML files for integration tests and explain why strict file name comparisons are being bypassed rather than updated.
Test suggestions
- Verify that AddTools correctly aliases 'semgrep' to 'opengrep' and uses the mapped name for processing.
- Verify that AddToolWithDefaultVersion correctly aliases 'semgrep' to 'opengrep' before fetching default versions.
- Verify that the integration test runner correctly normalizes codacy.yaml by removing versions and sorting tools/runtimes.
- Verify aliasing logic for legacy tool name migration in a dedicated unit or integration test.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Verify that AddTools correctly aliases 'semgrep' to 'opengrep' and uses the mapped name for processing.
2. Verify that AddToolWithDefaultVersion correctly aliases 'semgrep' to 'opengrep' before fetching default versions.
3. Verify aliasing logic for legacy tool name migration in a dedicated unit or integration test.
TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback
No description provided.