FSharpLint
FSharpLint copied to clipboard
Add warnings for partial functions
Add warnings for partial functions such as List.head
or Option.get
I think this is a good addition, in my experience a lot of bugs can arise through using partial functions, and in most cases you shouldn't be using them when writing idiomatic F#.
My initial thought was that this could be achieved by adding hints, and it can to some degree, but with a dedicated rule we could also make use of typechecking information to check for instances of optionVar.Value
and similar usages.
It would be quite cool if the hints allow you to specify the type of a variable, that would enable this to be done via hints and enable other rules like unnecessary casts etc to be done via hints