Skip to content

Rules and checks

assay has 147 rules, five cross-file checks, three asset checks and five project-file checks. Each name links to its page.

  • Tier: a blocking violation fails the gate; an advisory one never does. No preset or setting changes a rule’s tier.
  • Scope: a Dart rule judges any Dart code; a Flutter rule judges only code that uses Flutter.
  • Host: rules judge in the editor and dart analyze, through the plugin, and in the command-line program. Checks run in the command-line program only.
  • Presets: where the rule is on. core holds 11 blocking rules. The other 24 blocking rules are on from recommended, and 38 rules are in strict only. Like its tier, a rule’s lowest preset belongs to the rule.

Of the 147 rules, 121 are Dart and 26 Flutter rules, 35 blocking and 112 advisory; the ten rules of security have tables of their own. recommended switches on 109, strict all 147, and both add SDK lints, six of them blocking (Presets).

Rule Tier Scope Fix Presets
avoid_dynamic blocking Dart none core, recommended, strict
avoid_non_null_assertion blocking Dart none core, recommended, strict
avoid_swallowed_errors blocking Dart none core, recommended, strict
no_placeholder_implementation blocking Dart none core, recommended, strict
suppression_requires_justification blocking Dart none core, recommended, strict
no_equal_branches blocking Dart none core, recommended, strict
test_requires_assertion blocking Dart none core, recommended, strict
no_trivial_assertion blocking Dart none core, recommended, strict
identical_operands blocking Dart none recommended, strict
duplicate_map_key blocking Dart none recommended, strict
assignment_as_condition blocking Dart none recommended, strict
impossible_type_test blocking Dart none recommended, strict
json_cast_to_typed_collection blocking Dart none recommended, strict
recursive_to_string blocking Dart none recommended, strict
return_unawaited_in_try blocking Dart await the returned future recommended, strict
for_loop_updates_wrong_variable blocking Dart none recommended, strict
missing_throw blocking Dart throw the created error recommended, strict
test_file_not_collected blocking Dart none recommended, strict
misspelled_pragma blocking Dart none recommended, strict
receiver_passed_to_itself blocking Dart none recommended, strict
future_awaited_too_late blocking Dart none recommended, strict
incomplete_enum_map_lookup blocking Dart none recommended, strict
subscription_never_cancelled blocking Dart none recommended, strict
late_field_never_assigned blocking Dart none recommended, strict
avoid_late advisory Dart none recommended, strict
no_commented_out_code advisory Dart delete the commented-out code recommended, strict
avoid_unused_parameters advisory Dart none recommended, strict
no_magic_number advisory Dart none recommended, strict
avoid_global_mutable_state advisory Dart none recommended, strict
max_function_length advisory Dart none recommended, strict
max_cyclomatic_complexity advisory Dart none recommended, strict
max_cognitive_complexity advisory Dart none strict
max_nesting_depth advisory Dart none recommended, strict
max_parameters advisory Dart none recommended, strict
max_file_length advisory Dart none recommended, strict
duplicate_pattern_alternative advisory Dart delete the repeated operand recommended, strict
collection_identity_comparison advisory Dart none recommended, strict
duplicate_cascade_assignment advisory Dart delete the repeated section recommended, strict
constant_condition advisory Dart delete the literal that does nothing recommended, strict
accessor_reads_other_field advisory Dart none recommended, strict
unencodable_value_in_to_json advisory Dart none recommended, strict
cast_to_extension_type advisory Dart call the extension type’s constructor recommended, strict
enum_value_by_index advisory Dart none recommended, strict
null_into_non_nullable_future advisory Dart none recommended, strict
complete_error_without_stack_trace advisory Dart pass the catch clause’s stack trace recommended, strict
stringified_async_value advisory Dart none recommended, strict
tear_off_in_string advisory Dart call the method or the function recommended, strict
default_to_string advisory Dart none recommended, strict
thrown_object_without_to_string advisory Dart none recommended, strict
loop_exits_on_first_pass advisory Dart none recommended, strict
overwritten_before_read advisory Dart delete the write whose value is lost recommended, strict
private_field_never_assigned advisory Dart none recommended, strict
unreachable_extension_member advisory Dart none recommended, strict
override_changes_default_value advisory Dart none recommended, strict
doubled_slash_in_uri advisory Dart write a single slash recommended, strict
duplicate_test_name advisory Dart none recommended, strict
duplicate_test_assertion advisory Dart delete the repeated assertion recommended, strict
empty_test_group advisory Dart none recommended, strict
call_method_written_out advisory Dart call the function directly recommended, strict
one_element_collection_read_back advisory Dart write the element itself recommended, strict
compare_to_for_equality advisory Dart compare with == or != recommended, strict
continue_at_loop_end advisory Dart delete the continue recommended, strict
empty_enum_constant_arguments advisory Dart delete the empty brackets recommended, strict
extends_object_written_out advisory Dart delete the clause recommended, strict
local_variable_only_copied advisory Dart give the value to the next variable recommended, strict
foldable_negation advisory Dart write it without the negation recommended, strict
return_at_function_end advisory Dart delete the return recommended, strict
super_call_written_out advisory Dart delete the super() call recommended, strict
type_filter_keeps_everything advisory Dart none recommended, strict
cast_to_own_type advisory Dart delete the cast recommended, strict
catch_only_rethrows advisory Dart delete the catch clause recommended, strict
mixin_applied_again advisory Dart delete the mixin recommended, strict
spread_of_empty_collection advisory Dart delete the spread recommended, strict
keyword_on_wildcard advisory Dart delete the keyword recommended, strict
contains_on_map_keys advisory Dart call ‘containsKey’ recommended, strict
inline_pragma_without_body advisory Dart delete the pragma recommended, strict
where_tested_for_emptiness advisory Dart call ‘any’ or ‘every’ recommended, strict
typed_source_copied_with_from advisory Dart use ‘of’ recommended, strict
null_guarded_spread advisory Dart use ’…?’ recommended, strict
pattern_only_tests_null advisory Dart compare with null recommended, strict
wildcard_type_matches_everything advisory Dart delete the type recommended, strict
duplicate_local_value advisory Dart none recommended, strict
ambiguous_if_null_grouping advisory Dart write the parentheses of the grouping in effect strict
catch_all_case_on_closed_type advisory Dart none strict
unused_type_parameter advisory Dart none strict
type_parameter_shadows_type advisory Dart none strict
nullable_to_string advisory Dart none strict
nested_future advisory Dart none strict
async_callback_to_void_parameter advisory Dart none strict
always_returns_null advisory Dart none strict
always_returns_same_constant advisory Dart none strict
loop_over_known_empty advisory Dart none strict
constant_index_in_indexed_loop advisory Dart none strict
empty_block advisory Dart none strict
getter_hides_super_field advisory Dart none strict
top_level_shadows_inherited_member advisory Dart none strict
copy_with_misses_field advisory Dart none strict
else_after_leaving_branch advisory Dart lift the code of the else out strict
uneven_digit_groups advisory Dart none strict
inferable_type_arguments_written_out advisory Dart delete the type arguments strict
chained_assignment advisory Dart none strict
record_inside_record advisory Dart none strict
shorthand_inside_shorthand advisory Dart none strict
named_positional_record_field advisory Dart delete the name strict
getter_renames_representation advisory Dart none strict
local_declared_outside_its_block advisory Dart none strict
mergeable_switch_cases advisory Dart none strict
enum_compared_in_if_chain advisory Dart none strict
static_field_without_shorthand advisory Dart use the dot shorthand strict
constructor_could_be_const advisory Dart add ‘const’ strict
public_representation_field advisory Dart none strict
private_exception_thrown advisory Dart none strict
duplicate_enum_constant advisory Dart none strict
element_read_from_filter advisory Dart none strict
setstate_after_await blocking Flutter add ‘if (!mounted) return;’ before the call core, recommended, strict
dispose_owned_resources blocking Flutter release the State’s resources in ‘dispose’ core, recommended, strict
no_side_effects_in_build blocking Flutter none core, recommended, strict
flexible_outside_flex blocking Flutter none recommended, strict
widget_builds_itself blocking Flutter none recommended, strict
widget_access_in_state_constructor blocking Flutter none recommended, strict
lookup_through_outer_context blocking Flutter none recommended, strict
avoid_widget_returning_methods advisory Flutter none recommended, strict
max_widget_nesting advisory Flutter none recommended, strict
avoid_shrink_wrap_in_scrollables advisory Flutter none recommended, strict
listener_never_removed advisory Flutter none recommended, strict
lifecycle_super_call_order advisory Flutter move the inherited call recommended, strict
update_render_object_misses_property advisory Flutter none recommended, strict
text_field_without_value_channel advisory Flutter none recommended, strict
gesture_detector_without_handler advisory Flutter replace the GestureDetector with its child recommended, strict
media_query_of_for_one_property advisory Flutter call the method of the property recommended, strict
opacity_around_image advisory Flutter none recommended, strict
stateful_widget_without_state advisory Flutter none recommended, strict
render_object_setter_without_equality_check advisory Flutter none strict
state_changed_outside_set_state advisory Flutter none strict
several_public_widgets_in_file advisory Flutter none strict
gap_boxes_instead_of_spacing advisory Flutter use ‘spacing’ strict
image_without_semantics advisory Flutter none strict

