Lint for C# [closed]

痞子三分冷 提交于 2020-08-20 18:11:17

问题


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?


回答1:


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




回答2:


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).




回答3:


SonarLint (free, open source) is pretty sweet!

SonarLint for Visual Studio is based on and benefits from the .NET Compiler Platform ("Roslyn") and its code analysis API to provide a fully-integrated user experience in Visual Studio 2015. SonarLint is free, open source, and available in the Visual Studio Gallery.




回答4:


Gendarme for Mono is similar to FxCop




回答5:


You can try .Net Reflector by Red-Gate, you can get it from here. Many useful plugins for .Net Reflector are available on CodePlex which you can get it from here.




回答6:


This question already has an answer, but for reference...

You can try PVS-Studio. That's not free, but, IMHO, must have one. Quote from their site:

PVS-Studio is a tool used to detect bugs in the source code of programs written in C, C++ and C#.

PVS-Studio performs static code analysis and generates a report that helps a programmer find and fix bugs. PVS-Studio does a wide range of code checks; but it is especially useful to search for misprints and Copy-Paste errors.

The analyzer is designed for developers who use Visual Studio.



来源:https://stackoverflow.com/questions/748631/lint-for-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!