Configuring checks
The cross-file, asset and project-file checks are configured under three keys of assay: in the project’s root analysis_options.yaml (Configuration): cross_file, assets and project_files, one entry per check, by its name.
assay: cross_file: unused_l10n: false duplicated_code: min_tokens: 150 project_files: debuggable_app: falseEvery check is on under every preset. A check switched off does not run, even when a command names it; the result says it is off. The exclude of a check, the path globs where it places no result, is on Excluding code.
Cross-file checks
Section titled “Cross-file checks”The five cross-file checks are unused_code, unused_files, unused_l10n, unnecessary_nullable and duplicated_code. Each takes enabled and exclude, and <check>: false is the short form.
Only duplicated_code has keys of its own (Duplication):
| Key | What it is | Default |
|---|---|---|
min_tokens |
The fewest normalised tokens a block of code has for its copies to be duplicated code. A whole number, 20 or more. | 100 |
min_lines |
The fewest lines each copy of a block spans, from its first token to its last, for it to be duplicated code. A whole number, 1 or more. | 10 |
assay: cross_file: duplicated_code: exclude: ["lib/legacy/**"] min_tokens: 150 min_lines: 12exclude works differently for duplicated_code than for the other four checks: see Excluding code.
Asset checks
Section titled “Asset checks”The three asset checks are unused_assets, oversized_assets and missing_asset_variants. Each takes enabled, exclude and the keys of its own:
| Check | Keys of its own |
|---|---|
oversized_assets |
max_kb, image_extensions |
missing_asset_variants |
variants, image_extensions |
assay: assets: oversized_assets: max_kb: {3.0x: 2000} # changes only 3.0x; the other resolutions keep their default missing_asset_variants: variants: [2x]max_kb is laid over its default resolution by resolution. Every other value replaces its default whole.
Project-file checks
Section titled “Project-file checks”The five project-file checks are secret_in_shipped_file, cleartext_traffic_allowed, debuggable_app, app_backup_allowed and exported_component_without_permission. Each takes enabled and exclude, and <check>: false is the short form.
Only cleartext_traffic_allowed has a key of its own: allowed_hosts (default []), the hosts beside the local ones that the app may reach over plain HTTP. *.lan names every host below lan, as in the rule cleartext_request’s parameter of the same name. Every value replaces its default whole.