Hi, I have two separate projects, one is in React typescript and another is backend in .net C#. We build both in the same build pipeline in two different tasks. Now when i try to run the SonarQube scan, the C# code is getting analyzed but not typescript.
- I tried copying only the typescipt code files to backend folder for scan but it gives these error during Sonar Analysis task:
- Cannot find module ‘typescript’
- TypeScript dependency was not found and it is required for analysis.
- I tried copying the entire package with node modules but that time .net build task gives compile error on typescript code.
How can i get the typescript code analysis done?
Azure devops yaml:
-
task: PowerShell@2
inputs:
targetType: ‘filePath’
filePath: ‘$(System.DefaultWorkingDirectory)\Pipelines\Inline_Powershell_add_IP.ps1’
displayName: ‘Inline Powershell’-
task: SonarQubePrepare@4
inputs:
SonarQube: ‘SonarQube scan’
scannerMode: ‘MSBuild’
projectKey: ‘Test_Analyzer’
projectName: ‘Test_Analyzer’ -
task: CmdLine@2
displayName: “Build Frontend”
inputs:
script: |
yarn --cwd frontend/ --frozen-lockfile && yarn --cwd frontend/ build-standalone -
task: VSBuild@1
displayName: “Build solution”
inputs:
solution: “Analyzer.sln”
vsVersion: “16.0”
msbuildArgs: ‘/p:GenerateProjectSpecificOutputFolder=true
/p:OutDir=(build.artifactstagingdirectory) /p:WebPublishMethod=Package;DeployOnBuild=true;PackageAsSingleFile=true;PackageLocation=(build.artifactstagingdirectory)\Web /p:AutoParameterizationWebConfigConnectionStrings=false /p:GenerateSampleDeployScript=false /p:GenerateSampleDeployScript=false’
platform: “(BuildPlatform)" configuration: "(BuildConfiguration)”
-
-
task: CopyFiles@2
displayName: “Copy frontend files to web project for Sonar scan”
inputs:
SourceFolder: ‘(System.DefaultWorkingDirectory)\frontend' Contents: | ** TargetFolder: '(System.DefaultWorkingDirectory)\backend\Web\src’
CleanTargetFolder: true -
task: SonarQubeAnalyze@4
displayName: ‘Run Code Analysis’- task: PowerShell@2 inputs: targetType: 'filePath' filePath: '$(System.DefaultWorkingDirectory)\Pipelines\Inline_Powershell_r.ps1' displayName: 'Inline Powershell - r'