-
-
Notifications
You must be signed in to change notification settings - Fork 595
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
feat(file): add C++ file extensions support for comment stripping #435
Conversation
Hi @yamadashy, thanks for maintaining this awesome repomix tool! While using repomix to pack my C++ repository (which primarily contains .h and .cc files), I noticed it wasn't correctly stripping comments from these file extensions. This PR adds support for common C++ file extensions (.h, .hpp, .cpp, .cc, and .cxx) by configuring them to use the existing C comment stripper. I've also added comprehensive test cases for each supported extension to verify proper handling of various comment styles in each file type. All tests pass successfully. This enhancement should significantly improve repomix's code processing capabilities for C++ projects. Let me know if you'd like any changes to this implementation! |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #435 +/- ##
==========================================
+ Coverage 85.19% 85.23% +0.03%
==========================================
Files 87 87
Lines 4242 4266 +24
Branches 837 840 +3
==========================================
+ Hits 3614 3636 +22
- Misses 628 630 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Add support for .h, .hpp, .cpp, .cc, and .cxx file extensions - Configure all C++ extensions to use the existing C comment stripper - Add comprehensive test cases for each supported C++ extension - Verify correct handling of various comment styles in each file type This enhancement improves code processing capabilities for C++ projects. Signed-off-by: adijeshen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for C++ file extensions to the comment stripping functionality.
- New test cases for .h, .hpp, .cpp, .cc, and .cxx files covering various comment styles were added.
- The core file manipulator was updated to map these C++ extensions to the existing C comment stripper.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
tests/core/file/fileManipulate.test.ts | Added test cases for C++ file extensions and comment removal cases. |
src/core/file/fileManipulate.ts | Configured C++ extensions to use the existing C comment stripper. |
Hi, @AdijeShen! Thank you for your PR! I tested it with this repository and it works great, the code looks perfect! I noticed that documentation comments were still remaining, so I tried to address that issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for comment stripping in C++ files by configuring all C++ extensions (.h, .hpp, .cpp, .cc, .cxx) to use a dedicated manipulator and by adding comprehensive test cases to validate the behavior.
- Added a new CppManipulator class to handle C++ file types using the existing C comment stripper.
- Extended the test suite with multiple test cases covering various comment formats, including triple slash comments.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
tests/core/file/fileManipulate.test.ts | Added new test cases for header, source, and triple slash comment removal across multiple C++ file extensions. |
src/core/file/fileManipulate.ts | Introduced the CppManipulator class and updated extension mappings for C++ files. |
Comments suppressed due to low confidence (1)
src/core/file/fileManipulate.ts:55
- [nitpick] Consider handling multiple occurrences of '///' on a single line—for example, by using a regular expression—to ensure all triple slash comments are removed consistently.
const tripleSlashIndex = line.indexOf('///');
Thanks for reviewing and testing the PR! Regarding documentation comments - I believe they should not be preserved during the stripping process. The purpose of --remove-comments seems to be creating compact code archives, and documentation comments (even the triple-slash and /** */ varieties) would add unnecessary bulk to the packaged repository. Your implementation to handle the triple-slash comments looks good to me - thanks for enhancing my initial contribution! |
@AdijeShen I'll merge this PR now. Thank you so much for your contribution!! If you have any other ideas in the future, please feel free to contribute again! |
@AdijeShen Thank you for your contribution! Looking forward to your future contributions! |
This enhancement improves code processing capabilities for C++ projects.
Checklist
npm run test
npm run lint