feat: add code_locator.py — automated code snippet location fixer - #76
Open
Dametime-0 wants to merge 1 commit into
Open
feat: add code_locator.py — automated code snippet location fixer#76Dametime-0 wants to merge 1 commit into
Dametime-0 wants to merge 1 commit into
Conversation
Add a Python tool that detects and fixes misaligned code snippets in VulnGym entry_point / critical_operation / trace nodes. For each node the tool: - Checks out the target repository at its vulnerable commit - Verifies the code snippet matches at file:line - Searches ±5 lines → full file → full repo when mismatched - Auto-fixes line/file when a unique match is found - Flags ambiguous cases for human review in needs_human.csv Also includes comprehensive README documentation covering usage, parameters, output format, and known limitations. Tool satisfies Issue Tencent#4 requirements: - Outputs entries.fixed.jsonl, fix_diff.csv, needs_human.csv - Whitespace-tolerant matching for multi-line code snippets - Conservative: never modifies when unsure - Repo caching to avoid repeated clones - --skip-clone mode for offline operation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a Python tool that detects and fixes misaligned code snippets in VulnGym entry_point / critical_operation / trace nodes. For each node the tool:
Also includes comprehensive README documentation covering usage, parameters, output format, and known limitations.
Tool satisfies Issue #4 requirements:
Outputs entries.fixed.jsonl, fix_diff.csv, needs_human.csv
Whitespace-tolerant matching for multi-line code snippets
Conservative: never modifies when unsure
Repo caching to avoid repeated clones
--skip-clone mode for offline operation
实现了 Issue 【2026犀牛鸟】修复 VulnGym 数据中的代码片段定位偏差 #4 要求的代码片段定位偏差自动修复工具。
新增文件
tools/code_locator.pytools/README_code_locator.md功能
对
data/entries.jsonl中每个entry_point/critical_operation/trace[*]节点:needs_human.csv输出文件
entries.fixed.jsonl— 修复后的数据fix_diff.csv— 逐条修改记录needs_human.csv— 人工复核清单使用方式