-
Notifications
You must be signed in to change notification settings - Fork 107
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_clang_tidy: No compilation database files found #283
Comments
Based on how it works I believe that error is being caused by it being executed from some working driectory where searching for compile_commands.json is failing. If you look at the documentation for running it directly (https://github.com/ament/ament_lint/blob/master/ament_clang_tidy/doc/index.rst) you see there is a positional argument to pass in the path to use for the search for the compile_commands.json files. I've been looking around for how to pass arguemnts into the cmake ament linters and I've yet to figure it out. |
Based on this line:
It looks like the cmake function find_package(ament_cmake REQUIRED)
if(BUILD_TESTING)
find_package(ament_clang_tidy REQUIRED)
ament_clang_tidy(${CMAKE_BINARY_DIR})
endif() I haven't tested this and it is contrary to the documentation for ament_cmake_clang_tidy (https://github.com/ament/ament_lint/blob/master/ament_cmake_clang_tidy/doc/index.rst) as I added the argument |
Looking over the code for |
I tested this in my workspace and I needed this to run clang-tidy: find_package(ament_cmake REQUIRED)
if(BUILD_TESTING)
find_package(ament_cmake_clang_tidy REQUIRED)
ament_clang_tidy(${CMAKE_BINARY_DIR})
endif() Note there is yet one more difference between this and the instructions. I needed to find_package on the cmake package. The one with the binary The next thing that is broken (and relates to all my other PRs and issues around this) is that there is no way to configure the timeout of this test. It runs for the default 60sec and fails every time. Adding it to a relatively simple ros package (moveit_servo) for testing that only has a handful of compilation units causes it to timeout consistently locally. Is anyone else using this linter? Am I just trying to use it wrong? |
I don't believe |
It does indeed look like there is no way to specify a TIMEOUT:
ament_add_test under the hood which does support a TIMEOUT, so it should be a simple matter of adding a TIMEOUT parameter to the ament_clang_tidy cmake function.
Right, that's exactly the case. Anything we add to the default will have to be fixed across all of the ROS 2 core packages, plus anything downstream that is using it. We can certainly consider doing that, but it would take some dedicated effort and we would have to do it long before the next release. |
Can we still add |
We could do something like that. Before we go down that road, I'm curious to see what the situation would be if we just enabled it on the core packages. |
Sounds good. I'll try to get something implemented by end of next week. |
Let me know if I can help with this. I imagine you are going to discover with any large codebase running clang-tidy will take ~10x the time it takes to build and very few people would be happy about that in the CI system. |
If that is really the case, enabling it by default is a non-starter. Our overnight jobs already take somewhere around 4 hours to run, so we couldn't add something that made them take 40 hours. I think it is still worthwhile to see what the actual penalty is, but I just want to set expectations. |
If I do a full run of clang-tidy over all of the moveit repo (even with --jobs 8) on my laptop it takes ~2 hours. A full build without a fresh cache is about 20min. This is the reason for our approach of only running it over packages with changes in a given PR. |
It's unclear to me how to run clang-tidy in addition to the
ament_lint_common
linter suite. I'm building my package with--cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=1
, which createsbuild/compilation_database.json
, butament_cmake_clang_tidy
doesn't seem to pick it up and instead gives the error in the title.In
CMakeLists.txt
, I haveand in
package.xml
Is something missing there?
The text was updated successfully, but these errors were encountered: