Skip to content

CD-7372 API for Code Snippet Context Extraction Based on Rule Complexity#630

Open
neha-naazneen wants to merge 4 commits into
codescan-24.12from
CD-7372
Open

CD-7372 API for Code Snippet Context Extraction Based on Rule Complexity#630
neha-naazneen wants to merge 4 commits into
codescan-24.12from
CD-7372

Conversation

@neha-naazneen
Copy link
Copy Markdown
Collaborator

Design a new AI Code Context API that consolidates relevant violation metadata and dynamically extracts code snippets based on the rule complexity level (Low, Medium, High) so that the AI model receives appropriate contextual information for accurate rule violation analysis and automated fix generation.

Hypothesis:
If we design an API that dynamically determines and returns structured code context data (line, method, or class) based on rule severity, then the AI model will have optimal and consistent contextual information for each violation. This will improve accuracy in auto-fixes, reduce false positives, and enable scalable integration across rule sets.

The API should return a JSON response containing:

Violation line number

Rule key

Low : Extract ±5 lines around the violation.

Medium : Extract the entire method of the violation.

High : Extract the entire class containing the violation.

Start and end line numbers of each snippet

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.

1 participant