Fxcop error with return code '2048' - sonarqube

Caused by: org.sonar.dotnet.tools.fxcop.FxCopException: FxCop execution failed with return code '2048'. Check FxCop documentation for more information.
at org.sonar.dotnet.tools.fxcop.FxCopRunner.execute(FxCopRunner.java:86)
at org.sonar.plugins.csharp.fxcop.FxCopSensor.launchFxCop(FxCopSensor.java:214)
at org.sonar.plugins.csharp.fxcop.FxCopSensor.analyse(FxCopSensor.java:169)
Please find the attached log for the error.
Softwares used:
Sonarqube-3.3.1
Maven-3.0.4
Fxcop-12.0

You are using a very old version of both SonarQube and of the SonarQube C# plugin - they both are no longer supported.
The current recommended and supported way of analyzing .NET projects is through the MSBuild SonarQube Runner.
You won't get help on such old versions of the SonarQube server and SonarQube C# plugin: Please upgrade.

Related

The build is configured to run SonarQube analysis but the SonarQube analysis targets could not be located

I am new to .Net and new to SonarScanner with MS Build. I am looking forward for your help on resolving the error I get when I build the project after sonarscanner-msbuild begin process .
C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\MSBuild\14.0\Microsoft.Common.targets\ImportBefore\SonarQube.Integration.ImportBefore.targets(62,5): error : The build is configured to run SonarQube analysis but the SonarQube analysis targets could not be located. Project: XYZ.csproj [E:\jenkins\workspace\XYZ\XYZ.csproj]
Tips and clues:
Ensure you have run SonarScanner.MsBuild begin before executing MsBuild
Run MsBuild with /v:diagnostic switch to get detailed troubleshooting log. In the log lookup SonarQubeTargetsPath and SonarQubeTargetFilePath values.
In case of this or another configuration difficulty see my tutorial on how to setup SonarQube in .NET ecosystem: https://blog.pragmasoft.pl/software/2018-10-10-sonarqube-2-setup-environment/

SonarQube analysis in TFS Build fails after SonarQube upgrade

We are upgrading our SonarQube server from 6.1 to the 6.7.1 LTS. We are running TFS 2017 on-prem. I have updated the plugins to:
sonar-csharp - v 6.7.1.4347
sonar-css v 4.5
sonar-ldap - v 2.2.0.608
sonar-scm-git - v 1.3.0.869
sonar-scm-tfvc v 2.1.2
sonar-typescript - v 1.1.0.1079
sonar-web - v 2.5.0.476
sonar-xml v 1.4.3.1027
When running a build the complete analysis step fails Post-processing failed. Exit code :1
there are warning messages about sonar.cs.analyzer.projectOutPath property is missing.
And
"No roslyn issues report not found for this project"
Also, it suggests that I re-run the scanner using the -X switch. but I haven't been able to find how to add that switch.
Any help on how to determine what/where the error is would be SUPER helpful.
Have a look at this and this releasenotes. Check if you are using the latest scanner version: 4.0.2.892.
In our case, the SonarQube API being called in the build step happened to start failing on special characters that it had not had trouble with before. We were using curly-braces in our sonarQube project names, and the newer version really did not like that. Once we changed the project names to use parenthesis instead of the curly-braces, things were working better

How to get cppcheck-results into SonarQube

We use cpp-check and SonarQube 6.0 and want to inject the results of cppcheck into the system. Cppcheck runs fine and produces an xml-file with results. However Cpp-check and SonarQube are not running on the same machine.
Is it sufficient to set something in
Administration > C++(Community) > CodeCode analysis > Cppcheckreports ?
We put the name of the xml into that field - but how should SonarQube find that?
What are we missing here?
The cppcheck plugin for SonarQube has not been maintained for 6 years now and won't work with resent versions of SonarQube. https://github.com/SonarQubeCommunity/sonar-cppcheck/issues/6#issuecomment-377563241
SonarQube and Cppcheck don't have to run on the same machine. But the Cppcheck report does need to be available to the analysis. If you can't run analysis on the machine where Cppcheck runs, then you just need to set up some process (FTP? Sneakernet?) to get the file where it needs to go.
This all assumes you have the Cppcheck plugin installed in SonarQube, as well as some plugin, such as SonarC++($), which declares the language.

Gradle Plugin for SonarQube fails with error related to accessExternalSchema

For several of our projects, we get the following error, when using the Sonar Gradle plugin (http://docs.sonarqube.org/display/SONAR/Analyzing+with+Gradle).
11:26:16.744 ERROR - Error parsing XML: XML InputStream(5) schema_reference: Failed to read schema document 'persistence_1_0.xsd', because 'http' access is not allowed due to restriction set by the accessExternalSchema property.
We have run into this previously when running xjc tasks, and I tried to adapt the solution there, resulting in the following:
sonarqube {
System.setProperty('javax.xml.accessExternalSchema', 'all')
}
This however, didn't appear to have any effect.
Any suggestions on how to fix the problem?
Thanks!
You could maybe try to apply same workaround than How to surpass gradle wsimport task JDK 8 access restrictions?
Anyway in SonarQube 5.2 there will be no more database connection so no more persistence.xml.

findbugsMain task in gradle fails

I'm trying to run the findbugsMain task in Gradle 1.10 (or more specific "gradlew check") but the only thing I get is an error like
building findbugsMain 33% > ...
:findbugsMain FAILED
It seems to download the required jars though:
...
Download http://repo1.maven.org/maven2/jaxen/jaxen/1.1.1/jaxen-1.1.1.jar
Download http://repo1.maven.org/maven2/asm/asm/3.3/asm-3.3.jar
Download http://repo1.maven.org/maven2/asm/asm-tree/3.3/asm-tree-3.3.jar
Download http://repo1.maven.org/maven2/asm/asm-commons/3.3/asm-commons-3.3.jar
Download http://repo1.maven.org/maven2/commons-lang/commons-lang/2.4/commons-lang-2.4.jar
Download http://repo1.maven.org/maven2/jdom/jdom/1.0/jdom-1.0.jar
Download http://repo1.maven.org/maven2/xerces/xercesImpl/2.6.2/xercesImpl-2.6.2.jar
Download http://repo1.maven.org/maven2/xom/xom/1.0/xom-1.0.jar
Download http://repo1.maven.org/maven2/xerces/xmlParserAPIs/2.6.2/xmlParserAPIs-2.6.2.jar
Download http://repo1.maven.org/maven2/xalan/xalan/2.6.0/xalan-2.6.0.jar
Download http://repo1.maven.org/maven2/com/ibm/icu/icu4j/2.6.1/icu4j-2.6.1.jar
:findbugsMain FAILED
I ran the task using --stacktravce again and this is what I got:
Pastebin link
My build.gradle is also on Pastebin
I'm relatively new to build management tools in general and gradle in particular, so it might be my fault (e.g. buildscript has an error).
Judging from the stack trace, some internal error occurs. This could be due to an incompatibility between the version of the ASM library used by Gradle, and the version expected by FindBugs. Would you mind to file an issue over at http://forums.gradle.org, ideally including a minimal reproducible example?
As it seems FindBugs up to version 2.0.3 has problems with some Java 8 classfiles. These
problems will be addressed in the next major version of FindBugs. Until then you have to use Java 7.
So, the short version is, that I changed the language level to 1.7 and everything runs just fine now.
Thanks #peter for the help.

Resources