Tooling & CI
Priority: P1 (HIGH)
Implementation Guidelines
- Linter: Use
analysis_options.yaml. Enforcealways_use_package_importsandrequire_trailing_commas. - Formatting: Use
dart format . --line-length 80. Run on every commit. - DCM: Use
dart_code_metricsfor complexity checks (Max cyclomatic complexity: 15). - Build Runner: Always use
--delete-conflicting-outputswith code generation. - CI Pipeline: All PRs MUST pass
analyze,format, andteststeps. - Imports: Group imports:
dart:,package:, then relative. - Documentation: Use
///for public APIs. Link symbols using[Class]. - Linting Commands:
flutter analyze --fatal-infos --fatal-warningsdart run dart_code_metrics:metrics analyze lib- Pre-commit: Keep
lefthook.ymlin sync with analyze/format/metrics commands.
Code
# analysis_options.yaml
analyzer:
errors:
todo: ignore
missing_required_param: error
linter:
rules:
- prefer_single_quotes
- unawaited_futures
Anti-Patterns
- No build_runner without --delete-conflicting-outputs: Causes stale generated file conflicts that break compilation.
- No flutter build before flutter analyze: Analyze fast; always fail fast before building.
- No ignore comment without explanation: Always annotate why lint ignore justified.
- No skipping dart format in pre-commit: Unformatted code breaks CI; enforce via
lefthook.yml.
References
- language | testing