llvm-project/clang-tools-extra/clang-tidy/objc
Stephane Moore af4755aca8 [clang-tidy/checks] Update objc-property-declaration check to allow arbitrary acronyms and initialisms 🔧
Summary:
§1 Description

This changes the objc-property-declaration check to allow arbitrary acronyms and initialisms instead of using whitelisted acronyms. In Objective-C it is relatively common to use project prefixes in property names for the purposes of disambiguation. For example, the CIColor¹ and CGColor² properties on UIColor both represent symbol prefixes being used in proeprty names outside of Apple's accepted acronyms³. The union of Apple's accepted acronyms and all symbol prefixes that might be used for disambiguation in property declarations effectively allows for any arbitrary sequence of capital alphanumeric characters to be acceptable in property declarations. This change updates the check accordingly.

The test variants with custom configurations are deleted as part of this change because their configurations no longer impact behavior. The acronym configurations are currently preserved for backwards compatibility of check configuration.

[1] https://developer.apple.com/documentation/uikit/uicolor/1621951-cicolor?language=objc
[2] https://developer.apple.com/documentation/uikit/uicolor/1621954-cgcolor?language=objc
[3] https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/APIAbbreviations.html#//apple_ref/doc/uid/20001285-BCIHCGAE

§2 Test Notes

Changes verified by:
• Running clang-tidy unit tests.
• Used check_clang_tidy.py to verify expected output of processing objc-property-declaration.m

Reviewers: benhamilton, Wizard

Reviewed By: benhamilton

Subscribers: jfb, cfe-commits

Differential Revision: https://reviews.llvm.org/D51832

llvm-svn: 348331
2018-12-05 03:44:03 +00:00
..
AvoidNSErrorInitCheck.cpp NFC: Remove the ObjC1/ObjC2 distinction from clang (and related projects) 2018-10-30 20:31:30 +00:00
AvoidNSErrorInitCheck.h [clang-tidy] Fix reference to -[NSError init] in AvoidNSErrorInitCheck.h 2018-11-15 22:38:39 +00:00
AvoidSpinlockCheck.cpp Port getLocStart -> getBeginLoc 2018-08-09 22:42:26 +00:00
AvoidSpinlockCheck.h add new check to find OSSpinlock usage 2017-11-27 21:30:10 +00:00
CMakeLists.txt add new check to find NSError init invocation 2017-11-30 19:05:08 +00:00
ForbiddenSubclassingCheck.cpp NFC: Remove the ObjC1/ObjC2 distinction from clang (and related projects) 2018-10-30 20:31:30 +00:00
ForbiddenSubclassingCheck.h
ObjCTidyModule.cpp add new check to find NSError init invocation 2017-11-30 19:05:08 +00:00
PropertyDeclarationCheck.cpp [clang-tidy/checks] Update objc-property-declaration check to allow arbitrary acronyms and initialisms 🔧 2018-12-05 03:44:03 +00:00
PropertyDeclarationCheck.h add prefix with '_' support for property name. Corresponding apple dev doc: https://developer.apple.com/library/content/qa/qa1908/_index.html 2018-01-30 01:44:00 +00:00