Repository navigation
Conversation
|
Tested extensively with the compiled binary across 15 popular languages (Python, JavaScript, TypeScript, Java, C#, C++, C, Go, Rust, PHP, Ruby, Swift, Kotlin, SQL, Shell). Good news: multi-line block comments with code before Found one gap, reproduces identically across every Scope note: only reachable via explicit Not a regression either way (previously the whole line would've been dropped, losing the code too), but leaves literal comment markers in output the filter is supposed to remove. The |
|
Thanks for the thorough testing across 15 languages! The multiple-block-comments-on-one-line gap you found makes sense — it's a pre-existing limitation, not a regression. Happy to tackle it as a follow-up PR if you'd like. Is this one good to merge as-is? |
7ff9929 to
7c47ef3
Compare
MinimalFilter dropped entire lines containing inline block comments like `int x = 5; /* comment */`, silently losing the code portion. Also affected closing lines of multi-line comments when followed by code. Walk the line instead of matching a single comment: every block comment on it is stripped and the code between them is kept, so a line with several `/* … */` no longer leaks the second and later markers into the output. An unterminated opener still carries the state to the next line. Fixes rtk-ai#2714
7c47ef3 to
727fb7f
Compare
|
@pszymkowiak thanks for the 15-language sweep. I fixed the gap you found in this PR rather than deferring it: the Two new tests cover several comments on one line and a terminated + unterminated mix; four of the five block-comment tests fail on develop. I re-ran a Rust / Go / JS / Python sweep and doc comments and docstrings come out byte-identical. One thing I did not change: code after a Rebased on current develop. This edits the same function as #2713, so whichever merges second needs a mechanical rebase. |
|
Closing this. Develop moved in a way that puts it in real conflict with this PR's approach, not just a textual rebase conflict. 362065e ( This PR's whole point is the opposite: detecting a genuine Doing both correctly needs real string-literal-aware scanning per language (recognizing |
Summary
Fixes #2714
MinimalFilterdropped the whole line when it contained an inline block comment, soint x = 5; /* comment */lost its code, and so did the closing line of a multi-line comment when code followed the*/.The line is now walked once: code before, between and after
/* ... */is kept, the comments are stripped, and an unterminated/*at the end of a line still carries state to the next line as before. The gap pszymkowiak found (only the first comment on a line was stripped and the rest leaked) is fixed here rather than deferred: every comment on a line is stripped and the code between them kept.Doc comments (
///,/** ... */) and Python docstrings are byte-identical to develop across a Rust / Go / JS / Python sweep.Known limitations, both unchanged from the version that was reviewed: code after a
*/that closes a multi-line comment loses its original indentation; and for Pythonblock_start/block_endare both""", sox = """abc"""emitsx =(develop drops the line entirely).Tests
Five block-comment tests, four of which fail on develop's code (the fifth guards that full-line comments are still stripped), including several comments on one line and a mix of terminated and unterminated ones.
cargo fmt --all -- --check,cargo clippy --all-targets(0 warnings),cargo test --all(all pass)