Conversation
Summary of ChangesHello @BlueWitherer, 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 represents a major internal overhaul of the "Horrible Ideas" mod, primarily driven by the upgrade to Geode SDK v5 and a commitment to modern C++ practices. The core changes involve a complete refactoring of how mod options are registered and managed, shifting from a monolithic list to a more modular, file-specific registration approach. The event system has been modernized to align with Geode's latest event architecture, and keybind management has been integrated directly into the mod. These updates aim to improve maintainability, leverage new SDK features, and ensure compatibility with the latest Geometry Dash versions. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Ignored Files
Activity
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.
Code Review
This pull request refactors a large portion of the codebase to align with Geode v5 APIs and best practices, utilizing GlobalEvent and the REGISTER_HORRIBLE_OPTION macro to enhance clarity and maintainability. No security vulnerabilities were identified. However, a critical regression was introduced by removing option event listeners in hook files, causing many hooks to cache the option's enabled state at initialization without updating it. This issue needs to be addressed across all affected hooks, in addition to a couple of minor potential issues.
| switch (m_impl->m_operation) { | ||
| case MathOperation::Addition: | ||
| m_impl->m_correctAnswer = m_impl->m_numFirst + m_impl->m_numSecond; | ||
| break; | ||
| default: [[fallthrough]]; | ||
|
|
||
| case MathOperation::Subtraction: | ||
| m_impl->m_correctAnswer = m_impl->m_numFirst - m_impl->m_numSecond; | ||
| break; | ||
| case MathOperation::Addition: | ||
| m_impl->m_correctAnswer = m_impl->m_numFirst + m_impl->m_numSecond; | ||
| break; | ||
|
|
||
| case MathOperation::Multiplication: | ||
| m_impl->m_correctAnswer = m_impl->m_numFirst * m_impl->m_numSecond; | ||
| break; | ||
| case MathOperation::Subtraction: | ||
| m_impl->m_correctAnswer = m_impl->m_numFirst - m_impl->m_numSecond; | ||
| break; | ||
|
|
||
| default: | ||
| break; | ||
| case MathOperation::Multiplication: | ||
| m_impl->m_correctAnswer = m_impl->m_numFirst * m_impl->m_numSecond; | ||
| break; | ||
| }; |
There was a problem hiding this comment.
Using default: [[fallthrough]]; here could lead to subtle bugs if the MathOperation enum is extended in the future. An unhandled case would silently fall through to the Addition case. The previous implementation with default: break; was safer. It would be even better to not have a default case at all, so the compiler can warn about unhandled enum values.
| switch (m_impl->m_operation) { | |
| case MathOperation::Addition: | |
| m_impl->m_correctAnswer = m_impl->m_numFirst + m_impl->m_numSecond; | |
| break; | |
| default: [[fallthrough]]; | |
| case MathOperation::Subtraction: | |
| m_impl->m_correctAnswer = m_impl->m_numFirst - m_impl->m_numSecond; | |
| break; | |
| case MathOperation::Addition: | |
| m_impl->m_correctAnswer = m_impl->m_numFirst + m_impl->m_numSecond; | |
| break; | |
| case MathOperation::Multiplication: | |
| m_impl->m_correctAnswer = m_impl->m_numFirst * m_impl->m_numSecond; | |
| break; | |
| case MathOperation::Subtraction: | |
| m_impl->m_correctAnswer = m_impl->m_numFirst - m_impl->m_numSecond; | |
| break; | |
| default: | |
| break; | |
| case MathOperation::Multiplication: | |
| m_impl->m_correctAnswer = m_impl->m_numFirst * m_impl->m_numSecond; | |
| break; | |
| }; | |
| switch (m_impl->m_operation) { | |
| case MathOperation::Addition: | |
| m_impl->m_correctAnswer = m_impl->m_numFirst + m_impl->m_numSecond; | |
| break; | |
| case MathOperation::Subtraction: | |
| m_impl->m_correctAnswer = m_impl->m_numFirst - m_impl->m_numSecond; | |
| break; | |
| case MathOperation::Multiplication: | |
| m_impl->m_correctAnswer = m_impl->m_numFirst * m_impl->m_numSecond; | |
| break; | |
| // No default case to get compiler warnings for unhandled enum values. | |
| // MathOperation::Geometry is not handled here. | |
| }; |
| switch (m_impl->m_operation) { | ||
| case MathOperation::Addition: | ||
| operation = "+"; | ||
| break; | ||
| default: [[fallthrough]]; | ||
|
|
||
| case MathOperation::Subtraction: | ||
| operation = "-"; | ||
| break; | ||
| case MathOperation::Addition: | ||
| operation = "+"; | ||
| break; | ||
|
|
||
| case MathOperation::Multiplication: | ||
| operation = "x"; | ||
| break; | ||
| case MathOperation::Subtraction: | ||
| operation = "-"; | ||
| break; | ||
|
|
||
| default: | ||
| operation = "?"; | ||
| case MathOperation::Multiplication: | ||
| operation = "x"; | ||
| break; | ||
| }; |
There was a problem hiding this comment.
Similar to the previous switch statement, using default: [[fallthrough]]; can hide potential bugs if the MathOperation enum is extended. The previous implementation which handled the default case by setting operation = "?" was more robust. It's generally better to either handle all enum cases explicitly or have a default that asserts or logs an error.
| switch (m_impl->m_operation) { | |
| case MathOperation::Addition: | |
| operation = "+"; | |
| break; | |
| default: [[fallthrough]]; | |
| case MathOperation::Subtraction: | |
| operation = "-"; | |
| break; | |
| case MathOperation::Addition: | |
| operation = "+"; | |
| break; | |
| case MathOperation::Multiplication: | |
| operation = "x"; | |
| break; | |
| case MathOperation::Subtraction: | |
| operation = "-"; | |
| break; | |
| default: | |
| operation = "?"; | |
| case MathOperation::Multiplication: | |
| operation = "x"; | |
| break; | |
| }; | |
| switch (m_impl->m_operation) { | |
| case MathOperation::Addition: | |
| operation = "+"; | |
| break; | |
| case MathOperation::Subtraction: | |
| operation = "-"; | |
| break; | |
| case MathOperation::Multiplication: | |
| operation = "x"; | |
| break; | |
| default: | |
| // This case should ideally not be reached with the current logic, | |
| // but it's safer to handle it. | |
| operation = "?"; | |
| break; | |
| }; |
No description provided.