Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for analyzing .sql files #463

Closed
duncanp-sonar opened this issue Mar 23, 2018 · 0 comments · Fixed by #471
Closed

Add support for analyzing .sql files #463

duncanp-sonar opened this issue Mar 23, 2018 · 0 comments · Fixed by #471
Milestone

Comments

@duncanp-sonar
Copy link
Contributor

The Scanner for MSBuild will analyze .cs files that are included in .sqlproj files created using the SQL Server Data Tools. However, the Scanner does not currently analyze files containing SQL.

The Scanner should be updated to analyze any files that can contain SQL e.g. .sql files.

Workaround
Add the following property to the .sqlproj file:

  <PropertyGroup>
    <SQAnalysisFileItemTypes Condition=" $(SQAnalysisFileItemTypes) == '' ">Compile;Content;EmbeddedResource;None;ClCompile;ClInclude;Page;TypeScriptCompile;Build</SQAnalysisFileItemTypes>
  </PropertyGroup>

Notes
MSBuild classifies files by the ItemGroup they belong to (shown as the Build Action for the file in the Properties window in Visual Studio), rather than by file extension. SQL files in .sqlproj files have an ItemGroup of Build.
The Scanner for MSBuild has a list of ItemGroups that it should pass to Sonar plugins for analysis. Currently that list does not include Build, so SQL files will not be passed to the SonarTSQL plugin. The workaround above just adds Build to the list of file types to analyze.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants