В настоящее время, если вы хотите, чтобы файлы TSQL были проанализированы и отображены в том же проекте SonarQube, что и другой код, вам нужно будет сослаться на него из проекта MSBuild.
Есть несколько способов сделать это:
1) включите файлы TSQL в один из существующих проектов, используя следующий фрагмент:
<ItemGroup>
<!-- Include additional files that should be analyzed by the SonarScanner for MSBuild -->
<None Include="*.tsql" >
<!-- Don't show the items in the Solution Explorer -->
<Visible>False</Visible>
</None>
</ItemGroup>
2) Создайте отдельный фиктивный проект MSBuild, единственная цель которого - указать дополнительные файлы для анализа. Это немного сложнее, поскольку фиктивный проект нуждается в некотором дополнительном контенте, чтобы он работал с целями SonarScanner для MSBuild.
Следующий шаблон работает со сканером v4.3 и также должен работать с последними предыдущими версиями.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- The only purpose of this project is to specify additional files to be analyzed by the SonarScanner for MSBuild -->
<!-- 1. Set a unique GUID id for the project -->
<PropertyGroup>
<ProjectGuid>{EA2BAA27-D799-4FBE-9430-7499ACF3E431}</ProjectGuid>
</PropertyGroup>
<!-- 2. Specify the files to be analysed -->
<ItemGroup>
<SonarQubeAnalysisFiles Include="**\*.js" />
</ItemGroup>
<!-- ******************************************************** -->
<!-- Boilerplate - no need to change anything below this line -->
<!-- ******************************************************** -->
<!-- Import the SQ targets (will only exist if the scanner "begin" step has been executed) -->
<PropertyGroup>
<SQImportBeforeTargets>$(localappdata)\Microsoft\MSBuild\$(MSBuildToolsVersion)\Microsoft.Common.targets\ImportBefore\SonarQube.Integration.ImportBefore.targets</SQImportBeforeTargets>
</PropertyGroup>
<Import Condition="Exists('$(SQImportBeforeTargets)')" Project="$(SQImportBeforeTargets)" />
<!-- Re-define the standard step of targets used in builds -->
<Target Name="Build" />
<Target Name="Clean" />
<Target Name="CoreCompile" />
<Target Name="Rebuild" DependsOnTargets="Clean;Build" />
<!-- Re-define one of the standard SQ targets as we have already set the list of files to analyze above -->
<Target Name="CalculateSonarQubeFilesToAnalyze" >
<PropertyGroup>
<!-- Set a property indicating whether there are any files to analyze -->
<AnalysisFilesExist Condition=" @(SonarQubeAnalysisFiles) != '' ">true</AnalysisFilesExist>
</PropertyGroup>
</Target>
</Project>