fix(file): Replace strip-comments with @repomix/strip-comments#1009
fix(file): Replace strip-comments with @repomix/strip-comments#1009
Conversation
Replace the original strip-comments package with @repomix/strip-comments,
which provides enhanced support for:
- Go directives (//go:build, //go:generate, etc.)
- C++ document comments (///)
- Python docstrings (""" and ''') and hash comments
This removes the custom GoManipulator, PythonManipulator, and CppManipulator
implementations in favor of the improved library support.
Note: preserveNewlines option keeps newlines for line number preservation,
so docstrings are replaced with empty lines rather than being fully removed.
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughMigrated from the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
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 |
Summary of ChangesHello @yamadashy, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the comment stripping mechanism by migrating from the original Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1009 +/- ##
==========================================
- Coverage 90.36% 90.24% -0.13%
==========================================
Files 120 120
Lines 9241 9017 -224
Branches 1698 1623 -75
==========================================
- Hits 8351 8137 -214
+ Misses 890 880 -10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
PR Review: fix(file): Replace strip-comments with @repomix/strip-commentsSummaryThis PR replaces the original Code Quality ✅Positive aspects:
Minor observations:
Bug Fix Verification ✅The PR addresses issue #975 (hanging on large files with Test Coverage ✅
Detailed Test AnalysisThe test updates add extra blank lines in expected outputs because the new library preserves newlines when removing multi-line comments/docstrings. This is intentional behavior for maintaining line number correspondence between original and processed files. Key test scenarios covered:
Security Considerations ✅
Potential Risks & Mitigations
Premortem AnalysisPotential failure scenarios:
Recommended mitigations:
Verdict: Approve ✅This is a well-executed improvement that:
The PR follows the project's coding guidelines and commit message conventions. Review by Claude Code |
Deploying repomix with
|
| Latest commit: |
6e19fd8
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://15e6361f.repomix.pages.dev |
| Branch Preview URL: | https://fix-use-repomix-strip-commen.repomix.pages.dev |
There was a problem hiding this comment.
Code Review
This is an excellent pull request that significantly simplifies the codebase by replacing approximately 230 lines of custom, complex comment-stripping logic with the @repomix/strip-comments library. This change improves maintainability, leverages a more capable fork for better language support (C++, Go, Python), and fixes a critical bug (#975) related to processing large files. The refactoring and corresponding test updates are well-executed. Great work!
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/core/file/fileManipulate.ts (1)
67-89: Pragmatic language fallbacks work but merit a brief comment.Using
'c'for Dart/Kotlin/Rust/Solidity and'perl'for shell/YAML leverages compatible comment syntax. Consider adding a brief inline comment explaining these fallbacks for future maintainers:+ // Dart, Kotlin, Rust, Solidity use C-style comments (// and /* */) '.dart': new StripCommentsManipulator('c'), ... + // Shell and YAML use # for comments, similar to Perl '.sh': new StripCommentsManipulator('perl'),package.json (1)
107-107: Remove the redundant@types/strip-commentsdevDependency.
@repomix/strip-comments(v2.4.1) includes its own TypeScript declarations viaindex.d.ts, making@types/strip-commentsunnecessary.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (3)
package.json(1 hunks)src/core/file/fileManipulate.ts(2 hunks)tests/core/file/fileManipulate.test.ts(6 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: Test (windows-latest, 24.x)
- GitHub Check: Test (windows-latest, 20.x)
- GitHub Check: Test (windows-latest, 22.x)
- GitHub Check: Test (windows-latest, 25.x)
- GitHub Check: Test (macos-latest, 25.x)
- GitHub Check: Build and run (windows-latest, 20.x)
- GitHub Check: Build and run with Bun (windows-latest, latest)
- GitHub Check: Cloudflare Pages
🔇 Additional comments (5)
package.json (1)
78-78: LGTM on the dependency change.The migration to
@repomix/strip-commentsaddresses the hanging issue on large files (issue #975) and provides better language support for Go, C++, and Python.tests/core/file/fileManipulate.test.ts (1)
1-1040: Comprehensive test coverage for the comment stripping migration.The test suite thoroughly covers:
- Language-specific comment syntax (C-style, Python, Ruby, SQL, YAML)
- Go compiler directives preservation (
//go:build,//go:generate)- C++ triple-slash documentation comments
- Python edge cases (f-strings, nested quotes, docstrings vs string literals)
- Composite file types (Vue, Svelte)
The inline comments clarifying
preserveNewlinesbehavior improve test readability.src/core/file/fileManipulate.ts (3)
1-6: Clean interface and import migration.The switch to
@repomix/strip-commentsand theFileManipulatorinterface are well-structured.
36-42: Good use ofpreserveNewlinesfor line number preservation.This ensures that after comment removal, the line numbers in error messages or debugging remain accurate, which aligns with the PR objectives.
91-100: Composite manipulator correctly handles multi-language SFC files.Chaining HTML, CSS, and JavaScript strippers ensures all comment types are removed from Vue and Svelte single-file components.
PR Review: fix(file): Replace strip-comments with @repomix/strip-commentsOverall Assessment: ✅ ApproveThis is a well-executed PR that successfully migrates to New ObservationsSince previous reviews have covered the main aspects, here's one remaining item: 📦 Minor: Redundant devDependency
The Consider removing it in a follow-up: npm uninstall @types/strip-commentsThis is a minor cleanup item and doesn't block merge. Premortem Summary
The PR is ready for merge. All tests pass, code coverage is maintained, and the implementation is clean. 🤖 Review by Claude Code |
Summary
Replace the original
strip-commentspackage with@repomix/strip-comments, a fork with enhanced language support and bug fixes.Bug Fix
removeCommentsImprovements in @repomix/strip-comments
//go:build,//go:generate,//go:embed, etc.)///)"""and'''docstrings, and hash comments in stringsRefactoring
GoManipulator,PythonManipulator, andCppManipulatorimplementations (~230 lines removed)Note
The
preserveNewlinesoption keeps newlines for line number preservation, so docstrings/comments are replaced with empty lines rather than being fully removed.Checklist
npm run testnpm run lint