Search code examples
stylecop

How do I stop Stylecop settings defaulting to top parent


I am trying to create a StyleCop settings for the projects we have here. My idea is that I will update the settings and store in Subversion so that it is automatically set up properly.

Some of the rules are disable by default in the top-level settings (in Program Files) so I have re-enabled them in my project and have gained rules like this:

<Rule Name="DocumentationTextMustBeginWithACapitalLetter">
  <RuleSettings>
    <BooleanProperty Name="Enabled">True</BooleanProperty>
  </RuleSettings>
</Rule>

Now the thing I wanted was to have one large file with every rule explicitly set or not but even if I set the file to not merge with the parent it only enables or disables rules that are different to the one in Program Files.


Solution

  • You are not quite right about root settings file. In fact, it is empty (unless you have edited it).

    The thing you are dealing with is default properties. Some rules are enabled by default, some are disabled. This information is not stored in any settings file, it is stored in StyleCop assembly in fact.

    And, when you save your settings file, it will never save the settings which are equal to the default ones indeed.