Migrate complexity linting to package:cognitive_complexity #333
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: dart_skills_lint | |
| permissions: | |
| contents: read | |
| on: | |
| pull_request: | |
| paths: | |
| - 'skills/**' | |
| - 'tool/dart_skills_lint/**' | |
| - '.github/workflows/dart_skills_lint_workflow.yaml' | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - 'skills/**' | |
| - 'tool/dart_skills_lint/**' | |
| - '.github/workflows/dart_skills_lint_workflow.yaml' | |
| schedule: | |
| - cron: '0 0 * * 0' # weekly | |
| defaults: | |
| run: | |
| working-directory: tool/dart_skills_lint | |
| jobs: | |
| analyze_and_test: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| 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 | |
| - run: dart analyze --fatal-infos | |
| - 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 | |
| - name: Verify API boundary runner example | |
| run: | | |
| cd example/api_boundary_runner | |
| dart pub get | |
| dart format --output=none --set-exit-if-changed . | |
| dart analyze --fatal-infos . | |
| dart run bin/main.dart | |
| coverage: | |
| 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 | |
| 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 | |
| - run: dart format --output=none --set-exit-if-changed . | |
| pana_score: | |
| 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: Install pana | |
| run: dart pub global activate pana | |
| # pana --exit-code-threshold N fails the step when | |
| # (max - granted) > N. Threshold 0 means any point drop fails; | |
| # current package score is 160/160 and we want to keep it there. | |
| - name: Pana score gate (160/160 required) | |
| run: dart pub global run pana --no-warning --exit-code-threshold 0 . |