Code style check: StyleCop
Code Defect check: FxCop
Code Quality: Code metric/Code Metrics
StyleCop Introduction
The StyleCop tool provides warnings that indicate style and consistency rule violations in C # code. the warnings are organized into rule areas such as documentation, layout, naming, ordering, readability, spacing, and so forth. each warning signifies a violation of a style or consistency rule.
Install
This tool is not integrated into VS and needs to be installed separately
Http://stylecop.codeplex.com/
You can install different VS versions.
Analysis item settings
Set check items: do not select any items that do not check.
Generally, SA1200 is not selected.
Settings. StyleCop priority
The Settings. StyleCop setting items in the project directory take priority, and then combine the Settings. StyleCop setting items in the installation directory.
According to the above, the same inspection steps can be applied in a group:
Use the above steps to set the check content, you can see Settings in the project directory. styleCop: distribute the file to everyone, and overwrite the file under C: Program FilesMicrosoft StyleCop *** in the installation directory.
Analysis
Right-click the project and choose "Run StyleCop" to view the analysis result.
Specific troubleshooting methods:
Enter SA in the index column of the C: Program FilesMicrosoft StyleCop *** DocsStyleCop. chm document to view the cause and standard method.
FxCop Introduction
Code analysis tools help you detect and correct code defects.
Managed code analysis tools analyze hosted assembly and report information about the Assembly, such as conflicts between programming and design rules specified in Microsoft. NET Framework Design Guidelines. The analysis tool displays the check performed during the analysis as a warning.
This tool is integrated inMedium
Set and use
Ø the error information in the analysis, such as CA0001, can be found directly in the MSDN description and Solution
Ø because the analysis process is slow, it is recommended that you do not set "start code analysis at generation" in DEBUG mode. The DEBUG status can be set as needed, if the code is compiled to complete the test, manually analyze the changes from the menu, switch to the Release mode for generation and analysis, view the software running status, and check the code
Code metric value/Code Metrics
Ms-help: // MS. VSCC. v90/MS. MSDNQTR. v90.chs/dv_vsetsa01/html/952b6f2e-584f-4c97-a5ba-42d7bd47a576.htm
Code measurement is a set of software measurement values, allowing developers to better understand the code they are developing. With code measurement, developers can understand which types and/or methods should be reworked or tested more thoroughly. The development team can identify potential risks, understand the current status of the project, and track the progress of software development.