【问题标题】:Visual Studio not ignoring generated code specified in editorConfigVisual Studio 不忽略 editorConfig 中指定的生成代码
【发布时间】:2020-07-10 14:22:10
【问题描述】:

我有一个项目,其中包含我编写的自定义代码生成器中的代码。
生成的代码名为 something_gen.cs
尽管在 editorconfig 中我指定所有 *_gen.cs 文件都应该被忽略,SonarLint 仍然分析 gen 文件。

根据SonarLint Documentation,不应分析文件。

.editorconfig 看起来像这样

root = true
[*_gen.cs]
exclude = true
generated_code = true

[*.cs]
#Spaces and indents
indent_style=space
indent_size=4

and so on...

项目布局是这样的

Project Root
|-Project.sln
|-.editorconfig
|Module A
 |-codeA.cs
 |-codeB.cs
 |-code_gen.cs
 |-ModuleA.csproj
|Module B
 |-codeA.cs
 |-codeB.cs
 |-code_gen.cs
 |-ModuleB.csproj

【问题讨论】:

    标签: c# visual-studio sonarlint editorconfig


    【解决方案1】:

    EditorConfig 不理解名称后缀。可以使用文件扩展名 (*.gen) 或文件夹 (gen/*) 定义文件组。

    文档:https://editorconfig.org/#file-format-details

    【讨论】:

      猜你喜欢
      • 2018-05-01
      • 2023-04-08
      • 2020-06-25
      • 2021-05-30
      • 1970-01-01
      • 1970-01-01
      • 2015-12-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多