diff --git a/infer/src/IR/Localise.ml b/infer/src/IR/Localise.ml index af3f988a2..8f0d49045 100644 --- a/infer/src/IR/Localise.ml +++ b/infer/src/IR/Localise.ml @@ -33,34 +33,21 @@ let analysis_stops = "ANALYSIS_STOPS" let array_out_of_bounds_l1 = "ARRAY_OUT_OF_BOUNDS_L1" let array_out_of_bounds_l2 = "ARRAY_OUT_OF_BOUNDS_L2" let array_out_of_bounds_l3 = "ARRAY_OUT_OF_BOUNDS_L3" -let assign_pointer_warning = "ASSIGN_POINTER_WARNING" -let bad_pointer_comparison = "BAD_POINTER_COMPARISON" let class_cast_exception = "CLASS_CAST_EXCEPTION" let comparing_floats_for_equality = "COMPARING_FLOAT_FOR_EQUALITY" let condition_is_assignment = "CONDITION_IS_ASSIGNMENT" -let component_factory_function = "COMPONENT_FACTORY_FUNCTION" -let component_file_cyclomatic_complexity = "COMPONENT_FILE_CYCLOMATIC_COMPLEXITY" -let component_file_line_count = "COMPONENT_FILE_LINE_COUNT" -let component_initializer_with_side_effects = "COMPONENT_INITIALIZER_WITH_SIDE_EFFECTS" -let component_with_multiple_factory_methods = "COMPONENT_WITH_MULTIPLE_FACTORY_METHODS" -let component_with_unconventional_superclass = "COMPONENT_WITH_UNCONVENTIONAL_SUPERCLASS" let condition_always_false = "CONDITION_ALWAYS_FALSE" let condition_always_true = "CONDITION_ALWAYS_TRUE" let context_leak = "CONTEXT_LEAK" -let cxx_reference_captured_in_objc_block = "CXX_REFERENCE_CAPTURED_IN_OBJC_BLOCK" let dangling_pointer_dereference = "DANGLING_POINTER_DEREFERENCE" let deallocate_stack_variable = "DEALLOCATE_STACK_VARIABLE" let deallocate_static_memory = "DEALLOCATE_STATIC_MEMORY" let deallocation_mismatch = "DEALLOCATION_MISMATCH" -let direct_atomic_property_access = "DIRECT_ATOMIC_PROPERTY_ACCESS" let divide_by_zero = "DIVIDE_BY_ZERO" let empty_vector_access = "EMPTY_VECTOR_ACCESS" let field_not_null_checked = "IVAR_NOT_NULL_CHECKED" -let global_variable_initialized_with_function_or_method_call = - "GLOBAL_VARIABLE_INITIALIZED_WITH_FUNCTION_OR_METHOD_CALL" let inherently_dangerous_function = "INHERENTLY_DANGEROUS_FUNCTION" let memory_leak = "MEMORY_LEAK" -let mutable_local_variable_in_component_file = "MUTABLE_LOCAL_VARIABLE_IN_COMPONENT_FILE" let null_dereference = "NULL_DEREFERENCE" let parameter_not_null_checked = "PARAMETER_NOT_NULL_CHECKED" let null_test_after_dereference = "NULL_TEST_AFTER_DEREFERENCE" @@ -79,7 +66,6 @@ let skip_function = "SKIP_FUNCTION" let skip_pointer_dereference = "SKIP_POINTER_DEREFERENCE" let stack_variable_address_escape = "STACK_VARIABLE_ADDRESS_ESCAPE" let static_initialization_order_fiasco = "STATIC_INITIALIZATION_ORDER_FIASCO" -let strong_delegate_warning = "STRONG_DELEGATE_WARNING" let tainted_value_reaching_sensitive_function = "TAINTED_VALUE_REACHING_SENSITIVE_FUNCTION" let thread_safety_error = "THREAD_SAFETY_ERROR" let unary_minus_applied_to_unsigned_expression = "UNARY_MINUS_APPLIED_TO_UNSIGNED_EXPRESSION" diff --git a/infer/src/IR/Localise.mli b/infer/src/IR/Localise.mli index 345f9b415..60f89815b 100644 --- a/infer/src/IR/Localise.mli +++ b/infer/src/IR/Localise.mli @@ -30,33 +30,21 @@ val analysis_stops : t val array_out_of_bounds_l1 : t val array_out_of_bounds_l2 : t val array_out_of_bounds_l3 : t -val assign_pointer_warning : t -val bad_pointer_comparison : t val class_cast_exception : t val comparing_floats_for_equality : t val condition_is_assignment : t val condition_always_false : t val condition_always_true : t val context_leak : t -val component_factory_function : t -val component_file_cyclomatic_complexity : t -val component_file_line_count : t -val component_initializer_with_side_effects : t -val component_with_multiple_factory_methods : t -val component_with_unconventional_superclass : t -val cxx_reference_captured_in_objc_block : t val dangling_pointer_dereference : t val deallocate_stack_variable : t val deallocate_static_memory : t val deallocation_mismatch : t -val direct_atomic_property_access : t val divide_by_zero : t val empty_vector_access : t val field_not_null_checked : t -val global_variable_initialized_with_function_or_method_call : t val inherently_dangerous_function : t val memory_leak : t -val mutable_local_variable_in_component_file : t val null_dereference : t val parameter_not_null_checked : t val null_test_after_dereference : t @@ -73,7 +61,6 @@ val return_expression_required : t val return_statement_missing : t val stack_variable_address_escape : t val static_initialization_order_fiasco : t -val strong_delegate_warning : t val unary_minus_applied_to_unsigned_expression : t val uninitialized_value : t val unsafe_guarded_by_access : t diff --git a/infer/src/clang/ComponentKit.ml b/infer/src/clang/ComponentKit.ml index 36ff2c40d..3cc2cb7e7 100644 --- a/infer/src/clang/ComponentKit.ml +++ b/infer/src/clang/ComponentKit.ml @@ -116,7 +116,7 @@ let mutable_local_vars_advice context an = && not decl_info.di_is_implicit in if condition then CTL.True, Some { - CIssue.name = Localise.to_string Localise.mutable_local_variable_in_component_file; + CIssue.name = "MUTABLE_LOCAL_VARIABLE_IN_COMPONENT_FILE"; severity = Exceptions.Kadvice; mode = CIssue.On; description = "Local variable '" ^ named_decl_info.ni_name @@ -144,7 +144,7 @@ let component_factory_function_advice context an = is_ck_context context an && is_component_if objc_interface in if condition then CTL.True, Some { - CIssue.name = Localise.to_string Localise.component_factory_function; + CIssue.name = "COMPONENT_FACTORY_FUNCTION"; severity = Exceptions.Kadvice; mode = CIssue.On; description = "Break out composite components"; @@ -186,7 +186,7 @@ let component_with_unconventional_superclass_advice context an = && not has_conventional_superclass in if condition then CTL.True, Some { - CIssue.name = Localise.to_string Localise.component_with_unconventional_superclass; + CIssue.name = "COMPONENT_WITH_UNCONVENTIONAL_SUPERCLASS"; severity = Exceptions.Kadvice; mode = CIssue.On; description = "Never Subclass Components"; @@ -238,7 +238,7 @@ let component_with_multiple_factory_methods_advice context an = let factory_methods = IList.filter (is_available_factory_method if_decl) decls in if (IList.length factory_methods) > 1 then CTL.True, Some { - CIssue.name = Localise.to_string Localise.component_with_multiple_factory_methods; + CIssue.name = "COMPONENT_WITH_MULTIPLE_FACTORY_METHODS"; severity = Exceptions.Kadvice; mode = CIssue.On; description = "Avoid Overrides"; @@ -293,7 +293,7 @@ let rec _component_initializer_with_side_effects_advice | Some "dispatch_async" | Some "dispatch_sync" -> CTL.True, Some { - CIssue.name = Localise.to_string Localise.component_initializer_with_side_effects; + CIssue.name = "COMPONENT_INITIALIZER_WITH_SIDE_EFFECTS"; severity = Exceptions.Kadvice; mode = CIssue.On; description = "No Side-effects"; @@ -327,7 +327,7 @@ let component_file_line_count_info (context: CLintersContext.context) dec = context.translation_unit_context.CFrontend_config.source_file in let line_count = SourceFile.line_count source_file in IList.map (fun i -> { - CIssue.name = Localise.to_string Localise.component_file_line_count; + CIssue.name = "COMPONENT_FILE_LINE_COUNT"; severity = Exceptions.Kinfo; mode = CIssue.Off; description = "Line count analytics"; @@ -373,7 +373,7 @@ let component_file_cyclomatic_complexity_info (context: CLintersContext.context) match cyclo_loc_opt an with | Some loc -> CTL.True, Some { - CIssue.name = Localise.to_string Localise.component_file_cyclomatic_complexity; + CIssue.name = "COMPONENT_FILE_CYCLOMATIC_COMPLEXITY"; severity = Exceptions.Kinfo; mode = CIssue.Off; description = "Cyclomatic Complexity Incremental Marker"; diff --git a/infer/src/clang/cFrontend_checkers.ml b/infer/src/clang/cFrontend_checkers.ml index 110543155..391e90a64 100644 --- a/infer/src/clang/cFrontend_checkers.ml +++ b/infer/src/clang/cFrontend_checkers.ml @@ -119,7 +119,7 @@ let ctl_ns_notification_warning lctx an = let condition = InNode (["ObjCImplementationDecl"; "ObjCProtocolDecl"], Not (Implies (eventually_addObserver, eventually_removeObserver))) in let issue_desc = { - CIssue.name = Localise.to_string Localise.registered_observer_being_deallocated; + CIssue.name = "REGISTERED_OBSERVER_BEING_DEALLOCATED"; severity = Exceptions.Kwarning; mode = CIssue.On; description = @@ -154,7 +154,7 @@ let ctl_bad_pointer_comparison_warning lctx an = let condition = InNode (["IfStmt"; "ForStmt"; "WhileStmt"; "ConditionalOperator"], etx) in let issue_desc = { CIssue. - name = Localise.to_string Localise.bad_pointer_comparison; + name = "BAD_POINTER_COMPARISON"; severity = Exceptions.Kwarning; mode = CIssue.On; description = "Implicitly checking whether NSNumber pointer is nil"; @@ -179,7 +179,7 @@ let ctl_strong_delegate_warning lctx an = And (name_does_not_contains_queue, is_strong_property))) in let issue_desc = { - CIssue.name = Localise.to_string Localise.strong_delegate_warning; + CIssue.name = "STRONG_DELEGATE_WARNING"; severity = Exceptions.Kwarning; mode = CIssue.On; description = @@ -202,8 +202,7 @@ let ctl_global_var_init_with_calls_warning lctx an = let condition = InNode (["VarDecl"], And (ctl_is_global_var, ctl_is_initialized_with_expensive_call)) in let issue_desc = { - CIssue.name = - Localise.to_string Localise.global_variable_initialized_with_function_or_method_call; + CIssue.name = "GLOBAL_VARIABLE_INITIALIZED_WITH_FUNCTION_OR_METHOD_CALL"; severity = Exceptions.Kwarning; mode = CIssue.On; description = @@ -221,7 +220,7 @@ let ctl_assign_pointer_warning lctx an = And (Atomic ("is_assign_property", []), Atomic ("is_property_pointer_type", []))) in let issue_desc = - { CIssue.name = Localise.to_string Localise.assign_pointer_warning; + { CIssue.name = "ASSIGN_POINTER_WARNING"; severity = Exceptions.Kwarning; mode = CIssue.On; description = @@ -244,7 +243,7 @@ let ctl_direct_atomic_property_access_warning lctx an = Not (Atomic ("is_objc_constructor", []))), Not (Atomic ("is_objc_dealloc", [])))) in let issue_desc = { - CIssue.name = Localise.to_string Localise.direct_atomic_property_access; + CIssue.name = "DIRECT_ATOMIC_PROPERTY_ACCESS"; severity = Exceptions.Kwarning; mode = CIssue.On; description = "Direct access to ivar %ivar_name% of an atomic property"; @@ -259,7 +258,7 @@ let ctl_captured_cxx_ref_in_objc_block_warning lctx an = let open CTL in let condition = InNode (["BlockDecl"], Atomic ("captures_cxx_references", [])) in let issue_desc = { - CIssue.name = Localise.to_string Localise.cxx_reference_captured_in_objc_block; + CIssue.name = "CXX_REFERENCE_CAPTURED_IN_OBJC_BLOCK"; severity = Exceptions.Kwarning; mode = CIssue.On; description =