[linters] Fix incorrect assert false in Component linters

Reviewed By: ddino

Differential Revision: D5706229

fbshipit-source-id: c3bd287
master
Dulma Churchill 8 years ago committed by Facebook Github Bot
parent a2c67afe6c
commit 9f19f12a1b

@ -253,16 +253,15 @@ let component_with_multiple_factory_methods_advice context an =
match attr with Clang_ast_t.UnavailableAttr _ -> true | _ -> false match attr with Clang_ast_t.UnavailableAttr _ -> true | _ -> false
in in
let is_available_factory_method if_decl (decl: Clang_ast_t.decl) = let is_available_factory_method if_decl (decl: Clang_ast_t.decl) =
let attrs = match decl with
match decl with | ObjCMethodDecl (decl_info, _, _)
| ObjCMethodDecl (decl_info, _, _) -> let unavailable_attrs =
-> decl_info.Clang_ast_t.di_attributes List.filter ~f:is_unavailable_attr decl_info.Clang_ast_t.di_attributes
| _ in
-> assert false let is_available = List.is_empty unavailable_attrs in
in CAst_utils.is_objc_factory_method if_decl decl && is_available
let unavailable_attrs = List.filter ~f:is_unavailable_attr attrs in | _
let is_available = Int.equal (List.length unavailable_attrs) 0 in -> false
CAst_utils.is_objc_factory_method if_decl decl && is_available
in in
let check_interface if_decl = let check_interface if_decl =
match if_decl with match if_decl with

@ -25,6 +25,9 @@
// Not OK - Using the class name instaed of `instancename` doesn't make this OK // Not OK - Using the class name instaed of `instancename` doesn't make this OK
@interface BadComponent : CKCompositeComponent @interface BadComponent : CKCompositeComponent
@property int x;
+ (instancetype)newWithObject1:(NSObject*)obj; + (instancetype)newWithObject1:(NSObject*)obj;
+ (BadComponent*)newWithObject2:(NSObject*)obj; + (BadComponent*)newWithObject2:(NSObject*)obj;
@end @end

@ -7,11 +7,11 @@ codetoanalyze/objcpp/linters/componentkit/InitializerWithSideEffectTest.mm, FooC
codetoanalyze/objcpp/linters/componentkit/InitializerWithSideEffectTest.mm, __objc_anonymous_block_______1, 37, COMPONENT_INITIALIZER_WITH_SIDE_EFFECTS, [] codetoanalyze/objcpp/linters/componentkit/InitializerWithSideEffectTest.mm, __objc_anonymous_block_______1, 37, COMPONENT_INITIALIZER_WITH_SIDE_EFFECTS, []
codetoanalyze/objcpp/linters/componentkit/InitializerWithSideEffectTest.mm, __objc_anonymous_block_______2, 41, COMPONENT_INITIALIZER_WITH_SIDE_EFFECTS, [] codetoanalyze/objcpp/linters/componentkit/InitializerWithSideEffectTest.mm, __objc_anonymous_block_______2, 41, COMPONENT_INITIALIZER_WITH_SIDE_EFFECTS, []
codetoanalyze/objcpp/linters/componentkit/MultipleFactoryMethodsTest.h, Linters_dummy_method, 20, COMPONENT_WITH_MULTIPLE_FACTORY_METHODS, [] codetoanalyze/objcpp/linters/componentkit/MultipleFactoryMethodsTest.h, Linters_dummy_method, 20, COMPONENT_WITH_MULTIPLE_FACTORY_METHODS, []
codetoanalyze/objcpp/linters/componentkit/MultipleFactoryMethodsTest.h, Linters_dummy_method, 29, COMPONENT_WITH_MULTIPLE_FACTORY_METHODS, [] codetoanalyze/objcpp/linters/componentkit/MultipleFactoryMethodsTest.h, Linters_dummy_method, 32, COMPONENT_WITH_MULTIPLE_FACTORY_METHODS, []
codetoanalyze/objcpp/linters/componentkit/MultipleFactoryMethodsTest.h, Linters_dummy_method, 52, COMPONENT_WITH_MULTIPLE_FACTORY_METHODS, [] codetoanalyze/objcpp/linters/componentkit/MultipleFactoryMethodsTest.h, Linters_dummy_method, 55, COMPONENT_WITH_MULTIPLE_FACTORY_METHODS, []
codetoanalyze/objcpp/linters/componentkit/MultipleFactoryMethodsTest.h, Linters_dummy_method, 58, COMPONENT_WITH_MULTIPLE_FACTORY_METHODS, [] codetoanalyze/objcpp/linters/componentkit/MultipleFactoryMethodsTest.h, Linters_dummy_method, 61, COMPONENT_WITH_MULTIPLE_FACTORY_METHODS, []
codetoanalyze/objcpp/linters/componentkit/MultipleFactoryMethodsTest.h, Linters_dummy_method, 59, COMPONENT_WITH_MULTIPLE_FACTORY_METHODS, [] codetoanalyze/objcpp/linters/componentkit/MultipleFactoryMethodsTest.h, Linters_dummy_method, 62, COMPONENT_WITH_MULTIPLE_FACTORY_METHODS, []
codetoanalyze/objcpp/linters/componentkit/MultipleFactoryMethodsTest.h, Linters_dummy_method, 60, COMPONENT_WITH_MULTIPLE_FACTORY_METHODS, [] codetoanalyze/objcpp/linters/componentkit/MultipleFactoryMethodsTest.h, Linters_dummy_method, 63, COMPONENT_WITH_MULTIPLE_FACTORY_METHODS, []
codetoanalyze/objcpp/linters/componentkit/MutableLocalVariablesTest.mm, BarComponent_new, 90, MUTABLE_LOCAL_VARIABLE_IN_COMPONENT_FILE, [] codetoanalyze/objcpp/linters/componentkit/MutableLocalVariablesTest.mm, BarComponent_new, 90, MUTABLE_LOCAL_VARIABLE_IN_COMPONENT_FILE, []
codetoanalyze/objcpp/linters/componentkit/MutableLocalVariablesTest.mm, BarComponent_new, 92, MUTABLE_LOCAL_VARIABLE_IN_COMPONENT_FILE, [] codetoanalyze/objcpp/linters/componentkit/MutableLocalVariablesTest.mm, BarComponent_new, 92, MUTABLE_LOCAL_VARIABLE_IN_COMPONENT_FILE, []
codetoanalyze/objcpp/linters/componentkit/MutableLocalVariablesTest.mm, BarComponent_new, 111, MUTABLE_LOCAL_VARIABLE_IN_COMPONENT_FILE, [] codetoanalyze/objcpp/linters/componentkit/MutableLocalVariablesTest.mm, BarComponent_new, 111, MUTABLE_LOCAL_VARIABLE_IN_COMPONENT_FILE, []

Loading…
Cancel
Save