diff --git a/.github/workflows/dart_skills_lint_workflow.yaml b/.github/workflows/dart_skills_lint_workflow.yaml index e27a11e0..c211fa82 100644 --- a/.github/workflows/dart_skills_lint_workflow.yaml +++ b/.github/workflows/dart_skills_lint_workflow.yaml @@ -40,8 +40,8 @@ jobs: - run: dart analyze --fatal-infos - - name: Run cyclomatic complexity check - run: dart run dart_code_linter:metrics analyze lib test + - name: Run cognitive complexity check + run: dart run cognitive_complexity --fail-threshold 48 tool/dart_skills_lint/lib tool/dart_skills_lint/test - run: dart test @@ -54,11 +54,31 @@ jobs: dart run bin/main.dart coverage: - uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/dart_package.yml@75f342c5d0b8c8adde3a2b7ea101e7e47897d1fc # v1 - with: - working_directory: tool/dart_skills_lint - min_coverage: 73 - coverage_excludes: '**/*.g.dart' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: dart-lang/setup-dart@65eb853c7ba17dde3be364c3d2858773e7144260 # v1.7.2 + with: + sdk: stable + + - run: dart pub get + + - name: Collect coverage + run: dart test --coverage=coverage + + - name: Format coverage to LCOV + run: dart run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --report-on=lib + + # Action steps do not inherit defaults.run.working-directory, so this + # path is relative to the repository root. + - name: Enforce coverage threshold + uses: VeryGoodOpenSource/very_good_coverage@c953fca3e24a915e111cc6f55f03f756dcb3964c # v3 # zizmor: ignore[archived-uses] + with: + path: tool/dart_skills_lint/coverage/lcov.info + min_coverage: 73 + exclude: '**/*.g.dart' formatting: runs-on: ubuntu-latest diff --git a/tool/dart_skills_lint/.agents/skills/definition-of-done/SKILL.md b/tool/dart_skills_lint/.agents/skills/definition-of-done/SKILL.md index ec619164..e9d4c6d8 100644 --- a/tool/dart_skills_lint/.agents/skills/definition-of-done/SKILL.md +++ b/tool/dart_skills_lint/.agents/skills/definition-of-done/SKILL.md @@ -15,10 +15,13 @@ Before stating that a task is complete, you MUST execute and pass the following 1. **Format**: Run `dart format .` to format files, or `dart format --output=none --set-exit-if-changed .` to check without modifying. Ensure all files are formatted correctly. 2. **Analysis**: Run `dart analyze --fatal-infos` and ensure there are zero issues (including info-level issues). -3. **Metrics**: Run `dart run dart_code_linter:metrics analyze lib` and ensure there are zero issues. This checks for cyclomatic complexity and custom rules like file naming and redundant async. +3. **Metrics**: Run `dart run cognitive_complexity --fail-threshold 48 lib test` and ensure there are zero issues. This checks for cognitive complexity. 4. **Tests**: Run `dart test` and ensure all tests pass successfully. 5. **Skills**: If any skill files were modified, run `dart run dart_skills_lint -d .agents/skills` to ensure they are valid. -6. **Changelog**: Ensure `CHANGELOG.md` is updated if the task includes user-facing features, bug fixes, or behavioral changes. Audit all entries against the *previously released version* (do not document changes to intermediate PR development code or new unreleased APIs as breaking changes). +6. **Changelog**: If the task introduces user-facing CLI flags, package API changes, bug fixes, or user-facing behavioral changes, update `CHANGELOG.md`. + - **Do NOT log internal chores**: Do not add entries for internal CI workflows, dev dependency updates/migrations, test refactoring, or repository infrastructure scripts. + - **Explicit N/A**: If the task is internal-only, leave `CHANGELOG.md` untouched and output `[x] Changelog: (N/A) `. + - Audit all entries against the *previously released version* (do not document changes to intermediate PR development code or new unreleased APIs as breaking changes). 7. **Temporal**: Ensure that code and code comments contain no relative temporal terms (e.g., 'now', 'currently', 'new', 'old', 'existing behavior'). 8. **Documentation**: Ensure that any relevant documentation is updated. diff --git a/tool/dart_skills_lint/.agents/skills/definition-of-done/evals/evals.json b/tool/dart_skills_lint/.agents/skills/definition-of-done/evals/evals.json index 687ac4f7..6fa3dee6 100644 --- a/tool/dart_skills_lint/.agents/skills/definition-of-done/evals/evals.json +++ b/tool/dart_skills_lint/.agents/skills/definition-of-done/evals/evals.json @@ -8,13 +8,16 @@ "prompt": "Modify tool/dart_skills_lint/lib/src/levenshtein.dart to add a comment explaining how the algorithm calculates distance (e.g. tracking deletion, insertion, substitution cost), and make sure you finish the task completely.", "expected_chat_output": [ "The agent confirms it added an explanatory comment about how edit distance is calculated to levenshtein.dart.", - "The agent outputs a text list of all definition-of-done rules in the format '[x] Identifier: Explanation' (if done) or '[ ] Identifier: Skipped explanation' (if skipped)." + "The agent outputs a text list of all definition-of-done rules in the format '[x] Identifier: Explanation' (if done) or '[ ] Identifier: Skipped explanation' (if skipped).", + "The agent confirms it executed cognitive complexity metrics ('dart run cognitive_complexity') and found zero issues.", + "The agent's definition-of-done checklist marks Changelog as N/A (e.g. '[x] Changelog: (N/A) ...') because adding comments is non-user-facing." ], "expected_repo_state": [ "The levenshtein.dart file contains a new comment explaining how edit distance is calculated.", "The new comment does not contain any relative temporal words such as 'now', 'currently', 'new', 'old', or 'existing'.", "The levenshtein.dart file is formatted cleanly according to dart format.", - "The project has no dart analyze errors or warnings." + "The project has no dart analyze errors or warnings.", + "CHANGELOG.md is not modified because adding internal comments is non-user-facing." ], "agent_config": "reidbaker-agent" } diff --git a/tool/dart_skills_lint/analysis_options.yaml b/tool/dart_skills_lint/analysis_options.yaml index 9655077b..df98b2fe 100644 --- a/tool/dart_skills_lint/analysis_options.yaml +++ b/tool/dart_skills_lint/analysis_options.yaml @@ -270,8 +270,6 @@ linter: - void_checks dart_code_linter: - metrics: - cyclomatic-complexity: 20 rules: # Explicit typing - avoid-dynamic diff --git a/tool/dart_skills_lint/pubspec.yaml b/tool/dart_skills_lint/pubspec.yaml index aa5d0076..2214978a 100644 --- a/tool/dart_skills_lint/pubspec.yaml +++ b/tool/dart_skills_lint/pubspec.yaml @@ -33,6 +33,7 @@ dev_dependencies: test_process: ^2.1.1 json_serializable: ^6.7.0 build_runner: ^2.4.0 + cognitive_complexity: ^0.2.0 dart_code_linter: ^4.0.3 coverage: ^1.15.0