-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: try_fix_yaml failed on snippets with prefix or yml
#2097
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
more robust try_fix_yaml
test extract snippet with prefix "```" or "```yml"
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
|
Hi @LawrenceMantin We offer a free Qodo version for free-trial for developers [www.qodo.ai], We’re currently restructuring the project and contributing it to the community, with plans to move it under a foundation. We’ll also be launching an Ambassador Program soon — if you’d like to join, stay tuned for more details! |
User description
LLMs might return code wrapped with ``` or ```yml.
PR Type
Bug fix
Description
Enhanced
try_fix_yamlto handle code snippets with\``,```yaml, or```yml` prefixesUpdated regex pattern to match optional language identifiers (yaml/yml)
Added dynamic prefix detection to correctly remove code fence markers
Extended test coverage with three snippet format variations
Diagram Walkthrough
File Walkthrough
utils.py
Enhance regex and prefix handling for code fencespr_agent/algo/utils.py
snippet_patternregex fromr'yaml([\s\S]*?)(?=\s*$|")'tor'(yaml|yml)?([\s\S]*?)(?=\s*$|")'to match optional languageidentifiers
starts with
\\\yaml,\\\yml, or plain\\\Modifiedremoveprefix()call to use detected prefix instead of'hardcoded
yaml'test_try_fix_yaml.py
Add test cases for multiple code fence formatstests/unittest/test_try_fix_yaml.py
review_texttoreview_text1forclarity
review_text2test case with\\\ymlprefix format
Addedreview_text3test case with plain\\\prefix format