如何在FSharpLint中禁用特定规则?

时间:2016-12-27 23:01:26

标签: build f#

我创建了Settings.FSharpLint,我想要取消IdentifiersMustNotContainUnderscores规则

是否可以仅禁用一条规则?

示例(不起作用):

<?xml version="1.0" encoding="utf-8"?>
<FSharpLintSettings>
  <Analysers>
    <NameConventions>
      <IdentifiersMustNotContainUnderscores>
        <Enabled>False</Enabled>
      </IdentifiersMustNotContainUnderscores>
    </NameConventions>
  </Analysers>
</FSharpLintSettings>

我试过这个并且效果很好(但它适用于所有NameConventions规则):

<?xml version="1.0" encoding="utf-8"?>
<FSharpLintSettings>
  <Analysers>
    <NameConventions>
       <Enabled>False</Enabled>
     </NameConventions>
  </Analysers>
</FSharpLintSettings>

1 个答案:

答案 0 :(得分:2)

IdentifiersMustNotContainUnderscores元素需要嵌套在Rules element中,请尝试:

<?xml version="1.0" encoding="utf-8"?>
<FSharpLintSettings>
  <Analysers>
    <NameConventions>
      <Rules>
        <IdentifiersMustNotContainUnderscores>
          <Enabled>False</Enabled>
        </IdentifiersMustNotContainUnderscores>
      </Rules>
    </NameConventions>
  </Analysers>
</FSharpLintSettings>