-
Notifications
You must be signed in to change notification settings - Fork 62
Add clang-tidy config and associated fixes #1146
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Prefer .empty() to .size() == 0 in generated messages Remove include that is not needed from 1.6 ocpp types Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
…) == 0 Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Keeping the behavior the same, but the algorithm looks suspicious Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
mlitre
left a comment
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.
I've reviewed until include/ocpp/v16/charge_point_configuration.hpp excluded.
| private: | ||
| system_time_point start_point; | ||
| std::chrono::seconds call_interval; | ||
| std::chrono::seconds call_interval = std::chrono::seconds(0); |
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.
I am guessing the behavior is that the timer doesn't start when the interval is 0, I just want to confirm though
| int transaction_message_attempts; | ||
| int transaction_message_retry_interval; // seconds | ||
| int transaction_message_attempts = 0; | ||
| int transaction_message_retry_interval = 0; // seconds |
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.
Same here, is 0 a correct default?
| // threshold for the accumulated sizes of the queues; if the queues exceed this limit, | ||
| // messages are potentially dropped in accordance with OCPP 2.0.1. Specification (cf. QueueAllMessages parameter) | ||
| int queues_total_size_threshold; | ||
| int queues_total_size_threshold = 0; |
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.
Maybe we should increase this default
|
|
||
| struct StateOfCharge { | ||
| float value; ///< State of Charge in percent | ||
| float value = 0; ///< State of Charge in percent |
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.
Wondering as well if these are the correct defaults to have here?
| static const uint16_t uri_default_port = 80; | ||
| /// Default port for wss:// | ||
| static uint16_t const uri_default_secure_port = 443; | ||
| static const uint16_t uri_default_secure_port = 443; |
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.
Jumping on something I saw, maybe we should use std::uint16_t?
| namespace { | ||
| /// | ||
| /// \brief Check if one of the connectors of the evse is available (both connectors faulted or unavailable or on of | ||
| /// the connectors occupied). | ||
| /// \param evse Evse to check. | ||
| /// \return True if at least one connector is not faulted or unavailable. | ||
| /// | ||
| bool is_evse_connector_available(EvseInterface& evse); | ||
| } // namespace |
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.
Why not just put the implementation directly here?
| /// \brief validates that the given \p profile from a RequestStartTransactionRequest is of the correct type | ||
| /// TxProfile | ||
| ProfileValidationResultEnum validate_request_start_transaction_profile(const ChargingProfile& profile); | ||
|
|
||
| /// \brief sets attributes of the given \p charging_schedule_period according to the specification. | ||
| /// 2.11. ChargingSchedulePeriodType if absent numberPhases set to 3 | ||
| void conform_schedule_number_phases(int32_t profile_id, ChargingSchedulePeriod& charging_schedule_period); | ||
|
|
||
| /// | ||
| /// \brief sets attributes of the given \p profile according to the specification. | ||
| /// 2.10. ChargingProfileType validFrom if absent set to current date | ||
| /// 2.10. ChargingProfileType validTo if absent set to max date | ||
| /// | ||
| void conform_validity_periods(ChargingProfile& profile); |
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.
Why not just move the definitions here directly?
| namespace v2 { | ||
| AverageMeterValues::AverageMeterValues() { | ||
| namespace { | ||
| bool is_avg_meas(const SampledValue& sample); |
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.
Same here
|
|
||
| Websocket::~Websocket() { | ||
| } | ||
| Websocket::~Websocket() = default; |
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.
Let's just define default in the header file
|
|
||
| for (uint32_t i = 1; i <= number_of_connectors; ++i) { | ||
| Connector* connector; | ||
| const Connector* connector = nullptr; |
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.
Why is this const, we set the value two lines below
|
|
||
| bool EvseManager::does_connector_exist(const int32_t evse_id, const CiString<20> connector_type) const { | ||
| const EvseInterface* evse; | ||
| const EvseInterface* evse = nullptr; |
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.
We should probably set this to not const
| try { | ||
| stop_monitoring(); | ||
| } catch (...) { | ||
| return; |
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.
Let's add a log
|
|
||
| ocpp::v2::Bidirectional::~Bidirectional() { | ||
| } | ||
| ocpp::v2::Bidirectional::~Bidirectional() = default; |
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.
Let's move this to the header
| {% if namespace == "v16" %} | ||
| #include <ocpp/v16/types.hpp> | ||
| {% endif %} |
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.
Isn't this still required?
Describe your changes
Issue ticket number and link
Checklist before requesting a review