FSharpLint
FSharpLint copied to clipboard
Running FSharpLint from CI
Hello, While running fsharplint against a medium sized project I found the tool to be really slow. Is there any documentation for how to efficiently run this tool from a CI server so lint rules can be enforced at build time and reviewed during code-review.
Example command
find ./src -name "*.fs" | xargs -L {} -n 1 dotnet fsharplint lint {}
I have also considered running this with parallel but it's difficult to maintain as time goes on.
Hi @taion809
Have you tried running the linter against the project file rather than individual source files? Although that may potentially be even slower as it will add type checking into the mix. It's worth a shot although I don't have any stats to hand as to how they would compare.
We make heavy use of the FSharp Compiler Service which is parsing the files to build up the AST we're working off of, this is where the majority of the runtime lies. Once we have the parse results we're usually looking at sub 100ms per file (able to run per keystroke in IDEs)
Have you got the option to run two jobs in parallel for the build stage of your ci? If you could run a lint job in parallel to a build job, the linter should finish slightly earlier than the build
as it will add type checking into the mix
Hey @duckmatt I wanted to ask you about this statement of yours. Are there any rules that have more features if they check types? Or any rule that doesn't work if types are not checked? To put it another way: does FSharpLint work at all if the project actually has compilation errors?
@knocte it does continue to work without type checking, the type checking helps with the correctness of rules but it is able to fall back to only non-typed, in most cases it will simply not warn when there's not enough information to make a proper judgement (when not running with type checking).
The cases where the type checking is used for correctness is for things like detecting whether an expression is a named parameter vs boolean statement