diff options
author | Haojian Wu <hokein@google.com> | 2019-01-25 10:03:49 +0000 |
---|---|---|
committer | Haojian Wu <hokein@google.com> | 2019-01-25 10:03:49 +0000 |
commit | c67dab5bd0a1ca14dcacc9d27166bc555044d16f (patch) | |
tree | 362053ed769a168b44e70d9101651c402003a4a2 /clang-tools-extra/clang-tidy/google/AvoidUnderscoreInGoogletestNameCheck.h | |
parent | 914e838e636d44c9798e790535bacec04a16b0d5 (diff) | |
download | bcm5719-llvm-c67dab5bd0a1ca14dcacc9d27166bc555044d16f.tar.gz bcm5719-llvm-c67dab5bd0a1ca14dcacc9d27166bc555044d16f.zip |
[clang-tidy] Add check for underscores in googletest names.
Summary: Adds a clang-tidy warning for underscores in googletest names.
Patch by Kar Epker!
Reviewers: hokein, alexfh, aaron.ballman
Reviewed By: hokein
Subscribers: Eugene.Zelenko, JonasToth, MyDeveloperDay, lebedev.ri, xazax.hun, mgorny, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D56424
llvm-svn: 352183
Diffstat (limited to 'clang-tools-extra/clang-tidy/google/AvoidUnderscoreInGoogletestNameCheck.h')
-rw-r--r-- | clang-tools-extra/clang-tidy/google/AvoidUnderscoreInGoogletestNameCheck.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-tidy/google/AvoidUnderscoreInGoogletestNameCheck.h b/clang-tools-extra/clang-tidy/google/AvoidUnderscoreInGoogletestNameCheck.h new file mode 100644 index 00000000000..8a1a2f2545d --- /dev/null +++ b/clang-tools-extra/clang-tidy/google/AvoidUnderscoreInGoogletestNameCheck.h @@ -0,0 +1,33 @@ +//===--- AvoidUnderscoreInGoogletestNameCheck.h - clang-tidy ----*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_AVOIDUNDERSCOREINGOOGLETESTNAMECHECK_H +#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_AVOIDUNDERSCOREINGOOGLETESTNAMECHECK_H + +#include "../ClangTidy.h" + +namespace clang { +namespace tidy { +namespace google { +namespace readability { + +// Check for underscores in the names of googletest tests, per +// https://github.com/google/googletest/blob/master/googletest/docs/faq.md#why-should-test-suite-names-and-test-names-not-contain-underscore +class AvoidUnderscoreInGoogletestNameCheck : public ClangTidyCheck { +public: + using ClangTidyCheck::ClangTidyCheck; + + void registerPPCallbacks(CompilerInstance &Compiler) override; +}; + +} // namespace readability +} // namespace google +} // namespace tidy +} // namespace clang + +#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_AVOIDUNDERSCOREINGOOGLETESTNAMECHECK_H |