Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 710
SimonAx Avatar asked Jun 13 '16 19:06

SimonAx


People also ask

What is analysis code?

Analysis Codes are transactions that behave in certain ways on a statement. They describe the details of your transactions on a ledger. Arthur provides you with a set of default codes that tell a transaction how to behave. Two of the most common ones used are. Direct rent.

How many types of code analysis are there?

4 types of code analysis every developer should embrace.

What is code analysis tool?

Source code analysis tools, also known as Static Application Security Testing (SAST) Tools, can help analyze source code or compiled versions of code to help find security flaws. SAST tools can be added into your IDE. Such tools can help you detect issues during software development.

Why code analysis is required?

By using static code analysis, you can help developers find errors before they compile or run the code and alert them about any other issues, such as a lack of inline documentation, bad coding standards, security issues, performance issues, and so on.


1 Answers

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

enter image description here

like image 122
s952163 Avatar answered Oct 21 '22 01:10

s952163