A source file is included with #include, as "parser.cpp"

tx0/cpp:source-file-includedrecommendedwarningmaintainability/designdepth fastsmell

What it finds

Including a .cpp file compiles its definitions into the including file; if the included file is also compiled on its own, every non-inline definition exists twice and the link fails or, with static, the program holds two copies. Shared declarations belong in a header.

From the rule's source, source_file_included.rs.

Turn it on, off or suppress it

The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/cpp:source-file-included" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/cpp:source-file-included] reason="..."

tx0 explain tx0/cpp:source-file-included shows the same in the terminal. Found a false positive? Report it.