https://github.com/tmspzz/danger-hlint
A Danger plugin for Hlint - https://rubygems.org/gems/danger-hlint
https://github.com/tmspzz/danger-hlint
danger haskell hlint
Last synced: 5 months ago
JSON representation
A Danger plugin for Hlint - https://rubygems.org/gems/danger-hlint
- Host: GitHub
- URL: https://github.com/tmspzz/danger-hlint
- Owner: tmspzz
- License: mit
- Created: 2017-07-04T22:19:14.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-04-24T08:03:51.000Z (almost 6 years ago)
- Last Synced: 2024-10-27T09:04:19.531Z (6 months ago)
- Topics: danger, haskell, hlint
- Language: Ruby
- Homepage:
- Size: 20.5 KB
- Stars: 6
- Watchers: 4
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-danger - danger-hlint - A Danger plugin for Hlint. (Plugins / Ruby (danger))
README
# Danger HLint [](https://badge.fury.io/rb/danger-hlint)
A Danger plugin for [HLint](https://github.com/ndmitchell/hlint)
Read a full how to at [http://allocinit.io/haskell/danger-and-hlint/](http://allocinit.io/haskell/danger-and-hlint/)
## Installation
Add this line to your Gemfile:
```ruby
gem 'danger-hlint'
```## Usage
Methods and attributes from this plugin are available in
your `Dangerfile` under the `hlint` namespace.At the moment one single method is exposed: `hlint.lint`
If you want the lint results to show in the diff instead of in the comments, you can use the `inline_mode` option.
Violations that occur out of the diff will show in danger's fail or warn section. Here's a minimal example of what to add to your `Dangerfile` (read the inline comments):```ruby
# get all affected files by the changes in the current diff
affected_files = git.added_files + git.modified_files# limit files to .hs files
haskell_files = affected_files.select { |file| file.end_with?('.hs') }# run hlint on the files and comment inline in the PR
hlint.lint haskell_files, inline_mode: true```
To pass other parameters to the linter just add them to the method call. The
names and values of the parameters to the `hlint.lint` method are handed over to linter.For example, you can specify a hint file by calling
```ruby
hlint.lint files hint: ".hlint.yaml"
```To pass switches to the linter (like `--quiet`) specify `true` as the value in the call
```ruby
hlint.lint files quiet: true
```## Warning
When running `danger-hlint` on your CI server **(especially CircleCI 2.0)** make sure that the `hlint` binary is in your `PATH`, else this plugin will silently fail to produce any linting output. One possible way to do this (in CircleCI 2.0) is:
```
- run:
name: "Running HLint (via danger-hlint)"
command: |
export PATH="$HOME/.local/bin:$PATH"
bundle exec danger
```## 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.## Attribution
Some methods and ideas are almost copied unchanged from [Danger SwiftLint](https://github.com/ashfurrow/danger-swiftlint)
## License
danger-hlint is released under MIT License