danger-ktlint
Lint kotlin files only changed files in a pull request using ktlint command lint interface.
Installation
gem install danger-ktlintUsage
You need to install ktlint command and set as executable first, see: https://ktlint.github.io/#getting-started.
If you want to skip ktlint task, for example to only comment on the results of ktlint, no need to install ktlint. See https://github.com/mataku/danger-ktlint#skip-ktlint-task.
# Example
curl --output /usr/local/bin/ktlint -sL https://github.com/pinterest/ktlint/releases/download/$KTLINT_VERSION/ktlint && chmod a+x /usr/local/bin/ktlintAdd this to Dangerfile.
ktlint.lint
# If you want inline comments, specify `ktlint.lint` with `inline_mode: true`
# ktlint.lint(inline_mode: true)Options
Set maximum number of comments of ktlint results
Default is nil, all comments are sent.
ktlint.limit = 3
ktlint.lintSkip ktlint task
Default is false.
ktlint.skip_lint = true
# If skip_lint is specified, report_file must also be specified.
ktlint.report_file = 'result.json'
# If you use ktlint in multiple modules app, you can specify multiple ktlint result json.
# ktlint.report_files_pattern = '**/result.json'
ktlint.lintCHANGELOG
See CHANGELOG.md.
TODO
- filtering: false (default: filtering: true behavior)
- Allow plain or html report_file (Currently only JSON is supported.)
- Install ktlint and use it if ktlint binary does not exist
- Support for services other than GitHub
Development
- Clone this repo
- 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.