Rules whose defect is a security weakness; Security says what each is for and what they leave alone.

  • Each carries a security class: its weaknesses of the common weakness list (CWE), its risk of the mobile list of 2024 and a severity from 0.1 to 10.0. The SARIF reporter writes it into the rule’s descriptor as the tags security, external/cwe/cwe-<n> and external/owasp-mobile-2024/m<n> and the security-severity, so that code scanning lists the violations as security alerts and ranks them. Nothing else changes in any report.
  • Every one is silent on the test side and in debug-only code (under kDebugMode, !kReleaseMode, a conditional on them, inside an assert), which a release build does not hold.
  • “Reviewed, safe” is a justified suppression, as for every rule.

The four rules of definite flaws are blocking and on from recommended:

Rule Tier Scope Fix Presets Security class
certificate_check_switched_off blocking Dart none recommended, strict CWE-295 · M5 · 8.1
cleartext_request blocking Dart none recommended, strict CWE-319 · M5 · 7.4
hard_coded_credential blocking Dart none recommended, strict CWE-798, CWE-321 · M1 · 7.8
deterministic_encryption blocking Dart none recommended, strict CWE-327, CWE-1204 · M10 · 7.0

The six findings to review are advisory and on from recommended. Each can be right in its place; keep a reviewed one with a justified suppression.

