-
Notifications
You must be signed in to change notification settings - Fork 19
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
Various clang tidy recommendations #227
Conversation
hikinggrass
commented
Jan 7, 2025
- More const ref usage
- fix narrowing and widening conversion warnings
Signed-off-by: Kai-Uwe Hermann <[email protected]>
Signed-off-by: Kai-Uwe Hermann <[email protected]>
Signed-off-by: Kai-Uwe Hermann <[email protected]>
Signed-off-by: Kai-Uwe Hermann <[email protected]>
Signed-off-by: Kai-Uwe Hermann <[email protected]>
…imum length Signed-off-by: Kai-Uwe Hermann <[email protected]>
Signed-off-by: Kai-Uwe Hermann <[email protected]>
Signed-off-by: Kai-Uwe Hermann <[email protected]>
Signed-off-by: Kai-Uwe Hermann <[email protected]>
Signed-off-by: Kai-Uwe Hermann <[email protected]>
Signed-off-by: Kai-Uwe Hermann <[email protected]>
Signed-off-by: Kai-Uwe Hermann <[email protected]>
lib/everest.cpp
Outdated
@@ -71,7 +71,8 @@ Everest::Everest(std::string module_id_, const Config& config_, bool validate_da | |||
// setup error_manager_req_global if enabled + error_database + error_state_monitor | |||
if (this->module_manifest.contains("enable_global_errors") && | |||
this->module_manifest.at("enable_global_errors").get<bool>()) { | |||
std::shared_ptr<error::ErrorDatabaseMap> global_error_database = std::make_shared<error::ErrorDatabaseMap>(); | |||
const std::shared_ptr<error::ErrorDatabaseMap>& global_error_database = |
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.
This shouldn't be a reference, also auto
can be used here.
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.
fixed
lib/everest.cpp
Outdated
@@ -90,7 +91,7 @@ Everest::Everest(std::string module_id_, const Config& config_, bool validate_da | |||
// setup error_managers, error_state_monitors, error_factories and error_databases for all implementations | |||
for (const std::string& impl : Config::keys(this->module_manifest.at("provides"))) { | |||
// setup shared database | |||
std::shared_ptr<error::ErrorDatabaseMap> error_database = std::make_shared<error::ErrorDatabaseMap>(); | |||
const std::shared_ptr<error::ErrorDatabaseMap> error_database = std::make_shared<error::ErrorDatabaseMap>(); |
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.
auto
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.
changed to auto
lib/message_queue.cpp
Outdated
@@ -70,7 +70,7 @@ MessageHandler::MessageHandler() : running(true) { | |||
std::vector<std::shared_ptr<TypedHandler>> local_handlers; | |||
{ | |||
const std::lock_guard<std::mutex> handlers_lock(handler_list_mutex); | |||
for (auto handler : this->handlers) { | |||
for (const auto& handler : this->handlers) { |
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.
use local_handlers = this->handlers
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.
this->handlers is a unordered_set, so just a copy-assignment to the local_handlers vector doesn't work, that's probably why this is done this way
Signed-off-by: Kai-Uwe Hermann <[email protected]>
Signed-off-by: Kai-Uwe Hermann <[email protected]>
Signed-off-by: Kai-Uwe Hermann <[email protected]>
Signed-off-by: Kai-Uwe Hermann <[email protected]>
Signed-off-by: Kai-Uwe Hermann <[email protected]>