Using this on an Ubuntu server
SonarQube is on 9.1
dotnet [3.1 and 5.0] has been installed using:
sonarscanner has been installed:
dotnet tool install --global dotnet-sonarscanner --version x.x.x
What I’m running [on Ubuntu, as everything is done in Ubuntu]
dotnet sonarscanner begin /k:"testproject" /d:sonar.host.url="https://url.com" /d:sonar.login="token"
dotnet build testproject.sln
dotnet sonarscanner end /d:sonar.login="token
The problem is that I’m seeing only C# code not JS.
What I should do to see JS code as well?
One note is that inside the solution the project where JS and jsx code live is not defined
sln make reference to: code1, code2 and code3 BUT my js code is inside code4 folder.
There are some notes on Analyzing languages other than C# on this page.
If the JS code is in a separate project then what type of project is this? If it’s within a folder within your C# project then it should be picked up ok as long as your project file is the modern SDK type
Hi @Tom_Howlett ,
Unfortunately I don’t know to answer to your question.
Let me give you some more details about the structure of a project.
* Folder1 (C# code)
* Folder2 (C# code)
* Folder3 (C# code)
* Folder4 (JS, React, MVC)
+ File1.sln (will say nothing about Folder4)
I don’t know C# or JS but I read on the internet that scanning both projects from the same Root Folder [in this scenario RootProject] it is possible with a single sonar scan.
Unfortunately, I don’t know how as by default it is not working, and I don’t want to add Folder4 to the sln file as well [as there is nothing related to C#]
Do Folders 1-4 contain .csproj files? I’m presuming 1-3 do? To scan folder 4 it will also need to have a csproj referenced by the solution too, it can’t just be a floating folder I’m afraid.
Folder 1-3 have. Folder4 doesn’t.
Is it there a way to add csproj to the folder without the need of Visual Studio?
What is the best approach of doing that?
Can this be done via Linux or MacOS/Windows is mandatory?
You can use the cross-platform dotnet cli and the new command to create a project outside of Visual Studio. The project templates will create more than just the .csproj file though, the web template is probably your best bet. We are planning to support the new .NET 6 .esproj format soon, which should be more suitable for this but this should work ok in the meantime.
An alternative option would be to place folder 4 insider one of the other folders (whichever is more relevant) and then the scanner should pick it up.
Thank you for your help. This looks to work, nice.
The only problem is that it is not scanning jsx [react]. It is scanning JS, TSX, LESS, but not JSX
@astingengo could you send us the verbose logs for the
end step please?
FYI to enable verbose scanner logging you need to pass
/p:sonar.verbose=true in the