Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mataku/danger-ktlint
A Danger Plugin to lint kotlin files using ktlint command line interface.
https://github.com/mataku/danger-ktlint
Last synced: 17 days ago
JSON representation
A Danger Plugin to lint kotlin files using ktlint command line interface.
- Host: GitHub
- URL: https://github.com/mataku/danger-ktlint
- Owner: mataku
- License: mit
- Created: 2018-11-11T09:20:24.000Z (about 6 years ago)
- Default Branch: develop
- Last Pushed: 2023-10-16T02:58:05.000Z (about 1 year ago)
- Last Synced: 2024-10-11T21:25:15.921Z (about 1 month ago)
- Language: Ruby
- Homepage:
- Size: 96.7 KB
- Stars: 11
- Watchers: 2
- Forks: 12
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-danger - danger-ktlint - A Danger Plugin to lint kotlin files using [ktlint](https://github.com/pinterest/ktlint) command line interface. (Plugins / Ruby (danger))
README
# danger-ktlint
Lint kotlin files only changed files in a pull request using ktlint command lint interface.
## Installation
```ruby
gem install danger-ktlint
```## Usage
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.
```bash
# Example
curl --output /usr/local/bin/ktlint -sL https://github.com/pinterest/ktlint/releases/download/$KTLINT_VERSION/ktlint && chmod a+x /usr/local/bin/ktlint
```Add this to Dangerfile.
```ruby
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 resultsDefault is `nil`, all comments are sent.
```shell
ktlint.limit = 3
ktlint.lint
```#### Skip ktlint task
Default is false.
```shell
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.lint
```## CHANGELOG
See [CHANGELOG.md](https://github.com/mataku/danger-ktlint/blob/master/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
1. Clone this repo
2. Run `bundle install` to setup dependencies.
3. Run `bundle exec rake spec` to run the tests.
4. Use `bundle exec guard` to automatically have tests run as you make changes.
5. Make your changes.