Sdk: add fixes for frequently occurring errors (tracking)

Created on 12 Sep 2019  ยท  7Comments  ยท  Source: dart-lang/sdk

Tracking issue for work around identifying errors that would benefit from quick fixes.

(At this point mainly for book-keeping and conversation.)

Top 200 (internal) codes (9/11):

| code | has fix |
| :--- | :---: |
| undefined_identifier | โœ… |
| deprecated_member_use | |
| undefined_function | โœ… |
| uri_has_not_been_generated | |
| undefined_class | โœ… |
| non_type_as_type_argument | โœ… |
| undefined_method | โœ… |
| uri_does_not_exist | โœ… |
| unused_local_variable | |
| expected_token | โœ… |
| redirect_to_non_class | |
| unused_import | โœ… |
| const_initialized_with_non_constant_value | โœ… |
| undefined_getter | โœ… |
| unused_field | |
| unused_element | |
| non_constant_list_element | |
| missing_identifier | |
| undefined_setter | โœ… |
| non_constant_case_expression | |
| argument_type_not_assignable | |
| const_with_non_constant_argument | |
| deprecated_member_use_from_same_package | |
| type_argument_not_matching_bounds | |
| missing_return | |
| not_enough_required_arguments | |
| unnecessary_new | โœ… |
| expected_executable | |
| not_a_type | โœ… |
| missing_function_body | |
| strict_raw_type | |
| duplicate_definition | |
| cast_to_non_type | โœ… |
| type_test_with_undefined_name | โœ… |
| missing_const_final_var_or_type | |
| await_only_futures | โœ… |
| undefined_named_parameter | โœ… |
| invalid_assignment | โœ… |
| override_on_non_overriding_method | โœ… |
| unexpected_token | โœ… |
| extra_positional_arguments | โœ… |
| non_constant_map_value | |
| non_constant_map_key | |
| extra_positional_arguments_could_be_named | โœ… |
| final_not_initialized | โœ… |
| undefined_annotation | โœ… |
| invalid_constant | |
| referenced_before_declaration | |
| expected_class_member | |
| missing_method_parameters | |
| undefined_prefixed_name | |
| unnecessary_const | โœ… |
| positional_after_named_argument | |
| implements_non_class |โœ… |
| return_of_invalid_type | |
| extraneous_modifier | |
| final_not_initialized_constructor_1 | โœ… |
| curly_braces_in_flow_control_structures | โœ… |
| could_not_infer | |
| missing_required_param | โœ… |
| duplicate_import | โœ… |
| directive_after_declaration | |
| non_abstract_class_inherits_abstract_member_one | โœ… |
| abstract_super_member_reference | |
| unsafe_html | |
| non_constant_default_value | |
| invalid_override | |
| undefined_super_method | |
| slash_for_doc_comments | โœ… |
| nonexist_input_bound | |
| empty_constructor_bodies | โœ… |
| unresolved_tag | |
| unterminated_string_literal | |
| strong_mode_could_not_infer | |
| avoid_types_as_parameter_names | |
| undefined_operator | |
| list_element_type_not_assignable | |
| missing_function_parameters | |
| prefer_final_locals | โœ… |
| assignment_to_final_no_setter | |
| extends_non_class | โœ… |
| initializing_formal_for_non_existent_field | โœ… |
| implicit_dynamic_type | |
| type_literal_expected | |
| prefer_final_fields | โœ… |
| wrong_number_of_type_arguments | |
| ambiguous_import | |
| field_initializer_outside_constructor | |
| missing_keyword_operator | |
| implicit_this_reference_in_initializer | |
| expected_body | |
| dead_code | โœ… |
| avoid_bypassing_html_security | |
| mixin_with_non_class_superclass | |
| invocation_of_non_function | โœ… |
| invalid_constructor_name | |
| await_in_wrong_context | โœ… |
| mixin_super_class_constraint_non_interface | |
| use_of_void_result | |
| unawaited_futures | โœ… |
| concrete_class_with_abstract_member | โœ… |
| strong_mode_implicit_dynamic_type | |
| always_declare_return_types | |
| return_of_invalid_type_from_closure | |
| wrong_number_of_parameters_for_operator | |
| comment_references | |
| const_not_initialized | |
| offsets_cannot_be_created | |
| non_bool_condition | โœ… |
| override_on_non_overriding_getter | โœ… |
| non_constant_set_element | |
| invalid_reference_to_this | |
| prefer_equal_for_default_values | โœ… |
| initializer_for_non_existent_field | |
| unsupported_operator | |
| expected_type_name | |
| constructor_with_return_type | |
| non_abstract_class_inherits_abstract_member_two | โœ… |
| unnecessary_statements | |
| nonexist_output_bound | |
| new_with_invalid_type_parameters | |
| override_on_non_overriding_field | โœ… |
| missing_assignable_selector | |
| annotate_overrides | โœ… |
| static_access_to_instance_member | |
| named_function_expression | |
| type_annotate_public_apis | โœ… |
| prefer_const_constructors | โœ… |
| invalid_operator | |
| missing_enum_constant_in_switch | โœ… |
| prefer_interpolation_to_compose_strings | |
| part_of_non_part | |
| unnecessary_brace_in_string_interps | โœ… |
| final_not_initialized_constructor_3 | |
| equality_cannot_be_equality_operand | |
| implementation_imports | |
| final_not_initialized_constructor_2 | โœ… |
| always_specify_types | โœ… |
| named_parameter_outside_group | |
| no_adjacent_strings_in_list | |
| async_keyword_used_as_identifier | |
| native_function_body_in_non_sdk_code | |
| implicit_dynamic_parameter | |
| assignment_to_final | โœ… |
| non_abstract_class_inherits_abstract_member_five_plus | โœ… |
| unnecessary_getters_setters | |
| mixin_of_non_class | โœ… |
| equal_keys_in_const_map | |
| strong_mode_implicit_dynamic_function | |
| invalid_cast_new_expr | |
| non_bool_operand | |
| invalid_factory_name_not_a_class | |
| prefer_typing_uninitialized_variables | |
| instance_member_access_from_factory | |
| new_with_abstract_class | |
| unrelated_type_equality_checks | |
| map_value_type_not_assignable | |
| missing_statement | |
| implicit_dynamic_list_literal | |
| prefer_is_empty | โœ… |
| avoid_types_on_closure_parameters | โœ… |
| unmatched_attr_if_binding | |
| strong_mode_implicit_dynamic_parameter | |
| expression_in_map | |
| instance_member_access_from_static | |
| nonexist_two_way_output_bound | |
| var_and_type | |
| implicit_dynamic_function | |
| no_default_super_constructor_implicit | โœ… |
| new_with_undefined_constructor_default | |
| const_with_non_const | |
| avoid_return_types_on_setters | โœ… |
| must_be_immutable | |
| redirection_in_non_factory_constructor | |
| strong_mode_invalid_cast_function | |
| missing_assignment_in_initializer | |
| unnecessary_this | โœ… |
| avoid_unused_constructor_parameters | |
| no_default_super_constructor_explicit | โœ… |
| const_instance_field | โœ… |
| illegal_assignment_to_non_assignable | |
| assignment_to_final_local | โœ… |
| unnecessary_await_in_return | |
| class_in_class | |
| conflicting_static_and_instance | |
| prefer_single_quotes | โœ… |
| strict_raw_type_in_as | |
| invalid_cast_function | |
| type_is_not_a_directive | |
| expected_whitespace_before_decorator | |
| content_not_transcluded | |
| input_annotation_placement_invalid | |
| cannot_find_matching_close | |
| undefined_constructor_in_initializer | |
| unused_label | |
| always_put_control_body_on_new_line | |
| mixed_return_types | |
| case_block_not_terminated | |
| template_attr_not_used | |
| strong_mode_implicit_dynamic_list_literal | |

