1// RUN: %check_clang_tidy %s objc-property-declaration %t
2@class CIColor;
3@class NSArray;
4@class NSData;
5@class NSString;
6@class UIViewController;
7
8typedef void *CGColorRef;
9
10@interface Foo
11@property(assign, nonatomic) int NotCamelCase;
12// CHECK-MESSAGES: :[[@LINE-1]]:34: warning: property name 'NotCamelCase' not using lowerCamelCase style or not prefixed in a category, according to the Apple Coding Guidelines [objc-property-declaration]
13// CHECK-FIXES: @property(assign, nonatomic) int notCamelCase;
14@property(assign, nonatomic) int camelCase;
15@property(strong, nonatomic) NSString *URLString;
16@property(strong, nonatomic) NSString *bundleID;
17@property(strong, nonatomic) NSData *RGBABytes;
18@property(strong, nonatomic) UIViewController *notificationsVC;
19@property(strong, nonatomic) NSString *URL_string;
20// CHECK-MESSAGES: :[[@LINE-1]]:40: warning: property name 'URL_string' not using lowerCamelCase style or not prefixed in a category, according to the Apple Coding Guidelines [objc-property-declaration]
21@property(strong, nonatomic) NSString *supportURLsCamelCase;
22@property(strong, nonatomic) NSString *supportURLCamelCase;
23@property(strong, nonatomic) NSString *VCsPluralToAdd;
24@property(assign, nonatomic) int centerX;
25@property(assign, nonatomic) int enable2GBackgroundFetch;
26@property(assign, nonatomic) int shouldUseCFPreferences;
27@property(assign, nonatomic) int enableGLAcceleration;
28@property(assign, nonatomic) int ID;
29@property(assign, nonatomic) int hasADog;
30@property(nonatomic, readonly) CGColorRef CGColor;
31@property(nonatomic, readonly) CIColor *CIColor;
32@property(nonatomic, copy) NSArray *IDs;
33@end
34
35@interface Foo (Bar)
36@property(assign, nonatomic) int abc_NotCamelCase;
37// CHECK-MESSAGES: :[[@LINE-1]]:34: warning: property name 'abc_NotCamelCase' not using lowerCamelCase style or not prefixed in a category, according to the Apple Coding Guidelines [objc-property-declaration]
38@property(assign, nonatomic) int abCD_camelCase;
39// CHECK-MESSAGES: :[[@LINE-1]]:34: warning: property name 'abCD_camelCase' not using lowerCamelCase style or not prefixed in a category, according to the Apple Coding Guidelines [objc-property-declaration]
40// CHECK-FIXES: @property(assign, nonatomic) int abcd_camelCase;
41@property(assign, nonatomic) int abCD_NotCamelCase;
42// CHECK-MESSAGES: :[[@LINE-1]]:34: warning: property name 'abCD_NotCamelCase' not using lowerCamelCase style or not prefixed in a category, according to the Apple Coding Guidelines [objc-property-declaration]
43// CHECK-FIXES: @property(assign, nonatomic) int abcd_notCamelCase;
44@property(assign, nonatomic) int wrongFormat_;
45// CHECK-MESSAGES: :[[@LINE-1]]:34: warning: property name 'wrongFormat_' not using lowerCamelCase style or not prefixed in a category, according to the Apple Coding Guidelines [objc-property-declaration]
46@property(strong, nonatomic) NSString *URLStr;
47@property(assign, nonatomic) int abc_camelCase;
48@property(strong, nonatomic) NSString *abc_URL;
49@property(strong, nonatomic) NSString *opac2_sourceComponent;
50@end
51
52@interface Foo ()
53@property(assign, nonatomic) int abc_inClassExtension;
54// CHECK-MESSAGES: :[[@LINE-1]]:34: warning: property name 'abc_inClassExtension' not using lowerCamelCase style or not prefixed in a category, according to the Apple Coding Guidelines [objc-property-declaration]
55@end

source code of clang-tools-extra/test/clang-tidy/checkers/objc/property-declaration.m