Merge with parent - not working...

Dec 19, 2011 at 2:32 PM

Hi,

I have Setting.StyleCop file in the same folder where my .csproj is. In these settings only rule SA1502 is marked.

I have another Setting.StyleCop file one folder above it. In these settings only rule SA1501 is marked.

These are the only 2 Setting.StyleCop files, and there are no other files elsewhere.

In the StyleCopEditor i go to "Setting Files" and there i choose: "Merge with setting file found in parent folder". If i understand correctly, both rules, SA1502 and SA1501, should now be applied to my project - shouldn't they?

 

For some reason, it doesn't happen and only rule SA1502 is applied.

 

Any ideas?

 

Thanks.

Developer
Dec 19, 2011 at 6:45 PM

Hi itziksaban,

When you say "In these settings only rule SA1502 is marked" do you mean that your settings file looks like the following?

<StyleCopSettings Version="105">
  <Analyzers>
    <Analyzer AnalyzerId="StyleCop.CSharp.NamingRules">
      <Rules>
        <Rule Name="ElementMustBeginWithUpperCaseLetter">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="ElementMustBeginWithLowerCaseLetter">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="InterfaceNamesMustBeginWithI">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="ConstFieldNamesMustBeginWithUpperCaseLetter">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        ...
      <AnalyzerSettings />
    </Analyzer>
  </Analyzers>
</StyleCopSettings>

with a lot of "False"s inside... (in this case UI dialog should be full of bold entries).

With such a configuration your file tells to "disable all the rules, and don't change enableness for SA1502 (which is actually inherited from the parent settings)".
I also guess that you could even finally put the checkbox on SA1502 - that explains why it is works despite it is disabled in the root file.

The point is the following - if you see something bold in UI editor, it means that this setting is set up in this file. Other settings, which are not bold, display their calculated value, inherited from parent files. In other words, setting files hold only the differences from the parent ones, if needed.

Just confirm me that my guess is right, and I could explain how it works in more details.

Best regards,
Oleg Shuruev

Dec 19, 2011 at 8:00 PM
Hi shuruev,

I'm sorry, I've recheked it again and it works well...

I didn't have the time to write a new post to cancel my original one.

Thank's anyway :)

2011/12/19 shuruev <notifications@codeplex.com>

From: shuruev

Hi itziksaban,

When you say "In these settings only rule SA1502 is marked" do you mean that your settings file looks like the following?

<StyleCopSettings Version="105">
  <Analyzers>
    <Analyzer AnalyzerId="StyleCop.CSharp.NamingRules">
      <Rules>
        <Rule Name="ElementMustBeginWithUpperCaseLetter">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="ElementMustBeginWithLowerCaseLetter">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="InterfaceNamesMustBeginWithI">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        <Rule Name="ConstFieldNamesMustBeginWithUpperCaseLetter">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
        ...
      <AnalyzerSettings />
    </Analyzer>
  </Analyzers>
</StyleCopSettings>

with a lot of "False"s inside... (in this case UI dialog should be full of bold entries).

With such a configuration your file tells to "disable all the rules, and don't change enableness for SA1502 (which is actually inherited from the parent settings)".
I also guess that you could even finally put the checkbox on SA1502 - that explains why it is works despite it is disabled in the root file.

The point is the following - if you see something bold in UI editor, it means that this setting is set up in this file. Other settings, which are not bold, display their calculated value, inherited from parent files. In other words, setting files hold only the differences from the parent ones, if needed.

Just confirm me that my guess is right, and I could explain how it works in more details.

Best regards,
Oleg Shuruev

Read the full discussion online.

To add a post to this discussion, reply to this email (stylecop@discussions.codeplex.com)

To start a new discussion for this project, email stylecop@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com



--
Itzik Saban