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

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