/cc @bwilkerson

P3 analyzer-quick-fix area-analyzer

All 7 comments

Candidates to implement:

  • [x] MISSING_CONST_FINAL_VAR_OR_TYPE
  • [x] UNUSED_ELEMENT
  • [x] UNUSED_FIELD
  • [x] UNUSED_LOCAL_VARIABLE
  • [x] UNUSED_LABEL

I have a change at https://dart-review.googlesource.com/c/sdk/+/150932/ that I think handles EXTENDS_NON_CLASS (it came up at https://github.com/Dart-Code/Dart-Code/issues/2536).

I added the same fixes to IMPLEMENTS_NON_CLASS and MIXIN_OF_NON_CLASS in https://dart-review.googlesource.com/c/sdk/+/151509/. I don't know if they're enough to tick off above or there are others (@pq I don't have edit permissions here, so if they are good enough, feel free to mark them off).

Thanks @DanTup !

(extends_non_class is done from the previous comment too, but not ticked :-))

So, what's funny/not-funny is that this was generated by a script so it should never be hand-edited. What's not funny is I can't find it now ๐Ÿ˜ข

I'll update and take another look.

If we ever do double-down here, it'd be cool to have a proper dashboard but hand-edits will have to do for now.

Needless to say, thanks a million for the fixes and the follow-through to help keep this up to date!

It probably doesn't matter; the original script is almost certainly broken by recent changes to FixProcessor. The good news is that a replacement script will be easier to write.

Was this page helpful?
0 / 5 - 0 ratings