chore: Implement editorconfig

This commit is contained in:
2025-09-11 12:38:47 +02:00
parent cce36d567f
commit 2f9709b235
3 changed files with 93 additions and 24 deletions

75
.editorconfig Executable file
View File

@@ -0,0 +1,75 @@
[*]
cpp_indent_braces=false
cpp_indent_multi_line_relative_to=innermost_parenthesis
cpp_indent_within_parentheses=indent
cpp_indent_preserve_within_parentheses=true
cpp_indent_case_labels=true
cpp_indent_case_contents=true
cpp_indent_case_contents_when_block=false
cpp_indent_lambda_braces_when_parameter=true
cpp_indent_goto_labels=one_left
cpp_indent_preprocessor=leftmost_column
cpp_indent_access_specifiers=false
cpp_indent_namespace_contents=false
cpp_indent_preserve_comments=false
cpp_new_line_before_open_brace_namespace=false
cpp_new_line_before_open_brace_type=false
cpp_new_line_before_open_brace_function=ignore
cpp_new_line_before_open_brace_block=ignore
cpp_new_line_before_open_brace_lambda=ignore
cpp_new_line_scope_braces_on_separate_lines=false
cpp_new_line_close_brace_same_line_empty_type=false
cpp_new_line_close_brace_same_line_empty_function=false
cpp_new_line_before_catch=false
cpp_new_line_before_else=false
cpp_new_line_before_while_in_do_while=false
cpp_space_before_function_open_parenthesis=remove
cpp_space_within_parameter_list_parentheses=false
cpp_space_between_empty_parameter_list_parentheses=false
cpp_space_after_keywords_in_control_flow_statements=true
cpp_space_within_control_flow_statement_parentheses=false
cpp_space_before_lambda_open_parenthesis=false
cpp_space_within_cast_parentheses=false
cpp_space_after_cast_close_parenthesis=false
cpp_space_within_expression_parentheses=false
cpp_space_before_block_open_brace=true
cpp_space_between_empty_braces=false
cpp_space_before_initializer_list_open_brace=true
cpp_space_within_initializer_list_braces=true
cpp_space_preserve_in_initializer_list=true
cpp_space_before_open_square_bracket=false
cpp_space_within_square_brackets=false
cpp_space_before_empty_square_brackets=false
cpp_space_between_empty_square_brackets=false
cpp_space_group_square_brackets=true
cpp_space_within_lambda_brackets=false
cpp_space_between_empty_lambda_brackets=false
cpp_space_before_comma=false
cpp_space_after_comma=true
cpp_space_remove_around_member_operators=true
cpp_space_before_inheritance_colon=true
cpp_space_before_constructor_colon=true
cpp_space_remove_before_semicolon=true
cpp_space_after_semicolon=true
cpp_space_remove_around_unary_operator=true
cpp_space_around_binary_operator=insert
cpp_space_around_assignment_operator=insert
cpp_space_pointer_reference_alignment=left
cpp_space_around_ternary_operator=insert
cpp_wrap_preserve_blocks=one_liners
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

View File

@@ -6,7 +6,7 @@
* Changelog:
* [04-09-2025] Wessel T:
* - Implement template
* [11-09-2025] Wessel T:
* [11-09-2025] Wessel T:
* - Remove unused imports
* - Wrap into namespace
*/

View File

@@ -1,12 +1,11 @@
/* les1/subscriber.cpp
/* les1.cpp
* Assignment done in the first lesson explaining
* the basics of ROS2
*
* Reviewed by: <x>
* Changelog:
* [04-09-2025] Wessel T:
* - Implement template
* - Wrap into namespace
* - Implement template
*/
#include <cstdlib>
@@ -18,26 +17,23 @@
using namespace std::placeholders;
namespace lessons::one::pubsub {
class NodeSubscriber : public rclcpp::Node {
class NodeLes1Subscriber : public rclcpp::Node {
public:
NodeSubscriber()
: Node("node_les1_subscriber")
{
subscriber_location_ =
this->create_subscription<geometry_msgs::msg::Point>(
"location", 10,
std::bind(&NodeSubscriber::sub_callback_location, this, _1)
);
NodeLes1Subscriber()
: Node("node_les1_subscriber")
{
subscriber_location_ =
this->create_subscription<geometry_msgs::msg::Point>(
"location", 10,
std::bind(&NodeLes1Subscriber::sub_callback_location, this, _1)
);
subscriber_hw_status_ =
this->create_subscription<les_interface::msg::HardwareStatus>(
"hardware_status", 10,
std::bind(&NodeSubscriber::sub_callback_hw_status, this, _1)
);
subscriber_hw_status_ =
this->create_subscription<les_interface::msg::HardwareStatus>(
"hardware_status", 10,
std::bind(&NodeLes1Subscriber::sub_callback_hw_status, this, _1)
);
}
void sub_callback_location(const geometry_msgs::msg::Point::SharedPtr msg) {
@@ -59,12 +55,10 @@ private:
rclcpp::Subscription<les_interface::msg::HardwareStatus>::SharedPtr subscriber_hw_status_;
};
} // namespace lessons::one::pubsub
int main(int argc,char *argv[]) {
rclcpp::init(argc,argv);
auto node = std::make_shared<lessons::one::pubsub::NodeSubscriber>();
auto node = std::make_shared<NodeLes1Subscriber>();
rclcpp::spin(node);
rclcpp::shutdown();