-
ALM used - Azure DevOps
-
CI system used - Azure DevOps
-
Scanner command used when applicable (private details masked) - NA
-
Languages of the repository - C#, HTML, javascript
-
Error observed
Sonarcloud is randomly excluding some files from analysis. a folder has 2 c# files which should be analyzed - its analyzing only one. For example, i have these 2 files
- PreValidateAccount.cs - included in analysis
- AccountPlugin.cs - excluded from analysis.
Its also excluding random folders from analysis. This has resulted in only 10% of the code (13k lines) being analyzed against 130k lines which are part of the visual studio solution.
When the same was run against an on premise sonarcube it included all of those files for analysis.
- Steps to reproduce - Run the azure pipeline against develop branch. Azure Pipeline has following tasks
----------------------------------
Use NuGet 4.4.1 task
----------------------------------
steps:
- task: NuGetToolInstaller@0
displayName: 'Use NuGet 4.4.1'
inputs:
versionSpec: 4.4.1
----------------------------------
Nuget restore task
----------------------------------
steps:
- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
restoreSolution: 'foldername/VisualStudioSolutionName.sln'
feedsToUse: config
nugetConfigPath: 'foldername/nuget.config'
----------------------------------
Prepare analysis on sonarcloud task
----------------------------------
steps:
- task: SonarSource.sonarcloud.<<task_GUID>>.SonarCloudPrepare@1
displayName: 'Prepare analysis on SonarCloud'
inputs:
SonarCloud: SonarCloud
organization: 'OrganisationName'
projectKey: 'OrganisationName_ProjectName'
projectName: 'ProjectName'
extraProperties: |
# Additional properties that will be passed to the scanner,
# Put one key=value per line, example:
# sonar.exclusions=**/*.bin
----------------------------------
Build Solution task
----------------------------------
#Your build pipeline references an undefined variable named ‘BuildPlatform’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references an undefined variable named ‘BuildConfiguration’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
steps:
- task: VSBuild@1
displayName: 'Build solution foldername/VisualStudioSolutionName.sln'
inputs:
solution: 'foldername/VisualStudioSolutionName.sln'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\" /p:CreatePackageOnPublish=True /p:OutputPath=bin'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
----------------------------------
Run code analysis task
----------------------------------
steps:
- task: SonarSource.sonarcloud.<<task_GUID>>.SonarCloudAnalyze@1
displayName: 'Run Code Analysis'
- Potential workaround - none