Summary: This check finds property declarations in Objective-C files that do not follow the pattern of property names in Apple's programming guide. The property name should be in the format of Lower Camel Case or with some particular acronyms as prefix. Example: @property(nonatomic, assign) int lowerCamelCase; @property(nonatomic, strong) NSString *URLString; Test plan: ninja check-clang-tools Reviewers: benhamilton, hokein Reviewed By: hokein Subscribers: cfe-commits, mgorny Differential Revision: https://reviews.llvm.org/D39829 llvm-svn: 318117
13 lines
701 B
Objective-C
13 lines
701 B
Objective-C
// RUN: %check_clang_tidy %s objc-property-declaration %t
|
|
@class NSString;
|
|
|
|
@interface Foo
|
|
@property(assign, nonatomic) int NotCamelCase;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:34: warning: property name 'NotCamelCase' should use lowerCamelCase style, according to the Apple Coding Guidelines [objc-property-declaration]
|
|
// CHECK-FIXES: @property(assign, nonatomic) int notCamelCase;
|
|
@property(assign, nonatomic) int camelCase;
|
|
@property(strong, nonatomic) NSString *URLString;
|
|
@property(strong, nonatomic) NSString *URL_string;
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:40: warning: property name 'URL_string' should use lowerCamelCase style, according to the Apple Coding Guidelines [objc-property-declaration]
|
|
@end
|