Code Analysis Settings: Custom Settings RRS feed

  • Question

  • Hi,

    We want certain coding standards to be implemented in our project. For that along with defined [Microsoft Rules] in {Code Analysis Settings}, we would like to introduce our own custom defined rules: e.g.

    if global variable is there then it must starts with {m_} i.e. module level variable. if it's scope is public then it must have {mP_}

    Can somebody guide us, how to implement it.


    • Moved by CoolDadTx Tuesday, July 26, 2016 1:45 PM Extensibility related
    Tuesday, July 26, 2016 8:19 AM


All replies

  • Code analysis rules are best implemented using Roslyn analyzers in VS 2015. For help with those you'll want to post on GitHub.

    For pre-Roslyn you'll need to implement FxCop rules.  That is covered in another forum as well.

    You might consider looking for a tool that already does this for you. StyleCop is a popular choice and may provide the rules you want. CodeRush can also help enforce rules (and it is extensible) but it might not be able to go to the level you are looking for.

    Michael Taylor

    Tuesday, July 26, 2016 1:44 PM
  • There are several tools that already implement nomenclature rules:

    - Stylecop

    - MZ-Tools (I am the author of this tool)

    - FWIW, next version VS "15" will provide nomenclature rules.

    My portal and blog about VSX: http://www.visualstudioextensibility.com
    Twitter: https://twitter.com/VSExtensibility
    MZ-Tools productivity extension for Visual Studio: http://www.mztools.com

    Wednesday, July 27, 2016 6:03 AM