-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
[ci] run include-what-you-use
in CI
#6284
Comments
I tried this on my mac tonight. Installed with Homebrew. brew install include-what-you-use Then ran the following (compiler = cmake \
-B build \
-S . \
-DCMAKE_C_INCLUDE_WHAT_YOU_USE=include-what-you-use \
-DCMAKE_CXX_INCLUDE_WHAT_YOU_USE=include-what-you-use
cmake \
--build build \
--target _lightgbm \
2>&1 \
| tee ./logs.txt \
| cat That generated a lot of recommendations. logs.txt (click me)
|
Ah, I thought that |
I spent about 2 hours trying to make it work in our CI, but unfortunately I wasn't able to make it output anything. What I've done:
here Line 4 in 31205fc
Line 88 in 31205fc
Line 108 in 31205fc
And after all these changes and multiple versions of
|
As an alternative I think we can try clang-tidy's Some refs.:
Logs:
|
Thanks for trying this out! Some time, I'll try this again (as I was able to get it working on my mac back in #6284 (comment) Separately... I'd support trying to get Some RAPIDS projects have recently started adopting that tool and it seems helpful to me, e.g. https://github.com/rapidsai/legate-boost/pull/186/files#diff-4d2a8eefdf2a9783512a35da4dc7676a66404b6f3826a8af9aad038722da6823 |
As a next step I'll
In case of success, I'll prepare a PR with |
Unfortunately, |
Summary
In early 2024, the R package was almost archived on CRAN because of a compiler warning from
clang-18
resulting from an unnecessary#include <string>
.ref: #6264
This project should test running
include-what-you-use
(https://github.com/include-what-you-use/include-what-you-use) in CI to catch such things earlier.Motivation
Removing unused includes in C/C++ code could have the following benefits:
Description
Consider adding that to the
cpp_tests
CI jobs, and maybe to the R-package CMake CI jobs.Try reverting the change from #6265 and test if
include-what-you-use
would have caught it.References
See the documentation at https://github.com/include-what-you-use/include-what-you-use?tab=readme-ov-file#using-with-cmake.
The text was updated successfully, but these errors were encountered: