2bbb2f3c1f
Explicit casts make it easier to confidently navigate the code base and apply refactorings which tighten types. This change exposes a number of places where types can be tightened, but only the most trivial were applied. For most places I added the explicit cast that would have happened anyway and so behavior shouldn't be changing. - Add the configuration which disallows implicit casts in the analyzer. - Add explicit casts in almost all instances. - Where the implicit cast was due to a local variable type on the left, change it to a `var` so the type is not repeated. - In a few places add argument types where they were already applied on the parent type, and the subclass was unnecessarily loosening argument types to dynamic. - In a few places where a method was defined with an implicit dynamic return but had an obvious and consistent return type, annotate the method instead of casting after calls to that method. Change-Id: I90e11b1cc08ce69967ea5705b507d5758a8f668f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103381 Reviewed-by: Nicholas Shahan <nshahan@google.com>
36 lines
816 B
YAML
36 lines
816 B
YAML
analyzer:
|
|
strong-mode:
|
|
implicit-casts: false
|
|
errors:
|
|
todo: ignore
|
|
exclude:
|
|
- doc/api/**
|
|
- gen/**
|
|
- node_modules/**
|
|
- test/codegen/**
|
|
- test/samples/**
|
|
- test/transformer/hello_app/**
|
|
- tool/input_sdk/**
|
|
|
|
linter:
|
|
rules:
|
|
- annotate_overrides
|
|
- avoid_empty_else
|
|
- avoid_init_to_null
|
|
- avoid_return_types_on_setters
|
|
- avoid_shadowing_type_parameters
|
|
- avoid_types_as_parameter_names
|
|
- curly_braces_in_flow_control_structures
|
|
- empty_constructor_bodies
|
|
- library_names
|
|
- null_closures
|
|
- prefer_contains
|
|
- prefer_equal_for_default_values
|
|
- prefer_is_empty
|
|
- prefer_is_not_empty
|
|
- recursive_getters
|
|
- type_init_formals
|
|
- unnecessary_null_in_if_null_operators
|
|
- use_rethrow_when_possible
|
|
- valid_regexps
|