support C# - #15
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds support for three new programming languages (C++, C#, and Dart) to the Ramile source code extraction tool. Additionally, it introduces build configuration files (pyproject.toml and uv.lock) for the uv package manager and updates documentation to reflect the new language support.
Changes:
- Added three new file processors (CppProcessor, CSharpProcessor, DartProcessor) that follow the same pattern as existing Java/JavaScript processors
- Updated processor registration to include the new language processors
- Added error handling to the file processing method to gracefully handle file reading exceptions
- Updated README with Chinese translation, uv usage instructions, and documentation for new language support
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| ramile/processors/cpp_processor.py | New processor for C++ files (.cpp, .hpp, .c, .h) with C-style comment filtering |
| ramile/processors/csharp_processor.py | New processor for C# files (.cs) with C-style comment filtering |
| ramile/processors/dart_processor.py | New processor for Dart files (.dart) with C-style comment filtering |
| ramile/processors/init.py | Registered new processors and added exception handling for file processing |
| pyproject.toml | New project configuration file for uv package manager |
| uv.lock | New lock file for uv package manager with dependency specifications |
| README.md | Updated with Chinese translation, uv instructions, and new language support documentation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| class CSharpProcessor(FileProcessorBase): | ||
| expected_extensions = ['.cs'] | ||
|
|
||
| def __init__(self): | ||
| self.filters.append(BlankLineFilter()) | ||
| self.filters.append(CStyleCommentBlockFilter()) | ||
| self.filters.append(DoubleSlashCommentFilter()) | ||
| return |
There was a problem hiding this comment.
The new CSharpProcessor lacks test coverage. The codebase uses pytest and has test coverage for other language processors (see tests/test_js.py). Consider adding a test file such as tests/test_csharp.py with sample C# code to verify that the processor correctly filters comments and blank lines.
| class CppProcessor(FileProcessorBase): | ||
| expected_extensions = ['.cpp', '.hpp', '.c', '.h'] | ||
|
|
||
| def __init__(self): | ||
| self.filters.append(BlankLineFilter()) | ||
| self.filters.append(CStyleCommentBlockFilter()) | ||
| self.filters.append(DoubleSlashCommentFilter()) | ||
| return |
There was a problem hiding this comment.
The new CppProcessor lacks test coverage. The codebase uses pytest and has test coverage for other language processors (see tests/test_js.py). Consider adding a test file such as tests/test_cpp.py with sample C++ code to verify that the processor correctly filters comments and blank lines.
| class DartProcessor(FileProcessorBase): | ||
| expected_extensions = ['.dart'] | ||
|
|
||
| def __init__(self): | ||
| self.filters.append(BlankLineFilter()) | ||
| self.filters.append(CStyleCommentBlockFilter()) | ||
| self.filters.append(DoubleSlashCommentFilter()) | ||
| return |
There was a problem hiding this comment.
The new DartProcessor lacks test coverage. The codebase uses pytest and has test coverage for other language processors (see tests/test_js.py). Consider adding a test file such as tests/test_dart.py with sample Dart code to verify that the processor correctly filters comments and blank lines.
| last_line = None | ||
| for original_line in open_file: | ||
| if self.process_line(file, original_line): | ||
| yield original_line | ||
| last_line = original_line |
There was a problem hiding this comment.
Variable last_line is not used.
| last_line = None | |
| for original_line in open_file: | |
| if self.process_line(file, original_line): | |
| yield original_line | |
| last_line = original_line | |
| for original_line in open_file: | |
| if self.process_line(file, original_line): | |
| yield original_line |
| from ramile.processors.double_slash_comment_filter import DoubleSlashCommentFilter | ||
|
|
||
|
|
||
| class CppProcessor(FileProcessorBase): |
There was a problem hiding this comment.
This class does not call FileProcessorBase.init during initialization. (CppProcessor.init may be missing a call to a base class init)
| from ramile.processors.double_slash_comment_filter import DoubleSlashCommentFilter | ||
|
|
||
|
|
||
| class CSharpProcessor(FileProcessorBase): |
There was a problem hiding this comment.
This class does not call FileProcessorBase.init during initialization. (CSharpProcessor.init may be missing a call to a base class init)
| from ramile.processors.double_slash_comment_filter import DoubleSlashCommentFilter | ||
|
|
||
|
|
||
| class DartProcessor(FileProcessorBase): |
There was a problem hiding this comment.
This class does not call FileProcessorBase.init during initialization. (DartProcessor.init may be missing a call to a base class init)
Add support for C++, C#, Dart
All three languages have similar style like Java, so basically copy JavaProcessor