Hi all, I’ve posted a pull request <https://github.com/apache/trafficserver/pull/770> that integrates clang-tidy into the build. The usual way to do this is to use the bear tool to build a JSON compilation database, however that has a couple of drawbacks. First, dynamic library preloading is disabled by default on OS X and some Linux configurations. Second, the database only contains files you actually build (ie. no header files).
The approach in the PR is to add a ‘tidy’ target to all the makefiles which uses the locally defined compiler arguments to tidy every source file, including headers. Now, this goes horribly wrong in some places (eg. iocore) because our headers are not self-contained. clang-tidy cannot parse the incomplete header file and does not make any of the changes we want. If we force it to continue despite the errors, it can make incorrect source changes. So, should we try to make all our headers self-contained so that clang-tidy can process them? This probably would involve somewhat extensive header refactoring. I’d appreciate any feedback (and volunteers!) … cheers, James