Skip to main content

W0037 - Unspecific include

Weak Warning

-include("some_header_from_app_a.hrl").
%% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 💡 weak: Unspecific include.

becomes

-include_lib("app_a/include/some_header_from_app_a.hrl").

Explanation

This weak warning is raised when an -include or -include_lib directive uses a bare filename (e.g., "some_header.hrl") without a path, and the included file comes from a different application. This scenario is possible when using a build tool such as buck2.

Why this matters

Using bare filenames in includes can lead to:

  • Ambiguity: Multiple applications might have header files with the same name, making it unclear which file is being included.
  • Fragile builds: The include resolution depends on the include path configuration, which can vary between build environments.
  • Reduced readability: Developers cannot immediately see which application provides the header file.

When this diagnostic fires

The diagnostic is raised when:

  1. The include path does not contain a / (i.e., it's a bare filename)
  2. The included file is from a different application than the source file
  3. The included file is in an include/ directory (not in a src/ directory)