Skip to content

Update codacy.generic.sql.hardcoded-language-currency-orgid#12

Merged
stefanvacareanu7 merged 1 commit intomainfrom
update_codacy.generic.sql.hardcoded-language-currency-orgid
May 5, 2026
Merged

Update codacy.generic.sql.hardcoded-language-currency-orgid#12
stefanvacareanu7 merged 1 commit intomainfrom
update_codacy.generic.sql.hardcoded-language-currency-orgid

Conversation

@stefanvacareanu7
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

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.

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

While Codacy reports that the PR is 'up to standards', there is a significant lack of verification for these regex changes. No test files or SQL samples were included to validate the updated pattern, and the coverage report is empty due to missing requirements.

A critical inconsistency was identified: the new org_id pattern is more restrictive than the language and currency patterns within the same rule, potentially missing common variable naming conventions like p_org_id. Additionally, the regex for value matching is structurally weak, allowing for unbalanced quotes or parentheses which could lead to false positives or missed detections.

About this PR

  • This PR lacks a description or Jira ticket reference, making it difficult to confirm the specific bug or edge case intended to be resolved. Furthermore, no sample SQL files were provided to verify the regex logic.

Test suggestions

  • Verify detection of single hardcoded org_id using equals operator (e.g., org_id = 123)
  • Verify detection of org_id list with spaces before commas (e.g., org_id IN (101 , 102))
  • Verify that the rule no longer matches 'org_id =' when not followed by a numeric value
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Verify detection of single hardcoded org_id using equals operator (e.g., org_id = 123)
2. Verify detection of org_id list with spaces before commas (e.g., org_id IN (101 , 102))
3. Verify that the rule no longer matches 'org_id =' when not followed by a numeric value
Low confidence findings
  • There is no evidence of automated verification for these static analysis patterns. Since these rules govern global security/quality checks, they should ideally be accompanied by test cases.

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

Comment thread docs/codacy-rules.yaml
- pattern-regex: "(?i)^(?:(?!--).)*\\b\\w*language\\w*\\b\\s*(=|:=)\\s*'?\\b[A-Z]{2}\\b'?"
- pattern-regex: "(?i)^(?:(?!--).)*\\b\\w*currency\\w*\\b\\s*(=|:=)\\s*'?\\b[A-Z]{3}\\b'?"
- pattern-regex: "(?i)^(?:(?!--).)*\\b(\\w*\\.)?org_id\\b\\s*(=|:=|IN|!=|<>)\\s*(\\(?\\s*'?\\d+'?(,\\s*'?\\d+'?)*\\s*\\)?)?"
- pattern-regex: "(?i)^(?:(?!--).)*\\b(\\w*\\.)?org_id\\b\\s*(=|:=|IN|!=|<>)\\s*(\\(?\\s*'?\\d+'?(\\s*,\\s*'?\\d+'?)*\\s*\\)?)"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 MEDIUM RISK

Suggestion: The org_id pattern is more restrictive than the language and currency patterns in the same rule. While those patterns use \\b\\w*...\\w*\\b to catch variations (like src_language), this pattern misses common naming conventions like p_org_id or target_org_id. Additionally, the value regex allows unbalanced quotes and parentheses (e.g., matching '123 or (123). Consider broadening the field match to align with the other rules and the metadata description.

Suggested change
- pattern-regex: "(?i)^(?:(?!--).)*\\b(\\w*\\.)?org_id\\b\\s*(=|:=|IN|!=|<>)\\s*(\\(?\\s*'?\\d+'?(\\s*,\\s*'?\\d+'?)*\\s*\\)?)"
- pattern-regex: "(?i)^(?:(?!--).)*\\b(\\w*\\.)?\\w*org_id\\w*\\b\\s*(=|:=|IN|!=|<>)\\s*(\\(?\\s*'?\\d+'?(\\s*,\\s*'?\\d+'?)*\\s*\\)?)"

@stefanvacareanu7 stefanvacareanu7 merged commit 99bfc22 into main May 5, 2026
3 checks passed
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