Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lint for C# [closed]

Is there a lint-like tool for C#? I've got the compiler to flag warnings-as-errors, and I've got Stylecop, but these only catch the most egregious errors. Are there any other must-have tools (especially for newbie C#ers like me) that point out probably-dumb things I'm doing?

like image 584
Ken Avatar asked Apr 14 '09 17:04

Ken


People also ask

What is the lint in C?

Linting is the automated checking of your source code for programmatic and stylistic errors. This is done by using a lint tool (otherwise known as linter). A lint tool is a basic static code analyzer. The term linting originally comes from a Unix utility for C.

Why is it called a linter?

The term linter comes from a tool originally called “lint” that analyzed C source code. The computer scientist Stephen C. Johnson developed this utility in 1978 when he worked at Bell Labs.

What does it mean to lint a file?

So what is linting? lint, or a linter, is a tool that analyzes source code to flag programming errors, bugs, stylistic errors, and suspicious constructs.

What linter means?

Definition of linter 1 : a machine for removing linters. 2 linters plural : the fuzz of short fibers that adheres to cottonseed after ginning.


2 Answers

Tried FxCop? It's integrated into VS as "Code Analysis"

In the newer versions of Visual Studio, it is called "Microsoft Code Analysis" and can be downloaded from the Visual Studio Marketplace: https://marketplace.visualstudio.com/items?itemName=VisualStudioPlatformTeam.MicrosoftCodeAnalysis2017

like image 69
mmx Avatar answered Sep 22 '22 01:09

mmx


Resharper performs a fair bit of static analysis as well as doing a ton of other useful things. Since version 8.0 analysis can run in command line mode. Currently I wouldn't code in C# without it.

As well as FxCop, Gendarme is another tool to look at (it is Mono's version of FxCop but they are different in approach and the errors that they actually find).

like image 38
Kris Erickson Avatar answered Sep 23 '22 01:09

Kris Erickson