Rule Tier Scope Fix Presets Security class
weak_random_for_secret advisory Dart Random.secure() recommended, strict CWE-338 · M10 · 5.9
weak_hash_for_secret advisory Dart none recommended, strict CWE-328, CWE-916 · M10 · 5.3
secret_in_log advisory Dart none recommended, strict CWE-532 · M9 · 4.3
javascript_channel_open_to_any_page advisory Flutter none recommended, strict CWE-749 · M8 · 6.1
link_parameter_opened_unchecked advisory Flutter none recommended, strict CWE-601, CWE-939 · M4 · 6.1
secret_in_plain_preferences advisory Flutter none recommended, strict CWE-312, CWE-922 · M9 · 5.5

Whole-project checks whose result no single file can decide. Advisory, run by assay cross-file only, on under every preset, no fix. See Cross-file checks.

Check Reports
unused_code A declaration nothing in the project refers to.
unused_files A Dart file no entry point reaches through imports, exports or parts.
unused_l10n A localization entry nothing in the project uses (Flutter’s localization generator, easy_localization).
unnecessary_nullable A nullable parameter to which every call in the project passes a value that cannot be null.
duplicated_code A region of the shipped code that copies of a block of code found elsewhere in it cover, with the places of the other copies.

Checks of the files a Flutter package declares under flutter: assets:. Advisory, run by assay assets only, on under every preset, no fix. They report and never judge: their results enter neither the gate nor the baseline. See Asset checks.

Check Reports
unused_assets A declared asset that no Dart source of the project names.
oversized_assets A declared image file larger than the size limit for its resolution.
missing_asset_variants A declared image, in a directory that uses resolution variants, that lacks a variant it is asked for, or variants without their base file.

Checks of security in the files an app ships or is built with that are not Dart source: the pubspec and the declared assets, the Android manifest with its network security configuration, the Info.plist of iOS and macOS. Advisory, run by assay project-files only, on under every preset, no fix. A suppression comment does not reach them: keep a result with the check’s exclude or the baseline. Each carries a security class, as a rule of security does. See Project-file checks.

Check Reports Security class
secret_in_shipped_file A secret in the pubspec or in a declared asset. CWE-798, CWE-540 · M1 · 7.8
cleartext_traffic_allowed A platform setting that lets the app send or load plain HTTP. CWE-319 · M5 · 5.9
debuggable_app A release build of the Android app that can be debugged. CWE-489 · M8 · 6.5
app_backup_allowed An Android app whose data the device’s backup copies with no rule of what it holds. CWE-530 · M9 · 3.9
exported_component_without_permission An Android component any app can start without a permission. CWE-926 · M8 · 5.3

A rule’s page opens with what the rule reports and its tier, scope and fix, then has the sections it needs of What it reports, Why, Example, Rule parameters and Suppressing it; a limit rule adds how its value is counted, and a rule with a fix a section on the fix. A check’s page also says what the check reads, where no result is placed, its configuration and how to run it.

The SARIF reporter writes each rule’s help address from the rule’s name. Until assay has a site, that address is a placeholder.