Track all source files in the source directory
Feature/behavior summary
With the modern interface, only files that are explicitly listed in a compilation database are known to CBI. Consequently, source files that are completely unused do not show up in the "Unused" category.
Request attributes
- [ ] Would this be a refactor of existing code?
- [ ] Does this proposal require new package dependencies?
- [ ] Would this change break backwards compatibility?
Related issues
No response
Solution description
The solution is to walk the contents of the source directory and keep track of all files that are recognized as source (based on their extension). It probably makes sense to perform this as a separate step, since we may want to suppress warnings relating to such files -- if they're normally unused, they might not actually be valid.
Additional notes
No response
I've started prototyping this. One interesting side effect of tracking all code in the source directory is that it can pick up unexpected files (e.g., C++ files automatically generated by CMake) if the build directory is located in the directory where codebasin is run.
We need to think about this more, as there are a few solutions I can think of:
- Require the user to specify an exclude pattern for their build directories (
-x build/) - Require the user to specify a source directory (
-S src/) - Automatically exclude files we believe to be autogenerated (e.g.,
CMakeFiles/\d+\.\d+\.\d+/**)