Skip to content

[clang-tidy] Add allow list to google-build-using-namespace #144761

Open
@JungPhilipp

Description

@JungPhilipp

The clang-tidy check google-build-using-namespace warns on almost all using namespace x directives.

There seem to exceptions to this rule, one of which are already part of the check. E.g., for (std) literal namespaces. (clang-tools-extra/clang-tidy/google/UsingNamespaceDirectiveCheck.cpp:31).

Many libraries/projects have their own literal namespaces or standard libraries where this exception does not work.
They currently either cannot use the check at all or have to litter the code with //NOLINT comments.

using namespace ::testing from gtest/gmock also seems to be used frequently.

Suggested solution:
Add an allow-list for which namespaces warnings are omitted.
Similar to

  • StringLikeClasses of performance-faster-string-find
  • IgnoredFilesList of misc-header-include-cycle
  • Various options of modernize-use-emplace

I can provide a PR, just wanted to get feedback before putting in the work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang-tidyenhancementImproving things as opposed to bug fixing, e.g. new or missing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions