Skip to content
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

[ament_cmake_uncrustify] Add ament_cmake_uncrustify_LANGUAGE variable #384

Open
wants to merge 1 commit into
base: rolling
Choose a base branch
from

Conversation

aprotyas
Copy link
Contributor

@aprotyas aprotyas commented May 24, 2022

In drafting a feature PR for #343, I noticed that the linter hook for
uncrustify is quite bare-bones. As such, providing arguments (such as
the linter language) is cumbersome in comparison to other linters, like
cppcheck.

This is especially pronounced when used in conjuction with
ament_lint_auto, because if users are linting C++ code, they will have
to use the interface exposed at the hook to override uncrustify's
language.

This PR standardizes the interface to manually specify the language for
linters such as cppcheck and uncrustify, such that the necessary CMake
code can look like:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f6a8bb3..f71e803 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,7 +19,7 @@ if(BUILD_TESTING)

   set(ament_cmake_cppcheck_LANGUAGE c++)
-  set(ament_cmake_uncrustify_ADDITIONAL_ARGS "--language c++")
+  set(ament_cmake_uncrustify_LANGUAGE c++)

 endif()

Signed-off-by: Abrar Rahman Protyasha [email protected]

This standardizes the interface to manually specify the language for
linters such as cppcheck and uncrustify, such that the necessary CMake
code can look like:

```diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f6a8bb3..f71e803 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,7 +19,7 @@ if(BUILD_TESTING)

   set(ament_cmake_cppcheck_LANGUAGE c++)
-  set(ament_cmake_uncrustify_ADDITIONAL_ARGS "--language c++")
+  set(ament_cmake_uncrustify_LANGUAGE c++)

 endif()
```

Signed-off-by: Abrar Rahman Protyasha <[email protected]>
@aprotyas aprotyas force-pushed the add_ament_cmake_uncrustify_language_variable branch from f2e276e to 682fe64 Compare May 24, 2022 18:54
@audrow audrow changed the base branch from master to rolling June 28, 2022 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants