Suggests possible improvements to Haskell code
open sourceBSD-3-Clauseself-hostablefree
HLint is the standard linter for Haskell. It reads Haskell files or whole directories and suggests improvements: alternative functions (concatMap for concat . map), simpler code, fewer brackets and redundancies, each marked as a warning or a suggestion with what it found and what to write instead. Hints are configured in a .hlint.yaml file, where you can turn hints off, add your own and set the language extensions. With the --refactor flag and the apply-refact tool it rewrites files to apply many of its hints. It's built into haskell-language-server, Code Climate and Restyled, and a GitHub Action runs it for code scanning. Neil Mitchell maintains it, BSD-3-Clause licensed.
Problems it solves
- lint my Haskell code and get suggestions for simpler, more idiomatic expressions
- find redundant brackets, unused patterns and needless lambdas in a Haskell project
- enforce custom style rules across a Haskell codebase in CI
- automatically apply lint suggestions to Haskell files
- show Haskell lint hints in my editor through the language server
- run a Haskell linter as GitHub code scanning on pull requests
Features
- suggestions to use better functions, simplify code and remove redundancy
- warnings and suggestions with the found code and its replacement
- .hlint.yaml configuration: ignore hints, add custom hints, set extensions
- --refactor applies hints automatically with apply-refact
- runs on files or recursively on directories
- built into haskell-language-server
- Emacs, Vim and Atom integrations
- GitHub code scanning through the hlint-scan action
Limitations
- HLint checks each module in isolation without type information or knowledge of which names are in scope, so some suggestions may need type signatures or change behaviour
Capabilities
| Has a command line tool | plan not known |
|---|
Alternatives
The same job
These do what HLint does.
- PHP_CodeSniffer Detect and fix coding standard violations in PHP
- ansible-lint Checks playbooks for practices and behavior that could potentially be improved
- TFLint A Pluggable Terraform Linter
