diff --git a/.clang-format b/.clang-format index b0bea41e..07eb8ffb 100644 --- a/.clang-format +++ b/.clang-format @@ -1,17 +1,6 @@ --- BasedOnStyle: Google DerivePointerAlignment: false -IncludeBlocks: Regroup -IncludeCategories: - # Headers in "" with extension. - - Regex: '"([A-Za-z0-9.\Q/-_\E])+"' - Priority: 1 - # Headers in <> without extension. - - Regex: '<([A-Za-z0-9\Q/-_\E])+>' - Priority: 2 - # Headers in <> from specific external libraries. - - Regex: '<(catch2|boost|rclcpp.*)\/' - Priority: 3 - # Headers in <> with extension. - - Regex: '<([A-Za-z0-9.\Q/-_\E])+>' - Priority: 4 +IncludeBlocks: Preserve +InsertBraces: true +--- diff --git a/.github/workflows/format.yaml b/.github/workflows/format.yaml index 7045141c..594b13cd 100644 --- a/.github/workflows/format.yaml +++ b/.github/workflows/format.yaml @@ -1,6 +1,3 @@ -# This is a format job. Pre-commit has a first-party GitHub action, so we use -# that: https://github.com/pre-commit/action - name: Format on: @@ -12,17 +9,6 @@ on: jobs: pre-commit: - name: pre-commit - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - uses: actions/setup-python@v6 - - name: Install clang-format - run: sudo apt-get install clang-format - - uses: pre-commit/action@v3.0.1 - id: precommit - - name: Upload pre-commit changes - if: failure() && steps.precommit.outcome == 'failure' - uses: rhaschke/upload-git-patch-action@main - with: - name: pre-commit + uses: ros-controls/ros2_control_ci/.github/workflows/reusable-pre-commit.yml@master + with: + ros_distro: rolling diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 034f8fbc..fd3eb430 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,6 +34,7 @@ repos: - id: check-vcs-permalinks - id: check-yaml exclude: generate_parameter_library_py/generate_parameter_library_py/test + args: ["--allow-multiple-documents"] - id: debug-statements - id: destroyed-symlinks - id: detect-private-key @@ -75,3 +76,31 @@ repos: rev: v3.21.2 hooks: - id: pyupgrade + + - repo: local + hooks: + - id: ament_cppcheck + name: ament_cppcheck + description: Static code analysis of C/C++ files. + entry: env AMENT_CPPCHECK_ALLOW_SLOW_VERSIONS=1 ament_cppcheck + language: system + files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$ + - id: ament_cpplint + name: ament_cpplint + description: Static code analysis of C/C++ files. + entry: ament_cpplint + language: system + files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$ + args: ["--linelength=100", "--filter=-whitespace/newline"] + - id: ament_lint_cmake + name: ament_lint_cmake + description: Check format of CMakeLists.txt files. + entry: ament_lint_cmake + language: system + files: CMakeLists\.txt$ + - id: ament_copyright + name: ament_copyright + description: Check if copyright notice is available in all files. + entry: ament_copyright + language: system + exclude: .*/conf\.py$ diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index a61d2c81..24bb416d 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -36,12 +36,6 @@ rclcpp_components_register_node(minimal_publisher ) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - set(ament_cmake_cpplint_FOUND TRUE) # Conflicts with clang-foramt - set(ament_cmake_flake8_FOUND TRUE) # Conflicts with black - set(ament_cmake_uncrustify_FOUND TRUE) # Conflicts with clang-format - ament_lint_auto_find_test_dependencies() - find_package(ament_cmake_gtest REQUIRED) # example_test_gtest add_rostest_with_parameters_gtest(test_example_gtest test/example_test_gtest.cpp diff --git a/example/include/generate_parameter_library_example/example_validators.hpp b/example/include/generate_parameter_library_example/example_validators.hpp index b6aef735..31a8f897 100644 --- a/example/include/generate_parameter_library_example/example_validators.hpp +++ b/example/include/generate_parameter_library_example/example_validators.hpp @@ -28,11 +28,11 @@ #pragma once +#include + #include #include - -#include #include namespace custom_validators { diff --git a/example/include/generate_parameter_library_example/minimal_publisher.hpp b/example/include/generate_parameter_library_example/minimal_publisher.hpp index 10fef024..4e5d94b9 100644 --- a/example/include/generate_parameter_library_example/minimal_publisher.hpp +++ b/example/include/generate_parameter_library_example/minimal_publisher.hpp @@ -28,6 +28,8 @@ #pragma once +#include + #include #include @@ -37,7 +39,8 @@ namespace admittance_controller { class MinimalPublisher : public rclcpp::Node { public: - MinimalPublisher(const rclcpp::NodeOptions& options = rclcpp::NodeOptions()); + explicit MinimalPublisher( + const rclcpp::NodeOptions& options = rclcpp::NodeOptions()); private: void timer_callback(); diff --git a/example/package.xml b/example/package.xml index fbdf40c5..b2998c10 100644 --- a/example/package.xml +++ b/example/package.xml @@ -20,9 +20,6 @@ ament_cmake_core - ament_lint_auto - ament_lint_common - ament_cmake diff --git a/example/test/descriptor_test_gtest.cpp b/example/test/descriptor_test_gtest.cpp index ad349f2f..ed9d5bb8 100644 --- a/example/test/descriptor_test_gtest.cpp +++ b/example/test/descriptor_test_gtest.cpp @@ -29,13 +29,13 @@ // Author: Chance Cardona // +#include +#include + #include "generate_parameter_library_example/admittance_controller_parameters.hpp" #include "gtest/gtest.h" #include "rclcpp/rclcpp.hpp" -#include -#include - class DescriptorTest : public ::testing::Test { public: void SetUp() { diff --git a/example/test/example_test_gmock.cpp b/example/test/example_test_gmock.cpp index 63486c25..d483caf6 100644 --- a/example/test/example_test_gmock.cpp +++ b/example/test/example_test_gmock.cpp @@ -29,12 +29,12 @@ // Author: Denis Štogl // +#include + #include "generate_parameter_library_example/admittance_controller_parameters.hpp" #include "gmock/gmock.h" #include "rclcpp/rclcpp.hpp" -#include - class ExampleTest : public ::testing::Test { public: void SetUp() { diff --git a/example/test/example_test_gtest.cpp b/example/test/example_test_gtest.cpp index fcae688c..74a7a1b5 100644 --- a/example/test/example_test_gtest.cpp +++ b/example/test/example_test_gtest.cpp @@ -29,12 +29,12 @@ // Author: Denis Štogl // +#include + #include "generate_parameter_library_example/admittance_controller_parameters.hpp" #include "gtest/gtest.h" #include "rclcpp/rclcpp.hpp" -#include - class ExampleTest : public ::testing::Test { public: void SetUp() { diff --git a/example_cmake_python/package.xml b/example_cmake_python/package.xml index ba577b4e..4e0459c8 100644 --- a/example_cmake_python/package.xml +++ b/example_cmake_python/package.xml @@ -17,9 +17,6 @@ ament_cmake_python - ament_lint_auto - ament_lint_common - ament_cmake diff --git a/example_external/CMakeLists.txt b/example_external/CMakeLists.txt index 40798728..77eff2cd 100644 --- a/example_external/CMakeLists.txt +++ b/example_external/CMakeLists.txt @@ -50,12 +50,4 @@ install( ament_export_targets(export_generate_parameter_library_example_external HAS_LIBRARY_TARGET) ament_export_dependencies(rclcpp rclcpp_components generate_parameter_library_example) -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - set(ament_cmake_cpplint_FOUND TRUE) # Conflicts with clang-foramt - set(ament_cmake_flake8_FOUND TRUE) # Conflicts with black - set(ament_cmake_uncrustify_FOUND TRUE) # Conflicts with clang-format - ament_lint_auto_find_test_dependencies() -endif() - ament_package() diff --git a/example_external/include/generate_parameter_library_example_external/minimal_publisher_external.hpp b/example_external/include/generate_parameter_library_example_external/minimal_publisher_external.hpp index 6ce7f61f..56cbc92f 100644 --- a/example_external/include/generate_parameter_library_example_external/minimal_publisher_external.hpp +++ b/example_external/include/generate_parameter_library_example_external/minimal_publisher_external.hpp @@ -1,34 +1,30 @@ // Copyright 2025 Forssea Robotics -// // All rights reserved. // -// Software License Agreement (BSD License 2.0) -// // Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. // -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// * Neither the name of the Forssea Robotics nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. +// * Neither the name of the Forssea Robotics nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. // -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. #pragma once diff --git a/example_external/package.xml b/example_external/package.xml index 9327d013..3f25f426 100644 --- a/example_external/package.xml +++ b/example_external/package.xml @@ -20,9 +20,6 @@ ament_cmake_core - ament_lint_auto - ament_lint_common - ament_cmake diff --git a/example_external/src/minimal_publisher_external.cpp b/example_external/src/minimal_publisher_external.cpp index 7b613485..344c1cc8 100644 --- a/example_external/src/minimal_publisher_external.cpp +++ b/example_external/src/minimal_publisher_external.cpp @@ -1,34 +1,30 @@ // Copyright 2025 Forssea Robotics -// // All rights reserved. // -// Software License Agreement (BSD License 2.0) -// // Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. // -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// * Neither the name of the Forssea Robotics nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. +// * Neither the name of the Forssea Robotics nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. // -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. #include "generate_parameter_library_example_external/minimal_publisher_external.hpp" diff --git a/example_python/package.xml b/example_python/package.xml index 9be7bb95..bd69c236 100644 --- a/example_python/package.xml +++ b/example_python/package.xml @@ -15,9 +15,6 @@ generate_parameter_library_py rclpy - ament_copyright - ament_flake8 - ament_pep257 python3-pytest diff --git a/example_python/setup.py b/example_python/setup.py index 16dd94e7..4a73423b 100644 --- a/example_python/setup.py +++ b/example_python/setup.py @@ -1,3 +1,33 @@ +#!/usr/bin/env python3 + +# Copyright 2023 PickNik Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of the PickNik Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + import sys from setuptools import setup diff --git a/example_python/test/test_copyright.py b/example_python/test/test_copyright.py deleted file mode 100644 index d78c79bc..00000000 --- a/example_python/test/test_copyright.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright 2015 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 - - -# Remove the `skip` decorator once the source file(s) have a copyright header -@pytest.mark.skip( - reason='No copyright header has been placed in the generated source file.' -) -@pytest.mark.copyright -@pytest.mark.linter -def test_copyright(): - rc = main(argv=['.', 'test']) - assert rc == 0, 'Found errors' diff --git a/example_python/test/test_flake8.py b/example_python/test/test_flake8.py deleted file mode 100644 index 26030113..00000000 --- a/example_python/test/test_flake8.py +++ /dev/null @@ -1,25 +0,0 @@ -# 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_with_errors -import pytest - - -@pytest.mark.flake8 -@pytest.mark.linter -def test_flake8(): - rc, errors = main_with_errors(argv=[]) - assert rc == 0, 'Found %d code style errors / warnings:\n' % len( - errors - ) + '\n'.join(errors) diff --git a/example_python/test/test_load_modules.py b/example_python/test/test_load_modules.py index 6edf0af4..b729c238 100644 --- a/example_python/test/test_load_modules.py +++ b/example_python/test/test_load_modules.py @@ -1,3 +1,33 @@ +#!/usr/bin/env python3 + +# Copyright 2023 PickNik Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of the PickNik Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + import generate_parameter_module_example print(f'Imported module from: {generate_parameter_module_example.__file__}') diff --git a/example_python/test/test_pep257.py b/example_python/test/test_pep257.py deleted file mode 100644 index b234a384..00000000 --- a/example_python/test/test_pep257.py +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2015 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(): - rc = main(argv=['.', 'test']) - assert rc == 0, 'Found code style errors / warnings' diff --git a/generate_parameter_library/CMakeLists.txt b/generate_parameter_library/CMakeLists.txt index 58b3c65e..8de2af22 100644 --- a/generate_parameter_library/CMakeLists.txt +++ b/generate_parameter_library/CMakeLists.txt @@ -9,14 +9,6 @@ install( DESTINATION share/generate_parameter_library ) -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - set(ament_cmake_cpplint_FOUND TRUE) # Conflicts with clang-foramt - set(ament_cmake_flake8_FOUND TRUE) # Conflicts with black - set(ament_cmake_uncrustify_FOUND TRUE) # Conflicts with clang-format - ament_lint_auto_find_test_dependencies() -endif() - ament_package( CONFIG_EXTRAS "generate_parameter_library-extras.cmake" ) diff --git a/generate_parameter_library/package.xml b/generate_parameter_library/package.xml index 7ad1187c..01d36ce1 100644 --- a/generate_parameter_library/package.xml +++ b/generate_parameter_library/package.xml @@ -26,9 +26,6 @@ tcb_span tl_expected - ament_lint_auto - ament_lint_common - ament_cmake diff --git a/generate_parameter_library_py/generate_parameter_library_py/cpp_conversions.py b/generate_parameter_library_py/generate_parameter_library_py/cpp_conversions.py index 7b8b3d42..ba410a84 100644 --- a/generate_parameter_library_py/generate_parameter_library_py/cpp_conversions.py +++ b/generate_parameter_library_py/generate_parameter_library_py/cpp_conversions.py @@ -1,3 +1,33 @@ +#!/usr/bin/env python3 + +# Copyright 2023 PickNik Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of the PickNik Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + from typing import List, Union from jinja2 import Template from typeguard import typechecked diff --git a/generate_parameter_library_py/generate_parameter_library_py/python_conversions.py b/generate_parameter_library_py/generate_parameter_library_py/python_conversions.py index 37f04055..8185085b 100644 --- a/generate_parameter_library_py/generate_parameter_library_py/python_conversions.py +++ b/generate_parameter_library_py/generate_parameter_library_py/python_conversions.py @@ -1,3 +1,33 @@ +#!/usr/bin/env python3 + +# Copyright 2023 PickNik Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of the PickNik Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + from typing import List, Union from jinja2 import Template from typeguard import typechecked diff --git a/generate_parameter_library_py/generate_parameter_library_py/string_filters_cpp.py b/generate_parameter_library_py/generate_parameter_library_py/string_filters_cpp.py index 1ab82baf..45611c35 100644 --- a/generate_parameter_library_py/generate_parameter_library_py/string_filters_cpp.py +++ b/generate_parameter_library_py/generate_parameter_library_py/string_filters_cpp.py @@ -1,3 +1,34 @@ +#!/usr/bin/env python3 + +# Copyright 2023 PickNik Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of the PickNik Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + + def valid_string_cpp(description): """ Filter a string to make it a valid C++ string literal. diff --git a/generate_parameter_library_py/package.xml b/generate_parameter_library_py/package.xml index f2ff0d18..4b68beae 100644 --- a/generate_parameter_library_py/package.xml +++ b/generate_parameter_library_py/package.xml @@ -17,7 +17,6 @@ python3-typeguard python3-yaml - ament_copyright python3-pytest diff --git a/generate_parameter_library_py/setup.py b/generate_parameter_library_py/setup.py index 7b541f7d..0b641edf 100644 --- a/generate_parameter_library_py/setup.py +++ b/generate_parameter_library_py/setup.py @@ -1,3 +1,33 @@ +#!/usr/bin/env python3 + +# Copyright 2023 PickNik Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of the PickNik Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + from setuptools import find_packages from setuptools import setup diff --git a/generate_parameter_library_py/test/test_copyright.py b/generate_parameter_library_py/test/test_copyright.py deleted file mode 100644 index d78c79bc..00000000 --- a/generate_parameter_library_py/test/test_copyright.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright 2015 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 - - -# Remove the `skip` decorator once the source file(s) have a copyright header -@pytest.mark.skip( - reason='No copyright header has been placed in the generated source file.' -) -@pytest.mark.copyright -@pytest.mark.linter -def test_copyright(): - rc = main(argv=['.', 'test']) - assert rc == 0, 'Found errors' diff --git a/parameter_traits/CMakeLists.txt b/parameter_traits/CMakeLists.txt index d4e6d6b2..92ef5423 100644 --- a/parameter_traits/CMakeLists.txt +++ b/parameter_traits/CMakeLists.txt @@ -23,14 +23,6 @@ target_link_libraries(parameter_traits tl_expected::tl_expected ) -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following lines skip linters - set(ament_cmake_cpplint_FOUND TRUE) # Conflicts with clang-foramt - set(ament_cmake_uncrustify_FOUND TRUE) # Conflicts with clang-format - ament_lint_auto_find_test_dependencies() -endif() - install( DIRECTORY include/ DESTINATION include/parameter_traits diff --git a/parameter_traits/include/parameter_traits/parameter_traits.hpp b/parameter_traits/include/parameter_traits/parameter_traits.hpp index a44b484e..c59c83a0 100644 --- a/parameter_traits/include/parameter_traits/parameter_traits.hpp +++ b/parameter_traits/include/parameter_traits/parameter_traits.hpp @@ -29,6 +29,10 @@ #pragma once #include + +#include +#include + #include #include diff --git a/parameter_traits/package.xml b/parameter_traits/package.xml index dec28799..5d5eb235 100644 --- a/parameter_traits/package.xml +++ b/parameter_traits/package.xml @@ -20,8 +20,6 @@ tl_expected ament_cmake_gtest - ament_lint_auto - ament_lint_common ament_cmake