A header says using namespace outside any function, which brings the names into every file that includes it

tx0/cpp:using-namespace-in-headerrecommendedwarningmaintainability/designdepth fastsmell, maintainability

What it finds

A using namespace directive at namespace scope in a header applies to every file that includes the header, where it can make names ambiguous or change which overload is called. Inside a function, or in a source file, it stays local. Namespaces of literals, as std::literals, are left alone.

From the rule's source, using_namespace_in_header.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:using-namespace-in-header" = "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:using-namespace-in-header] reason="..."

tx0 explain tx0/cpp:using-namespace-in-header shows the same in the terminal. Found a false positive? Report it.