我创建了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>

最佳答案

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

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

08-26 22:57