从 Sonar 中的分析中排除目录树中任何位置的文件夹的内容

Excluding contents of a folder anywhere in directory tree from analysis in Sonar

我有一个 ASP.net 项目,我需要对其进行 运行 SonarQube 分析,我已经使用 Jenkins 配置它以 运行 分析。分析是 运行ning 很好,但它包括我在项目中的 bower_components 和 node_modules。项目的结构方式在项目文件夹结构中有多个 node_modules 和 bower_component 文件夹。所以我需要将它们全部排除在一个模式中。我在 .csproj 文件中添加了一个 SonarQubeSetting 部分,并且我有要排除的当前值。

<Target Name="BeforeBuild">
   <ItemGroup>
      <SonarQubeSetting Include="sonar.exclusions">
          <Value>**\main-built.js,**\template-build.js,**\kendo*.js,**\bower_components\*,**\node_modules\*</Value>    
      </SonarQubeSetting>
   </ItemGroup>
</Target>

使用 **\bower_components\* **\node_modules\* 没有用,库仍然被拾取和扫描。我如何排除文件夹(在我的例子中是 node_modules 和 bower_components)内容,而不管它在声纳目录结构中的位置如何?

我上次设置 Sonar 时,我很确定 sonar.exclusion 属性 能按预期工作...也许您的命名模式有点不对。例如,末尾的 ** 而不是 * 怎么样?有关使用命名模式时的示例和答案,请参阅 this answer