diff --git a/rclcpp/minimal_action_client/CMakeLists.txt b/rclcpp/minimal_action_client/CMakeLists.txt index 4404a0f1..5ee389eb 100644 --- a/rclcpp/minimal_action_client/CMakeLists.txt +++ b/rclcpp/minimal_action_client/CMakeLists.txt @@ -39,6 +39,11 @@ ament_target_dependencies(action_client_not_composable_with_feedback "rclcpp_action" "example_interfaces") +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + ament_lint_auto_find_test_dependencies() +endif() + install(TARGETS action_client_member_functions action_client_not_composable diff --git a/rclcpp/minimal_action_client/package.xml b/rclcpp/minimal_action_client/package.xml index c9e80b77..8307b0e0 100644 --- a/rclcpp/minimal_action_client/package.xml +++ b/rclcpp/minimal_action_client/package.xml @@ -14,8 +14,10 @@ rclcpp rclcpp_action + ament_lint_auto + ament_lint_common + ament_cmake - diff --git a/rclcpp/minimal_action_server/CMakeLists.txt b/rclcpp/minimal_action_server/CMakeLists.txt index 6c0a09e5..eea672e6 100644 --- a/rclcpp/minimal_action_server/CMakeLists.txt +++ b/rclcpp/minimal_action_server/CMakeLists.txt @@ -27,6 +27,11 @@ ament_target_dependencies(action_server_not_composable "rclcpp_action" "example_interfaces") +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + ament_lint_auto_find_test_dependencies() +endif() + install(TARGETS action_server_not_composable action_server_member_functions diff --git a/rclcpp/minimal_action_server/package.xml b/rclcpp/minimal_action_server/package.xml index bee4f6ec..e8c19893 100644 --- a/rclcpp/minimal_action_server/package.xml +++ b/rclcpp/minimal_action_server/package.xml @@ -14,8 +14,10 @@ rclcpp rclcpp_action + ament_lint_auto + ament_lint_common + ament_cmake - diff --git a/rclcpp/minimal_client/CMakeLists.txt b/rclcpp/minimal_client/CMakeLists.txt index eb51bef3..18001ddf 100644 --- a/rclcpp/minimal_client/CMakeLists.txt +++ b/rclcpp/minimal_client/CMakeLists.txt @@ -20,4 +20,9 @@ ament_target_dependencies(client_main rclcpp example_interfaces) install(TARGETS client_main DESTINATION lib/${PROJECT_NAME}) +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + ament_lint_auto_find_test_dependencies() +endif() + ament_package() diff --git a/rclcpp/minimal_client/package.xml b/rclcpp/minimal_client/package.xml index c0a82157..a2168552 100644 --- a/rclcpp/minimal_client/package.xml +++ b/rclcpp/minimal_client/package.xml @@ -17,8 +17,10 @@ rclcpp example_interfaces + ament_lint_auto + ament_lint_common + ament_cmake - diff --git a/rclcpp/minimal_composition/CMakeLists.txt b/rclcpp/minimal_composition/CMakeLists.txt index aaa0c5d5..91cefb06 100644 --- a/rclcpp/minimal_composition/CMakeLists.txt +++ b/rclcpp/minimal_composition/CMakeLists.txt @@ -28,8 +28,7 @@ ament_target_dependencies(composition_nodes rclcpp rclcpp_components std_msgs) # Export the library path to ensure that the installed libraries are available. if(NOT WIN32) ament_environment_hooks( - "${ament_cmake_package_templates_ENVIRONMENT_HOOK_LIBRARY_PATH}" - ) + "${ament_cmake_package_templates_ENVIRONMENT_HOOK_LIBRARY_PATH}") endif() add_executable(composition_publisher src/standalone_publisher.cpp) @@ -58,4 +57,9 @@ install(TARGETS composition_composed DESTINATION lib/${PROJECT_NAME}) +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + ament_lint_auto_find_test_dependencies() +endif() + ament_package() diff --git a/rclcpp/minimal_composition/package.xml b/rclcpp/minimal_composition/package.xml index a87bc689..498ae94f 100644 --- a/rclcpp/minimal_composition/package.xml +++ b/rclcpp/minimal_composition/package.xml @@ -20,6 +20,9 @@ rclcpp_components std_msgs + ament_lint_auto + ament_lint_common + ament_cmake diff --git a/rclcpp/minimal_publisher/CMakeLists.txt b/rclcpp/minimal_publisher/CMakeLists.txt index 3344f140..caea7b49 100644 --- a/rclcpp/minimal_publisher/CMakeLists.txt +++ b/rclcpp/minimal_publisher/CMakeLists.txt @@ -30,4 +30,9 @@ install(TARGETS DESTINATION lib/${PROJECT_NAME} ) +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + ament_lint_auto_find_test_dependencies() +endif() + ament_package() diff --git a/rclcpp/minimal_publisher/package.xml b/rclcpp/minimal_publisher/package.xml index 6944c17d..09f4beae 100644 --- a/rclcpp/minimal_publisher/package.xml +++ b/rclcpp/minimal_publisher/package.xml @@ -17,8 +17,10 @@ rclcpp std_msgs + ament_lint_auto + ament_lint_common + ament_cmake - diff --git a/rclcpp/minimal_service/CMakeLists.txt b/rclcpp/minimal_service/CMakeLists.txt index d474c498..88d6d8d4 100644 --- a/rclcpp/minimal_service/CMakeLists.txt +++ b/rclcpp/minimal_service/CMakeLists.txt @@ -20,4 +20,9 @@ ament_target_dependencies(service_main rclcpp example_interfaces) install(TARGETS service_main DESTINATION lib/${PROJECT_NAME}) +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + ament_lint_auto_find_test_dependencies() +endif() + ament_package() diff --git a/rclcpp/minimal_service/package.xml b/rclcpp/minimal_service/package.xml index 62d8496f..50de4620 100644 --- a/rclcpp/minimal_service/package.xml +++ b/rclcpp/minimal_service/package.xml @@ -17,8 +17,10 @@ rclcpp example_interfaces + ament_lint_auto + ament_lint_common + ament_cmake - diff --git a/rclcpp/minimal_subscriber/CMakeLists.txt b/rclcpp/minimal_subscriber/CMakeLists.txt index bcff7fa3..c531334a 100644 --- a/rclcpp/minimal_subscriber/CMakeLists.txt +++ b/rclcpp/minimal_subscriber/CMakeLists.txt @@ -29,4 +29,9 @@ install(TARGETS subscriber_not_composable DESTINATION lib/${PROJECT_NAME}) +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + ament_lint_auto_find_test_dependencies() +endif() + ament_package() diff --git a/rclcpp/minimal_subscriber/package.xml b/rclcpp/minimal_subscriber/package.xml index 2ef2ebd7..33db87d9 100644 --- a/rclcpp/minimal_subscriber/package.xml +++ b/rclcpp/minimal_subscriber/package.xml @@ -17,8 +17,10 @@ rclcpp std_msgs + ament_lint_auto + ament_lint_common + ament_cmake - diff --git a/rclcpp/minimal_timer/CMakeLists.txt b/rclcpp/minimal_timer/CMakeLists.txt index 72be805b..f44e8f74 100644 --- a/rclcpp/minimal_timer/CMakeLists.txt +++ b/rclcpp/minimal_timer/CMakeLists.txt @@ -25,4 +25,9 @@ install(TARGETS DESTINATION lib/${PROJECT_NAME} ) +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + ament_lint_auto_find_test_dependencies() +endif() + ament_package() diff --git a/rclcpp/minimal_timer/package.xml b/rclcpp/minimal_timer/package.xml index 600454ef..f1fcc16d 100644 --- a/rclcpp/minimal_timer/package.xml +++ b/rclcpp/minimal_timer/package.xml @@ -15,8 +15,10 @@ rclcpp + ament_lint_auto + ament_lint_common + ament_cmake - diff --git a/rclpy/actions/minimal_action_client/examples_rclpy_minimal_action_client/client_cancel.py b/rclpy/actions/minimal_action_client/examples_rclpy_minimal_action_client/client_cancel.py index 2ea462fa..5258faf2 100644 --- a/rclpy/actions/minimal_action_client/examples_rclpy_minimal_action_client/client_cancel.py +++ b/rclpy/actions/minimal_action_client/examples_rclpy_minimal_action_client/client_cancel.py @@ -12,14 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -from action_msgs.msg import GoalStatus from example_interfaces.action import Fibonacci import rclpy from rclpy.action import ActionClient -from rclpy.callback_groups import ReentrantCallbackGroup from rclpy.node import Node -from rclpy.timer import WallTimer class MinimalActionClient(Node): diff --git a/rclpy/actions/minimal_action_client/examples_rclpy_minimal_action_client/client_not_composable.py b/rclpy/actions/minimal_action_client/examples_rclpy_minimal_action_client/client_not_composable.py index 402006f9..26af729b 100644 --- a/rclpy/actions/minimal_action_client/examples_rclpy_minimal_action_client/client_not_composable.py +++ b/rclpy/actions/minimal_action_client/examples_rclpy_minimal_action_client/client_not_composable.py @@ -18,7 +18,6 @@ import rclpy from rclpy.action import ActionClient -from rclpy.node import Node def feedback_cb(logger, feedback): diff --git a/rclpy/actions/minimal_action_client/test/test_copyright.py b/rclpy/actions/minimal_action_client/test/test_copyright.py new file mode 100644 index 00000000..89590884 --- /dev/null +++ b/rclpy/actions/minimal_action_client/test/test_copyright.py @@ -0,0 +1,24 @@ +# Copyright 2017 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_copyright.main import main +import pytest + + +@pytest.mark.copyright +@pytest.mark.linter +def test_copyright(): + # Test is called from package root + rc = main(argv=['.']) + assert rc == 0, 'Found errors' diff --git a/rclpy/actions/minimal_action_client/test/test_flake8.py b/rclpy/actions/minimal_action_client/test/test_flake8.py new file mode 100644 index 00000000..0202d1cc --- /dev/null +++ b/rclpy/actions/minimal_action_client/test/test_flake8.py @@ -0,0 +1,24 @@ +# Copyright 2017 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_flake8.main import main +import pytest + + +@pytest.mark.flake8 +@pytest.mark.linter +def test_flake8(): + # Test is called from package root + rc = main(argv=['.']) + assert rc == 0, 'Found errors' diff --git a/rclpy/actions/minimal_action_client/test/test_pep257.py b/rclpy/actions/minimal_action_client/test/test_pep257.py new file mode 100644 index 00000000..18a66da2 --- /dev/null +++ b/rclpy/actions/minimal_action_client/test/test_pep257.py @@ -0,0 +1,24 @@ +# Copyright 2017 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_pep257.main import main +import pytest + + +@pytest.mark.linter +@pytest.mark.pep257 +def test_pep257(): + # Test is called from package root + rc = main(argv=['.']) + assert rc == 0, 'Found code style errors / warnings' diff --git a/rclpy/actions/minimal_action_server/examples_rclpy_minimal_action_server/server.py b/rclpy/actions/minimal_action_server/examples_rclpy_minimal_action_server/server.py index dff96483..47fb42ad 100644 --- a/rclpy/actions/minimal_action_server/examples_rclpy_minimal_action_server/server.py +++ b/rclpy/actions/minimal_action_server/examples_rclpy_minimal_action_server/server.py @@ -42,18 +42,18 @@ def destroy(self): super().destroy_node() def goal_callback(self, goal_request): - """Accepts or rejects a client request to begin an action.""" + """Accept or reject a client request to begin an action.""" # This server allows multiple goals in parallel self.get_logger().info('Received goal request') return GoalResponse.ACCEPT def cancel_callback(self, goal_handle): - """Accepts or rejects a client request to cancel an action.""" + """Accept or reject a client request to cancel an action.""" self.get_logger().info('Received cancel request') return CancelResponse.ACCEPT async def execute_callback(self, goal_handle): - """Executes a goal.""" + """Execute a goal.""" self.get_logger().info('Executing goal...') # Append the seeds for the Fibonacci sequence diff --git a/rclpy/actions/minimal_action_server/examples_rclpy_minimal_action_server/server_defer.py b/rclpy/actions/minimal_action_server/examples_rclpy_minimal_action_server/server_defer.py index 8bcbefba..21c93d4c 100644 --- a/rclpy/actions/minimal_action_server/examples_rclpy_minimal_action_server/server_defer.py +++ b/rclpy/actions/minimal_action_server/examples_rclpy_minimal_action_server/server_defer.py @@ -45,18 +45,18 @@ def destroy(self): super().destroy_node() def goal_callback(self, goal_request): - """Accepts or rejects a client request to begin an action.""" + """Accept or reject a client request to begin an action.""" self.get_logger().info('Received goal request') return GoalResponse.ACCEPT def handle_accepted_callback(self, goal_handle): - """Provides a handle to an accepted goal.""" + """Provide a handle to an accepted goal.""" self.get_logger().info('Deferring execution...') self._goal_handle = goal_handle self._timer = self.create_timer(3.0, self.timer_callback) def cancel_callback(self, goal_handle): - """Accepts or rejects a client request to cancel an action.""" + """Accept or reject a client request to cancel an action.""" self.get_logger().info('Received cancel request') return CancelResponse.ACCEPT @@ -67,7 +67,7 @@ def timer_callback(self): self._timer.cancel() async def execute_callback(self, goal_handle): - """Executes a goal.""" + """Execute a goal.""" self.get_logger().info('Executing goal...') # Append the seeds for the Fibonacci sequence diff --git a/rclpy/actions/minimal_action_server/examples_rclpy_minimal_action_server/server_not_composable.py b/rclpy/actions/minimal_action_server/examples_rclpy_minimal_action_server/server_not_composable.py index 000b6f33..61ef22fc 100644 --- a/rclpy/actions/minimal_action_server/examples_rclpy_minimal_action_server/server_not_composable.py +++ b/rclpy/actions/minimal_action_server/examples_rclpy_minimal_action_server/server_not_composable.py @@ -20,7 +20,6 @@ from rclpy.action import ActionServer, CancelResponse from rclpy.callback_groups import ReentrantCallbackGroup from rclpy.executors import MultiThreadedExecutor -from rclpy.node import Node logger = None @@ -32,7 +31,7 @@ def cancel_callback(goal_handle): async def execute_callback(goal_handle): - """Executes the goal.""" + """Execute the goal.""" logger.info('Executing goal...') # Append the seeds for the fibonacci sequence diff --git a/rclpy/actions/minimal_action_server/examples_rclpy_minimal_action_server/server_queue_goals.py b/rclpy/actions/minimal_action_server/examples_rclpy_minimal_action_server/server_queue_goals.py index df2dfbfb..16270ae6 100644 --- a/rclpy/actions/minimal_action_server/examples_rclpy_minimal_action_server/server_queue_goals.py +++ b/rclpy/actions/minimal_action_server/examples_rclpy_minimal_action_server/server_queue_goals.py @@ -39,17 +39,17 @@ def destroy(self): super().destroy_node() def goal_callback(self, goal_request): - """Accepts or rejects a client request to begin an action.""" + """Accept or reject a client request to begin an action.""" self.get_logger().info('Received goal request') return GoalResponse.ACCEPT def cancel_callback(self, goal_handle): - """Accepts or rejects a client request to cancel an action.""" + """Accept or reject a client request to cancel an action.""" self.get_logger().info('Received cancel request') return CancelResponse.ACCEPT def execute_callback(self, goal_handle): - """Executes a goal.""" + """Execute a goal.""" self.get_logger().info('Executing goal...') # Append the seeds for the Fibonacci sequence diff --git a/rclpy/actions/minimal_action_server/examples_rclpy_minimal_action_server/server_single_goal.py b/rclpy/actions/minimal_action_server/examples_rclpy_minimal_action_server/server_single_goal.py index 21e1b4f4..e7fad810 100644 --- a/rclpy/actions/minimal_action_server/examples_rclpy_minimal_action_server/server_single_goal.py +++ b/rclpy/actions/minimal_action_server/examples_rclpy_minimal_action_server/server_single_goal.py @@ -46,7 +46,7 @@ def destroy(self): super().destroy_node() def goal_callback(self, goal_request): - """Accepts or rejects a client request to begin an action.""" + """Accept or reject a client request to begin an action.""" self.get_logger().info('Received goal request') return GoalResponse.ACCEPT @@ -62,12 +62,12 @@ def handle_accepted_callback(self, goal_handle): goal_handle.execute() def cancel_callback(self, goal): - """Accepts or rejects a client request to cancel an action.""" + """Accept or reject a client request to cancel an action.""" self.get_logger().info('Received cancel request') return CancelResponse.ACCEPT def execute_callback(self, goal_handle): - """Executes the goal.""" + """Execute the goal.""" self.get_logger().info('Executing goal...') # Append the seeds for the Fibonacci sequence diff --git a/rclpy/actions/minimal_action_server/test/test_copyright.py b/rclpy/actions/minimal_action_server/test/test_copyright.py new file mode 100644 index 00000000..89590884 --- /dev/null +++ b/rclpy/actions/minimal_action_server/test/test_copyright.py @@ -0,0 +1,24 @@ +# Copyright 2017 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_copyright.main import main +import pytest + + +@pytest.mark.copyright +@pytest.mark.linter +def test_copyright(): + # Test is called from package root + rc = main(argv=['.']) + assert rc == 0, 'Found errors' diff --git a/rclpy/actions/minimal_action_server/test/test_flake8.py b/rclpy/actions/minimal_action_server/test/test_flake8.py new file mode 100644 index 00000000..0202d1cc --- /dev/null +++ b/rclpy/actions/minimal_action_server/test/test_flake8.py @@ -0,0 +1,24 @@ +# Copyright 2017 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_flake8.main import main +import pytest + + +@pytest.mark.flake8 +@pytest.mark.linter +def test_flake8(): + # Test is called from package root + rc = main(argv=['.']) + assert rc == 0, 'Found errors' diff --git a/rclpy/actions/minimal_action_server/test/test_pep257.py b/rclpy/actions/minimal_action_server/test/test_pep257.py new file mode 100644 index 00000000..18a66da2 --- /dev/null +++ b/rclpy/actions/minimal_action_server/test/test_pep257.py @@ -0,0 +1,24 @@ +# Copyright 2017 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_pep257.main import main +import pytest + + +@pytest.mark.linter +@pytest.mark.pep257 +def test_pep257(): + # Test is called from package root + rc = main(argv=['.']) + assert rc == 0, 'Found code style errors / warnings'