Integrated StyleCop to Jenkins CI

Source: Internet
Author: User
Tags jenkins ci

This is the STYLECOP after the integration of Jenkins, you can see the code review results with each build changes the chart, build history can see #150 before the build state is unstable, which is and STYLECOP Review the number of non-conforming requirements:

1. Install StyleCop First

2. Edit the project file you want to scan for code review *.csproj:

All right, now, whether we build with the IDE or MSBuild, we'll do a STYLECOP code review check, and by default all the checked results will be set to build warnings. If you want to change to build errors, you can set the stylecoptreaterrorsaswarnings of the environment variable or build environment variable to false, or you can edit the. csproj file in the first PropertyGroup Add stylecoptreaterrorsaswarnings tag to false in section:

3. If there is a third-party code or the IDE automatically generated code, you need to stylecop skip scanning, there are three ways to make it do not code review:

    • Change the file suffix to ". Designer.cs "
    • Code that you don't want to be review in C # region "generated code"
    • Put "//<auto-generated/>" in the code.

4. Jenkins installs the Jenkins violations plugin plugin:

5. Set up the Jenkins job to open report violations:

The XML filename pattern needs to specify the STYLECOP result file that is generated after the project is compiled, which by default is in the project's obj\release\ Stylecopviolations.xml, you can copy it to the workspace root of Jenkins in the build script.

Well, each build will produce a violations report, and a detailed list can be viewed by the developer:

Integrated StyleCop to Jenkins CI

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.