├── README.md ├── action.yml ├── dart-problem-matcher.json ├── main.js └── screenshot.png /README.md: -------------------------------------------------------------------------------- 1 | # dart-problem-matcher 2 | 3 | ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/leancodepl/dart-problem-matcher) 4 | 5 | A GitHub Action that annotates your Dart (or Flutter) analyzer warnings and errors and helps you spot them right in the code. 6 | 7 | ![Two warning annotations for "Sort directive sections alphabetically" shown right in the Pull Request's Files changed tab.](screenshot.png) 8 | 9 | ## Usage 10 | 11 | Simply add the step somewhere above your `dart/flutter analyze` in your steps list in GitHub Workflow: 12 | 13 | ```yaml 14 | jobs: 15 | test: 16 | steps: 17 | - uses: leancodepl/dart-problem-matcher@main 18 | 19 | - run: dart analyze # or flutter analyze 20 | # other steps... 21 | ``` 22 | 23 | ## Known limitations 24 | 25 | * [GitHub Problem Matchers](https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md) allow only up to 10 warning and 10 error annotations per step. 26 | * Only analyzer's `warning` and `error` severity problems will be annotated, `info` will be not. -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: dart-problem-matcher 2 | description: Problem matcher for Dart analyze and Flutter analyze issues 3 | author: LeanCode 4 | runs: 5 | using: 'node16' 6 | main: 'main.js' 7 | branding: 8 | color: 'gray-dark' 9 | icon: 'edit-3' -------------------------------------------------------------------------------- /dart-problem-matcher.json: -------------------------------------------------------------------------------- 1 | { 2 | "problemMatcher": [ 3 | { 4 | "owner": "dart-analyze", 5 | "pattern": [ 6 | { 7 | "regexp": "(\\w+)\\s+[•-]\\s+(.+)\\s+[•-]\\s+(.+):(\\d+):(\\d+)\\s+[•-]\\s+(.*)$", 8 | "severity": 1, 9 | "message": 2, 10 | "file": 3, 11 | "line": 4, 12 | "column": 5, 13 | "code": 6 14 | } 15 | ] 16 | } 17 | ] 18 | } -------------------------------------------------------------------------------- /main.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | 3 | const matcherPath = path.join(__dirname, 'dart-problem-matcher.json'); 4 | console.log(`::add-matcher::${matcherPath}`); -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leancodepl/dart-problem-matcher/db2c48534f89233ae58cb81a45ebc8fd21d90bff/screenshot.png --------------------------------------------------------------------------------