2

SonarQube is failing without any meaningful error message for a .NET C# project.

I tried running the end command with the -X option but the -X format is unrecognized.

SonarScanner.MSBuild.exe end -X /d:sonar.login="87195"

Any ideas on what could be wrong ? I ran a simpler project with 2 - 3 cs files and that succeeds.

:
:
INFO: Sensor Python Squid Sensor [python] (done) | time=1880ms
INFO: Sensor PythonXUnitSensor [python]
INFO: Sensor PythonXUnitSensor [python] (done) | time=529ms
INFO: Sensor SonarCSS Metrics [cssfamily]
INFO: Sensor SonarCSS Metrics [cssfamily] (done) | time=9835ms
INFO: Sensor SonarCSS Rules [cssfamily]
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 9:31.651s
ERROR: Error during SonarQube Scanner execution
ERROR: null
ERROR:
INFO: Final Memory: 26M/1008M
INFO: ------------------------------------------------------------------------
The SonarQube Scanner did not complete successfully
14:53:45.844  Creating a summary markdown file...
14:53:45.847  Post-processing failed. Exit code: 1
user1554876
  • 192
  • 3
  • 19

2 Answers2

4

Anybody landing on this page in search of a solution: OP has posted it on sonarqube forum as well and the solution is to disable css analysis. For larger projects sonarqube when installed as a server (instead of using cloud) is unable to handle the code analysis for css files resulting the error while it works fine on smaller projects.

You can disable css analysis either in the script; by telling Sonar that the css files have a different extension like .foo, or from the Administration

From script when SonarScanner.MSBuild.exe is run, add the following; /d:sonar.css.file.suffixes=.foo, like:

"C:\sonar-scanner-msbuild-4.3.1.1372-net46\SonarScanner.MSBuild.exe" begin /k:"MyApp"  /d:sonar.css.file.suffixes=.foo /d:sonar.host.url="http://localhost:9000" /d:sonar.login="200dc9294n6bg4d4cc9bed30mj76fcb10d25ee17"

From SonarQube Adminstration, remove the .css suffix from the list: enter image description here

The problem is still investigated by the Sonar team; https://community.sonarsource.com/t/sonarqube-post-processing-fails-with-unknown-reason/1798/6

man_luck
  • 1,605
  • 2
  • 20
  • 39
0

The current answer excludes all .css files, but I started to look for a way to just exclude the offending .css files.

I encountered this issue on one project, but not on other projects. The difference between this one particular project was that it was using Kendo.UI and the library has relatively massive .css files. However, when I tried to exclude these files through the script, it would still fail. What worked the best in the end was adding SonarQube setting in the .csproj itself to exclude the many .css libraries that we had.

You would need to add the following to your .csproj to exclude these files:

<ItemGroup>
 <SonarQubeSetting Include="sonar.exclusions">
  <Value>**/LibraryNameHere/**</Value>
 </SonarQubeSetting>
</ItemGroup>
Hydromast
  • 280
  • 3
  • 10
  • will it not exclude all the files under the folder "LibraryNameHere/**" rather than only the "offending css files"? Agree it will narrow it down so the rest css files are checked for code quality but there is no surety if the culprit is only a particular library or many.If it works consistently then no harm doing that. – man_luck Jul 30 '19 at 15:50