dart-run-static-analysis
Installation
SKILL.md
Analyzing and Fixing Dart Code
Contents
- Analysis Configuration
- Diagnostic Suppression
- Workflow: Executing Static Analysis
- Workflow: Applying Automated Fixes
- Examples
Analysis Configuration
Configure the Dart analyzer using the analysis_options.yaml file located at the package root.
- Base Configuration: Always include a standard rule set (e.g.,
package:lints/recommended.yamlorpackage:flutter_lints/flutter.yaml) using theinclude:directive. - Strict Type Checks: Enable strict type checks under the
analyzer: language:node to prevent implicit downcasts and dynamic inferences. Setstrict-casts: true,strict-inference: true, andstrict-raw-types: true. - Linter Rules: Explicitly enable or disable specific rules under the
linter: rules:node. Use a key-value map (rule_name: true/false) when overriding included rules, or a list (- rule_name) when defining a fresh set. Do not mix list and map syntax in the samerulesblock. - Formatter Configuration: Configure
dart formatbehavior under theformatter:node. Setpage_width(default 80) andtrailing_commas(automateorpreserve). - Analyzer Plugins: Enable custom diagnostics by adding plugins under the
analyzer: plugins:node. Ensure the plugin package is added as adev_dependencyinpubspec.yaml.