Add 'fromIntegral' inspection as anti-pattern
- Dominant language
- Haskell
- Stars
- 597
- Forks
- 53
- PR merge metrics
- No merged PRs in 30d
Description
`fromIntegral` produces unexpected results for almost all types and is partial for `Natural`. We can recommend safer versions of this function.
* `toIntegralSized` from `base`
Additionally, we can add possible solutions for already existing `fromInteger` inspection:
* Suggest `integerToBounded`
* Suggest `integerToNatural`
Contributor guide
Research direction
Start by locating the existing `fromInteger` inspection and its tests, then follow how inspections produce suggestions. Add a `fromIntegral` anti-pattern inspection recommending `toIntegralSized`, and extend the existing recommendations with `integerToBounded` and `integerToNatural`. Done means the diagnostics and their expected suggestions are covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100