-
Notifications
You must be signed in to change notification settings - Fork 3
Pre-vehicle cleanup #27
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
Conversation
mmathieum
commented
Jan 15, 2026
- Pre-vehicle cleanup commons-java#13
Summary of ChangesHello @mmathieum, 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 performs a significant cleanup and refactoring across the database utility, SQL escaping, and data generation components of the project. The changes aim to improve the robustness of SQL query construction, introduce more precise handling of SQL identifiers, and enhance the flexibility and efficiency of data serialization, particularly for schedule and service date information. These updates lay a foundation for future data processing and export capabilities, potentially related to vehicle data. 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
|
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.
Code Review
This pull request introduces a series of cleanups and refactorings across the codebase. Key changes include the introduction of a new escapeId function for SQL identifiers, which is now used consistently. The MServiceDate and MSchedule classes have been improved to use Comparators for sorting, which is a good practice. The use of try-with-resources in MGenerator.java is a welcome improvement for resource management.
My main feedback is on the dynamic SQL query construction in DBUtils.kt. While the current changes make the code more compact, they reduce readability. I've suggested a more significant refactoring to make this logic cleaner, more maintainable, and less error-prone. I've also pointed out a minor style issue in a test file.
Overall, this is a good set of improvements to the codebase's quality and consistency.
|
/gemini review |
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.
Code Review
This pull request introduces a number of cleanups and refactorings. Notably, it adds support for MTrip objects, refactors SQL ID escaping, and improves sorting logic for service dates. The code quality is improved by using try-with-resources in several places.
My review includes a few suggestions for further improvement:
- In
DBUtils.kt, I've pointed out an opportunity to improve query string building for both efficiency (usingStringBuilder) and readability (avoiding semicolons for multiple statements on one line). - In
MGenerator.java, I've suggested renaming a couple of constants to better reflect their values, which will improve maintainability. - I also found a piece of commented-out code in
MGenerator.javathat could be removed.
Overall, these are good changes that improve the codebase.
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 performs cleanup and refactoring in preparation for vehicle-related changes, focusing on improving code organization and introducing new data structures.
Changes:
- Renamed escaping functions from
escape()toescapeId()andquotesEscape()toquotesEscapeId()for ID-specific SQL escaping - Added new
MTripdata class and integrated it into the data processing pipeline - Refactored sorting and file export logic for service dates and schedules with new feature flags
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/org/mtransit/parser/mt/data/MServiceDateTest.kt | Updated test to use explicit comparator instead of default sorting |
| src/main/java/org/mtransit/parser/mt/data/MTripIds.kt | Renamed method call from quotesEscape() to quotesEscapeId() |
| src/main/java/org/mtransit/parser/mt/data/MTripId.kt | Renamed method call from quotesEscape() to quotesEscapeId() |
| src/main/java/org/mtransit/parser/mt/data/MTrip.kt | New data class representing transit trips with serialization support |
| src/main/java/org/mtransit/parser/mt/data/MSpec.kt | Added trips field to the spec data class |
| src/main/java/org/mtransit/parser/mt/data/MServiceIds.kt | Renamed method call from quotesEscape() to quotesEscapeId() |
| src/main/java/org/mtransit/parser/mt/data/MServiceId.kt | Renamed method call from quotesEscape() to quotesEscapeId() |
| src/main/java/org/mtransit/parser/mt/data/MServiceDate.kt | Removed Comparable interface, added comparators and flattened export logic |
| src/main/java/org/mtransit/parser/mt/data/MSchedule.kt | Refactored sorting logic with feature flag support and improved formatting |
| src/main/java/org/mtransit/parser/mt/MGenerator.java | Added trip dumping logic and refactored service date export |
| src/main/java/org/mtransit/parser/mt/MDataChangedManager.kt | Updated to use renamed escapeId() method |
| src/main/java/org/mtransit/parser/mt/GenerateMObjectsTask.java | Integrated MTrip collection and processing |
| src/main/java/org/mtransit/parser/gtfs/data/GCalendarDate.kt | Updated to use renamed escapeId() method |
| src/main/java/org/mtransit/parser/gtfs/data/GCalendar.kt | Updated to use renamed escapeId() method |
| src/main/java/org/mtransit/parser/db/SQLUtils.kt | Added new escapeId() and quotesEscapeId() functions for ID-specific escaping |
| src/main/java/org/mtransit/parser/db/DBUtils.kt | Refactored query building logic and fixed index initialization |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.