Skip to main content

GitHub Action

Dart Code Metrics GitHub Action allows you to integrate Dart Code Metrics into your CI/CD process and get code quality reports inside PR's.

Usage

Create dartcodemetrics.yaml under .github/workflows with the following content (the default configuration listed):

dartcodemetrics.yaml
name: Dart Code Metrics

on: [push]

jobs:
check:
name: dart-code-metrics-action

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: dart-code-metrics
uses: dart-code-checker/dart-code-metrics-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

Inputs

Inputs

NameRequiredDescriptionDefault
github_token☑️Required to post a report on GitHub. Note: the secret GITHUB_TOKEN is already provided by GitHub and you don't have to set it up yourself.
github_patRequired if you had private GitHub repository in the package dependenciesPersonal access token must access to repo and read:user scopes
foldersList of folders whose contents will be scanned.[lib]
relative_pathIf your package isn't at the root of the repository, set this input to indicate its location.
pull_request_commentPublish detailed report commented directly into your pull request.false
analyze_report_title_patternConfigurable analyze report title pattern.Dart Code Metrics analyze report of $packageName
fatal_warningsTreat warning level issues as fatal.false
fatal_performanceTreat performance level issues as fatal.false
fatal_styleTreat style level issues as fatal.false
check_unused_filesAdditional scan for find unused files in package.false
check_unused_files_foldersList of folders whose contents will be scanned for find unused files.Taken from folders argument
unused_files_report_title_patternConfigurable unused files report title pattern.Dart Code Metrics unused files report of $packageName

Output example

Analysis result

Analysis result example

Annotation

Annotation example