-
Notifications
You must be signed in to change notification settings - Fork 6
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
dangling ref #109
dangling ref #109
Conversation
Warning Rate limit exceeded@PhilipDeegan has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 23 minutes and 55 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (2)
WalkthroughThe pull request encompasses modifications across several files in the Maiken build system. The changes primarily focus on refining error handling, updating variable declarations, and improving type semantics. The configuration file Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
🧹 Nitpick comments (5)
src/maiken/build/bin.cpp (3)
125-125
: Consider explicit type declaration for better readability.While using
auto const
is valid here, an explicitstd::string const
might make the intended type more obvious to readers, especially since this is storing a project name which is a core concept.- auto const name(out.empty() ? project().root()[STR_NAME].Scalar() : out); + std::string const name(out.empty() ? project().root()[STR_NAME].Scalar() : out);
Line range hint
193-194
: Consider making the thread pool timeout configurable.The hardcoded timeout of 10 seconds (
10000000
microseconds) might not be suitable for all environments or test suites. Consider:
- Making this value configurable through application settings
- Using a constant or configuration value instead of a magic number
- ctp.finish(10000000); // 10 milliseconds + static constexpr auto DEFAULT_TIMEOUT_US = 10000000; // 10 seconds + ctp.finish(AppVars::INSTANCE().getThreadPoolTimeout(DEFAULT_TIMEOUT_US));
Line range hint
271-272
: Enhance error message with more context.The error message when encountering an unsupported file type could be more helpful by including:
- The list of supported file types
- The current configuration context
- KEXCEPTION("Unable to handle artifact: \"" + lang + "\" - type is not in file list"); + std::string supported_types; + for (const auto& type : fs) { + if (!supported_types.empty()) supported_types += ", "; + supported_types += type.first; + } + KEXCEPTION("Unable to handle artifact: \"" + lang + "\" - supported types are: [" + supported_types + "]");src/maiken.cpp (2)
Line range hint
201-206
: Enhance error message in catch blockThe current error message only shows the exception message and a generic "Possible super cycle detected" message. Consider including more context about what operation failed.
} catch (std::exception const& e) { - KLOG(ERR) << e.what(); - KEXIT(1, "Possible super cycle detected: " + project().dir().real()); + KLOG(ERR) << "Failed to resolve super project: " << e.what(); + KEXIT(1, "Failed to process super reference (possible cycle detected) in: " + project().dir().real()); }
Line range hint
214-214
: Remove empty commentThe empty comment
//
serves no purpose and should be removed.- //
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
mkn.yaml
(1 hunks)src/maiken.cpp
(1 hunks)src/maiken/build/bin.cpp
(1 hunks)src/maiken/dep.cpp
(1 hunks)src/maiken/validation.cpp
(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- mkn.yaml
🔇 Additional comments (4)
src/maiken/dep.cpp (1)
109-109
: 🛠️ Refactor suggestion
Consider keeping the reference type for better performance.
The change from reference to value type might introduce unnecessary string copies. Since Scalar()
returns a std::string
, and the value is only used for reading within the scope, using a const reference would be more efficient.
- auto const name(a.project().root()[STR_NAME].Scalar());
+ std::string const& name(a.project().root()[STR_NAME].Scalar());
Likely invalid or redundant comment.
src/maiken/validation.cpp (1)
68-68
: LGTM: Simple string comparison use case.
The change to value type is acceptable here as the string is only used for simple comparisons.
src/maiken.cpp (2)
196-196
: LGTM: Good choice using auto const
instead of auto const&
Using auto const
is more efficient here as the YAML scalar value is small and copying avoids maintaining a reference to YAML's internal data structures.
Line range hint 196-232
: LGTM: Robust error handling for super references
The code thoroughly validates super references by:
- Checking for self-references
- Validating file/directory existence
- Detecting cycles in the super chain
- Properly handling both file and directory cases
This makes the system more robust and provides clear error messages.
@@ -130,7 +130,7 @@ void maiken::Application::preSetupValidation() KTHROW(maiken::Exception) { | |||
Validator::PRE_BUILD(*this, project().root()); | |||
std::vector<std::string> profiles; | |||
for (auto const& profile : project().root()[STR_PROFILE]) { | |||
std::string const& p(profile[STR_NAME].Scalar()); | |||
auto const p(profile[STR_NAME].Scalar()); |
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.
🛠️ Refactor suggestion
Maintain reference type for frequently used value.
The profile name is used multiple times in string comparisons and error messages. Using a value type here could lead to unnecessary copies.
- auto const p(profile[STR_NAME].Scalar());
+ std::string const& p(profile[STR_NAME].Scalar());
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
auto const p(profile[STR_NAME].Scalar()); | |
std::string const& p(profile[STR_NAME].Scalar()); |
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Documentation