English 中文(简体)
为什么样式样式SA1305不尊重VS2010(或MSBuild)允许的预定清单?
原标题:Why is StyleCop SA1305 not respecting the allowed prefixes list in VS2010 (or MSBuild)?

我刚刚将一个项目从2008年升级到2010年Beta 2,而GeoCop现在则报告有S1305号(Hungarian notation)关于不同名称的警告,其先决条件是: 确实,这已被列入允许的预先确定名单。

这一问题是否众所周知? 是否有其他人处理这个问题? 该守则在2008年未经任何警告即明确汇编。

<>Update: 由此可见,这在视觉演播室可以发挥预期的作用,但后来却通过微型图书馆失败。 见下文对原因的答复。

最佳回答

我现在在用ms刀 v子上打造时,遇到同样的问题。 由此可见,违约情况。 风格Cop(C:Program 文件(x86)MSBuildMicrosoftStyleCopv4.4) 如果:

  • you are not installing StyleCop on the "other" (build) machine

  • you have "do not merge with any other settings files" enabled

Specifically - the StyleCop Settings Edit或 picks up the Hungarian notation excludes from the other file automatically, regardless of what the "Settings Files" tab says.

问题回答

你们可以人工添加“是”例外。 风格:

<Analyzers>    
  <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.NamingRules">
    <AnalyzerSettings>
      <CollectionProperty Name="Hungarian">
        <Value>is</Value>
      </CollectionProperty>
    </AnalyzerSettings>
  </Analyzer>
</Analyzers>

仅添加如下内容:

<Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.NamingRules">
  <AnalyzerSettings>
    <CollectionProperty Name="Hungarian">
      <Value>is</Value>
    </CollectionProperty>
  </AnalyzerSettings>
</Analyzer>

rel=“nofollow noreferer”> http://www.thewayithink.co.uk/ecop/sa1305.htm





相关问题
Stylecop vs FXcop

Has Stylecop superseded FXcop? Which product should we be using with Visual Studio 2008?

Setting up StyleCop for team development

We are trying to setup stylecop for a team development environment. So far what we have done is: Checked the files into source control Create an environment variable on every machine that points to ...

Is there a planned StyleCop release for VS 2010?

Does anyone know when stylecop will be released to integrate into VS2010. I know you can tweak the config files to integrate it at the moment, but it is not possible to view the UI.

StyleCop Visual Studio Snippets

I m looking for some Visual Studio snippets for implementing style cop rules. For instance when style cop returns an error saying my code needs a documentation header it would be useful to have a ...

StyleCop for ReSharper

I like stylecop and we use it to enforce coding standards. I dont like the fact that there is no way to automatically fix problems. So was thinking of making a plugin. Once I realised that 2010 is ...

StyleCop SA1636 rule firing when it should not

We are using Resharper 4.5 and StyleCop 4.3. We have a project with many .CS files in it. All .CS files have valid headers, as defined by our StyleCop settings, and added automatically by Resharper ...

热门标签