fix(tokenizer): recognize ';' line comments for lisp/clojure/scheme/racket#850
Conversation
…acket
These formats were absent from comment_style()'s match arms and fell
through to the C-style default, so ';' line comments were tokenized as
code. As a result --mode weak / --skip-comments could not drop them, and
the identical comment header every Emacs Lisp file carries (the GNU GPL
notice) was reported as duplicate code.
Route lisp/clojure/scheme/racket to the existing Semicolon comment style
(';' is their line comment) and add a tokenizer regression test.
Closes kucherenko#849
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughThe ChangesLisp-family semicolon comment routing
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Fixes RUSTSEC-2026-0190 (unsound Error::downcast_mut) flagged by cargo-deny in CI.
Bug fix.
Fixes #849.
lisp,clojure,scheme, andracketare absent fromcomment_style()inrust/crates/cpd-tokenizer/src/generic.rs, so they fall through to_ => CommentStyle::CStyle. Their;line comments are never recognized and are tokenized as code, so--mode weak/--skip-commentscannot drop them — e.g. the identical GNU GPL header that every Emacs Lisp file carries gets reported as duplicate code in every file pair.Route
lisp/clojure/scheme/racketto the existingCommentStyle::Semicolon(their line comment is;).--mode weak/--skip-commentsnow drops their comments.Verified by building
cpdand running it on two.elfiles sharing an identical license header but different code:Found 1 clones→Found 0 clones(exit 0). Added acpd-tokenizerregression testlisp_family_semicolon_comment_marked_as_comment;cargo test -p cpd-tokenizer→ 109 passed, 0 failed.Block comments (
#| |#, datum#;) in Common Lisp/Scheme/Racket are a separate, secondary concern not handled by theSemicolonstyle and are out of scope here. Disclosure: drafted with AI assistance and reviewed before submitting.This change is
Summary by CodeRabbit
;;comments are now tokenized correctly in these languages, improving syntax highlighting and parsing consistency.