| 항목 | 내용 |
|---|---|
| Model | inherit |
DCM Fixer Agent#
A specialized agent for safely fixing DCM (Dart Code Metrics) lint issues one rule at a time.
Absolute Rules#
- // ignore comment prohibited - Resolve all issues with actual code fixes
- Never modify package/coui/ - External UI library
- No modifying generated code in package/openapi/ - Only scripts in assets/schema/ can be modified
- No class name changes - prefer-match-file-name resolved by changing declaration order only
- No file name changes - Risk of broken imports
- Never remove getIt
() generic types - Type inference fails - Never remove barrel export imports - re-exports from core.dart, etc.
-
Never delete table direct imports in Drift database files - Even if
unnecessary_importwarnings appear in*_database.dart, deleting table imports prevents code generation in.g.dart. To suppress IDE warnings, add the symbol to thehidelist of the core import -
dart fix --applyprohibited - May incorrectly remove barrel exported imports (especially Drift tables) - Never change async methods to void - Breaks caller unawaited/await
- Never carelessly remove late keyword - Essential for StreamController circular reference pattern
-
Never add unnecessary statements like
0;to empty blocks - Causes unnecessary_statements
Work Process#
Step 1: Check Issue List#
dcm analyze . 2 > & 1 | grep -B3 " RULE_NAME " | grep " at " | sed ' s/.*at // '
Step 2: Read File -> Fix#
- Always read the file and understand context before modifying
- Fix multiple issues in one file at once
Step 3: Verify with Flutter analyze After Fix#
dart format . 2 > & 1 | tail -2
melos run analyze 2 > & 1 | grep " issues found " | grep -v " No issues "
-
If Flutter analyze shows errors, revert immediately:
git checkout -- <file>
Step 4: Verify DCM Issue Reduction#
dcm analyze . 2 > & 1 | tail -3
Fix Guide by Rule#
avoid-nullable-interpolation#
// Bad: '$nullableVar'
// Good: '${nullableVar ?? ""}'
no-equal-switch-expression-cases#
// Bad: 같은 body를 가진 case 분리
// Good: case1 || case2 => sameBody
prefer-correct-identifier-length#
// Bad: (e) => e.value
// Good: (item) => item.value
// 예외: t(translations), i/p(jaspr HTML)
no-empty-block#
- test files are excluded in analysis_options.yaml
- Empty blocks in production code: add meaningful comments or logic
- Do not add unnecessary statements like
0;
avoid-wildcard-cases-with-enums#
// Bad: _ => defaultValue
// Good: EnumType.value1 || EnumType.value2 => defaultValue
avoid-wildcard-cases-with-sealed-classes#
// Bad: _ => defaultWidget
// Good: SealedSubtype1() || SealedSubtype2() => defaultWidget
prefer-match-file-name#
- Resolve by changing declaration order instead of renaming class
- Change order so the first top-level declaration matches the filename
avoid-dynamic#
// Bad: dynamic value
// Good: Object? value
// 예외: Map<String, dynamic>은 JSON 처리에 필수
prefer-extracting-callbacks#
- Extract inline callbacks to separate methods
- Use local functions in HookWidget
avoid-shadowing#
- Rename variables that shadow outer scope names
prefer-null-aware-elements#
// Bad: if (value != null) value,
// Good: ?value,