Skip to content

fix wrong logic with generic rules#16

Merged
DMarinhoCodacy merged 1 commit into
mainfrom
fix-wrong-logic-generic-rules
May 11, 2026
Merged

fix wrong logic with generic rules#16
DMarinhoCodacy merged 1 commit into
mainfrom
fix-wrong-logic-generic-rules

Conversation

@DMarinhoCodacy
Copy link
Copy Markdown
Contributor

No description provided.

@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

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.

@DMarinhoCodacy DMarinhoCodacy merged commit e449a3e into main May 11, 2026
3 checks passed
Copy link
Copy Markdown

@codacy-production codacy-production Bot 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

This PR fixes a logic error where 'generic' rules were incorrectly hardcoded to 'Go'. The change filters 'generic' and 'regex' tags to ensure they trigger the ID-based fallback identification logic.

While the code change appears sound for the primary use case, the PR is currently missing necessary context and verification. There is no PR description, no Jira ticket reference, and critically, no unit tests were added to verify that the fallback logic correctly identifies languages for various 'generic' rule ID patterns. Furthermore, a logic edge case was identified where rules with both 'generic' and another language might skip the fallback parsing.

About this PR

  • No test files were included in this PR. Add unit tests covering the fallback logic for 'generic' rules, including various rule ID prefixes (e.g., 'generic.secrets', 'codacy.generic.sql').
  • Please provide a PR description explaining the impact of removing the 'Go' mapping and the reason 'generic' was previously handled this way.
  • Please include a link to the Jira ticket associated with this bug fix.

Test suggestions

  • A rule with 'generic' language and a 'generic.secrets' ID should map to all supported languages.
  • A rule with 'generic' language and 'codacy.generic.sql' prefix should map to SQL.
  • A rule with both 'generic' and 'python' languages should correctly map to 'Python' and not include 'Go'.
  • A rule with only the 'generic' language (and no recognizable prefix) should trigger the fallback loop to parse the ID by dots.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. A rule with 'generic' language and a 'generic.secrets' ID should map to all supported languages.
2. A rule with 'generic' language and 'codacy.generic.sql' prefix should map to SQL.
3. A rule with both 'generic' and 'python' languages should correctly map to 'Python' and not include 'Go'.
4. A rule with only the 'generic' language (and no recognizable prefix) should trigger the fallback loop to parse the ID by dots.

TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback

Sign up for free to 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.

2 participants