Skip to content

fix: Fix opengrep config file name - #202

Merged
lventura-codacy merged 5 commits into
mainfrom
fix-opengrep-analysis
May 28, 2026
Merged

fix: Fix opengrep config file name#202
lventura-codacy merged 5 commits into
mainfrom
fix-opengrep-analysis

Conversation

@lventura-codacy

Copy link
Copy Markdown
Contributor

No description provided.

CopilotAI review requested due to automatic review settings May 27, 2026 15:58

@gemini-code-assistgemini-code-assistBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment threadconfig/config.go Outdated

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 toolNameAliases map (semgrepopengrep).
  • Rewrites incoming ToolConfig.Name values through the alias map at the start of AddTools.

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

@codacy-production

codacy-productionBot commented May 27, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics0 duplication

MetricResults
Duplication0

View in Codacy

🟢 Coverage58.33% diff coverage · +0.07% coverage variation

MetricResults
Coverage variation+0.07% coverage variation (-0.50%)
Diff coverage58.33% diff coverage (50.00%)

View coverage diff in Codacy

Coverage variation details
Coverable linesCovered linesCoverage
Common ancestor commit (799aab5)Report MissingReport MissingReport 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 linesCovered linesDiff coverage
Pull request (#202)12758.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.

Run reviewer

TIP This summary will be updated as you push new changes.

CopilotAI review requested due to automatic review settings May 27, 2026 16:50
@lventura-codacy
lventura-codacy removed the request for review from CopilotMay 27, 2026 16:50
CopilotAI review requested due to automatic review settings May 27, 2026 17:06
@lventura-codacy
lventura-codacy removed the request for review from CopilotMay 27, 2026 17:06
CopilotAI review requested due to automatic review settings May 27, 2026 17:43

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.

Comment threadintegration-tests/run.ps1

@codacy-productioncodacy-productionBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment threadconfig/config.go
Comment threadintegration-tests/run.ps1
Comment threadintegration-tests/run.sh
Comment threadconfig/config.go
@lventura-codacy
lventura-codacy merged commit 75d97e9 into mainMay 28, 2026
11 checks passed
@lventura-codacy
lventura-codacy deleted the fix-opengrep-analysis branch May 28, 2026 08:50
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@lventura-codacy@nedaKaighobadi