[PATCH] D65917: [clang-tidy] Added check for the Google style guide's category method naming rule.

Eugene Zelenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 7 22:07:48 PDT 2019


Eugene.Zelenko added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/google/RequireCategoryMethodPrefixesCheck.cpp:16
+namespace {
+const char *kCustomCategoryMethodIdentifier = "ThisIsACategoryMethod";
+} // anonymous namespace
----------------
Please use static. See LLVM Coding Guidelines.


================
Comment at: clang-tools-extra/clang-tidy/google/RequireCategoryMethodPrefixesCheck.cpp:58
+  std::string method_name = method_declaration->getNameAsString();
+  auto owning_objc_class_interface = method_declaration->getClassInterface();
+  if (!owning_objc_class_interface) {
----------------
Please don't use auto, unless type presents in same statement or in case of iterators.


================
Comment at: clang-tools-extra/docs/ReleaseNotes.rst:74
+  Warns when Objective-C category method names are not properly prefixed (e.g.
+  gmo_methodName) unless the category is extending a class with a (configurable)
+  whitelisted prefix.
----------------
Please enclose gmo_methodName in double back-ticks.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/google-objc-require-category-method-prefixes.rst:6
+
+Finds method declarations in Objective-C files that do not follow the pattern
+described in the Google Objective-C Style Guide.
----------------
Please make first statement same as in Release Notes.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/google-objc-require-category-method-prefixes.rst:16
+This checker ensures that all methods in categories have some sort of prefix
+(e.g. gmo_). It excludes categories on classes whose names have a whitelisted
+three-letter prefix.
----------------
Please enclose gmo_ in double back-ticks.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/google-objc-require-category-method-prefixes.rst:19
+
+You should set the clang option WhitelistedPrefixes to a semicolon-delimited
+lits of class prefixes within your project if you want to be able to create
----------------
See other checks documentation for proper option section style.

clang -> :program:`clang-tidy` and enclose WhitelistedPrefixes in single back-ticks.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/google-objc-require-category-method-prefixes.rst:24
+For example, the following code sample is a properly prefixed method on a
+non-owned class (NSObject):
+
----------------
Please enclose NSObject in double back-ticks.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/google-objc-require-category-method-prefixes.rst:31
+
+If you whitelist the QED three-letter prefix, the following code sample
+is also allowed:
----------------
Please enclose QED in double back-ticks.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65917/new/

https://reviews.llvm.org/D65917





More information about the cfe-commits mailing list