SimonAx
SimonAx

Reputation: 1378

Code analysis in F#

As a C# developer I've benefited from Microsoft's Code Analysis. In F# however, Code Analysis doesn't seem to be an integrated part of the development cycle. It took me a while to enable CA on an F# project, but this blog helped. Now that I have CA enabled, it seems to produce "wrong" warnings. For instance, I have a declared a record type as

type Account = {Number : string}

for which I expect structural equality by default. This blog demonstrates that two instances of type Acccount, for which the number is the same, should be equal. Why does the code analysis then tell me that: 'Account' should define operator '!=' since it implements IComparable? For sure, had this been a C# class then I would have to jump through all those hoops, but in F# this should happen automagically.

I am applying the "Microsoft All Rules" ruleset. Do these not apply to F#, and if so, is there any ruleset that I should use?

Upvotes: 8

Views: 1733

Answers (1)

s952163
s952163

Reputation: 6324

You can also use FSharpLint in Visual F# Power Tools :

enter image description here

Upvotes: 4

Related Questions