0

We are currently introducing a zero compiler warning guideline for our checkins.

But there are other things to check. For general static code analysis rules we can use FxCop and co (unused variables etc).

But what about naming conventions (variables, constants, class names etc)? For example we're having some special naming convention (e.g. we use the m_ prefix when declaring a private member).

Are there ways / tools to check these naming conventions we have, similar the way ReSharper does it?

I would like to integrate those convention checks into our gated checkins and usual build definitions, but haven't found any way to do it yet.

Jannik
  • 2,310
  • 6
  • 32
  • 61
  • StyleCop is just a tool. However questions about tools and tutorials are off-topic on this site. – MakePeaceGreatAgain Aug 07 '17 at 10:20
  • Which site do you want me to put it at? – Jannik Aug 07 '17 at 10:22
  • An alternative approach, if you're running VS2017, is [Code Style Configurations](https://blogs.msdn.microsoft.com/dotnet/2016/12/15/code-style-configuration-in-the-vs2017-rc-update/) and mark your specific style as an Error. It's not exactly what you're asking for. But it can serve as an alternative. – smoksnes Aug 07 '17 at 10:33
  • I'm not sure questions _about_ StyleCop are off topic, what's off topic is _asking_ for a tool. Have a look at [Best way to integrate StyleCop with TFS CI](https://stackoverflow.com/questions/557773/best-way-to-integrate-stylecop-with-tfs-ci) – stuartd Aug 07 '17 at 10:53

1 Answers1

1

To integrate with TFS, you could create a code analysis check-in policy for your project.

Check-in policies are specified and enforced for a team project, but code analysis runs are configured and run for individual code projects on local development computers.

This tutorial describes how to specify code analysis check-in policies for a team project and how to implement custom code analysis policies for managed code.

How to add words and tokens to the dictionary that is referenced in code analysis naming rules, please refer: Customize the Code Analysis Dictionary

Another way is using some 3-party tool just like comment suggested and use the tool integrate with TFS.

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62