Danger Dart Linter
A Danger Plugin to lint dart files using dart analyze command line interface.
Installation
Add this line to your application's Gemfile:
$ gem 'danger-dart-linter'
Or install it yourself as:
$ gem install danger-dart-linter
Usage
Dart Analyze doesn't give an option to generate report but you can achieve this easily using regular shell command (locally or on CI):
$ dart analyze > dart_analyze_report.txt
It will add output from dart analyze command to dart_analyze_report.txt.
Now you need to set report_path and invoke lint in your Dangerfile.
dart_linter.report_path = "dart_analyze_report.txt"
dart_linter.lint
This will add markdown table with summary into your PR.
Or make Danger comment directly on the line instead of printing a Markdown table (GitHub only)
dart_linter.lint(inline_mode: true)
Default value for inline_mode parameter is false.
Lint only added/modified files
If you're dealing with a legacy project, with tons of warnings, you may want to lint only new/modified files. You can easily achieve that, setting the only_modified_files parameter to true.
dart_linter.only_modified_files = true
dart_linter.report_path = "dart_analyze_report.txt"
dart_linter.lint
Development
- Clone this repo
- Run
gem install bundlerto configure environment tools. - Run
bundle installto setup dependencies. - Run
bundle exec rake specto run the tests. - Use
bundle exec guardto automatically have tests run as you make changes. - Make your changes.
Contributing
Merge requests are welcome on GitLab at https://gitlab.com/fasunna/danger-dart-linter.
License
The gem is available as open source under the terms of the MIT License.
⚠️ Disclaimer: This project is a copy and continuation of danger-flutter_lint by mateuszszklarek. All original work belongs to the author.