Coverity Scan for JS - sonarqube

I have initiated the Coverity scan for the JS using Coverity Wizards.
The capture build step has been completed & failed in to Run analysis step.
The failed message is "failed with error code 8. See console for details.
Some of your source code may not have been captured, which can result in fewer issues being found.
Please check that all project files in compiled languages are being built by the provided build command, and that all interpreted language files are parsable by the appropriate interpreter.

Please refer to the console for the build errors you are getting and see if your build is successful. Once your build will be successful ,then only you can run the cov-analysis .
For JavaScript you need to perform buildless capture. Please Run the cov-capture command for the repository/directory that contains your project(s).Kindly refer to cov_analysis_administration_guide.html document .You can find it under /doc/en/ folder.
Furthermore, which version of Coverity you are using ? Use of Coverity Wizard has been deprecated since 2021.09. You can try running the central build or point&scan .

Related

Xcode Generate Code Coverage Report fails with Error : Error Domain=IDEFoundationErrorDomain Code=14 "Failed to merge raw profiles in directory

I am unable to generate the code coverage data when the the workspace is built with custom XCODE_CONFIGURATION_BUILD_DIR.
We run the xcodebuild commands to build the workspace with a XCODE_CONFIGURATION_BUILD_DIR, so that multiple jenkins CI jobs won't overwrite the build output of other jobs which are also running concurrently.
When we run the tests for a build generated this way and try to get the code coverage report, the command fails with the below error.
jenkins$ xcrun xccov view *.xccovreport
Errors:
Error Domain=IDEFoundationErrorDomain Code=14 "Failed to merge raw profiles in directory /Users/jenkins/Library/Developer/Xcode/DerivedData/XXXXXX-buggtqumttnpjvejnbfhulhqcvno/Build/ProfileData/bff950eda0f75b2dbadb3ce08510474b4667ac82 to destination /Users/jenkins/Library/Developer/Xcode/DerivedData/XXXXXX-buggtqumttnpjvejnbfhulhqcvno/Build/ProfileData/bff950eda0f75b2dbadb3ce08510474b4667ac82/Coverage.profdata: No profile data files were written to '/Users/jenkins/Library/Developer/Xcode/DerivedData/XXXXXX-buggtqumttnpjvejnbfhulhqcvno/Build/ProfileData/bff950eda0f75b2dbadb3ce08510474b4667ac82'" UserInfo={NSLocalizedDescription=Failed to merge raw profiles in directory /Users/jenkins/Library/Developer/Xcode/DerivedData/XXXXXX-buggtqumttnpjvejnbfhulhqcvno/Build/ProfileData/bff950eda0f75b2dbadb3ce08510474b4667ac82 to destination /Users/jenkins/Library/Developer/Xcode/DerivedData/XXXXXX-buggtqumttnpjvejnbfhulhqcvno/Build/ProfileData/bff950eda0f75b2dbadb3ce08510474b4667ac82/Coverage.profdata: No profile data files were written to '/Users/jenkins/Library/Developer/Xcode/DerivedData/XXXXXX-buggtqumttnpjvejnbfhulhqcvno/Build/ProfileData/bff950eda0f75b2dbadb3ce08510474b4667ac82'}
Version/Build:
Version 10.1 (10B61)
Found this thread on Github
The issue was: generating coverage for a Static Library fails, but not for a Dynamic Library.
So check if it works, changing on pbxproj:
- MACH_O_TYPE = staticlib;
+ MACH_O_TYPE = mh_dylib;
And it really generated coverage successfully on my sample framework.
The solution which worked for me was, I have changed the Mach-O-Type from Executable to Static Library.
With the option Dynamic Library also, the coverage report was generating but the build was failing.
Another option was to set the test target as Static Library and Main Target as Executable. Build Succeeded and able to see the coverage for multiple targets.
Xcode Version : 13.4

Is it possible to TeamCity Build Log file and mail it

I am working on TeamCity,
There are lot of failures in the my TestCase Automation,
I want to get the Build.log file,
I dont know the location of Build.log.
can some one please tell me where is this file location in Build Agent.
To get the build log you'll need its build id and place it into the following URL:
http://teamcity:8111/httpAuth/downloadBuildLog.html?buildId=BUILD_ID
It is also possible to get the build log as the zip file using
http://teamcity:8111/httpAuth/downloadBuildLog.html?buildId=BUILD_ID&archived=true
Just replace BUILD_ID with the desired build id.
For the detailed info, you may refer to the documentation

How to get the sonar-report.json file created with sonarqube?

I am runnig Sonarqube 5.3 and has integrated it with Jenkins. I want to post Sonareqube issues as Gerrit comments.
Then I need to specify the path to and name of the data generated from sonarqube, e.g. build/sonar/sonar-report.json
The file sonar-report.json is not generated and I have found some setting for Sonarqube that shouold make sonareqube create the file.
sonar.report.export.path=sonar-report.json
sonar.issuesReport.html.enable=true
sonar.issuesReport.json.enable=true
sonar.issuesReport.console.enable=true
I have tried to set these in the file
<sonar-installation-directory>/conf/sonar.properties
I have restarted the Sonare service and restarted the computer but the sonar-report.json file is still not created.
Those properties are not meant to be configured on the server side, they are passed on the scanner side, and are valid only for analysis in preview mode (by the way no need for sonar.issuesReport.json.enable). That's what SonarLint for Command Line is about.
Why preview mode ? Because the goal is to analyse a diff (to comment the code review in your case). You don't want a full analysis to be submitted to SonarQube if the code is not yet pushed to the repo.
Example:
$ sonar-runner -Dsonar.analysis.mode=preview -Dsonar.issuesReport.html.enable=true -Dsonar.report.export.path=report.json -Dsonar.host.url=http://localhost:9000
[...]
$ ls .sonar/
issues-report report.json
(careful with the JSON report, looks like it will ultimately be removed, see SONAR-7247)
P.S.: I guess you might be using the sonar-gerrit Jenkins plugin, which is essentially saying the same thing:
This plugin is intended to work with report provided by SonarQube running on your project in preview mode

set configuration properties in sonar

Maybe, this question is silly but I'm very new. I try to search without luck.
I got two errors when building maven project with sonar:
No information about coverage per test.
Although I had test code and these testing classes cover the code.
The global property 'sonar.doxygen.deploymentPath' is not set. Set it in SONAR and run another analysis.
I dont know it should be set where in sonar server. I set in web.xml or sonar-server.properties but it does not work.
Thanks.
About the first warning message this is not an error but a warning : since Sonar 3.5 this is possible to get the code coverage relating to each unit test. Here the message just says that this feature is not activated which is expected by default. Nevertheless I do agree that this warning message can be misleading.
About the second error message, I don't know the doxygen plugin but the message seems to be pretty clear : the sonar.doxygen.deploymentPath property has not be defined. See the plugin documentation : http://docs.codehaus.org/display/SONAR/Doxygen+Plugin.
Two things:
There is no war folder anymore since the sonarqube has given up tomcat support
The doxygen plugin is not implemented to upload the files in to the sonarqube server &/ installation, which means it only can be done by referencing the path inside your installation, e.g.:
run "mvn install sonar:sonar" in your project "/root/test.example.sonar.com"
in sonarqube set the cfg-key "sonar.doxygen.deploymentPath" the value: "/root/sonarqube-4.1.1/web/" and the cfg-key "sonar.doxygen.deploymentUrl" the value: "http://:9000"
have fun with your doxygen
Remember that the plugin will only be run through your mvn cmd, refreshing the page only will not do the job, you will have to analyse again after each cfg set :/
Check the file system and folder permission

Teamcity Custom Script Log Output

I use a very basic Custom Script in TeamCity 7.0.3 which uses Visual Studio 2010 to build a solution and its installers.
The build was failing and the only relevant error in the TeamCity Build Log is
[13:17:13]Process exited with code 1
When I run the same script from the console, I get a lot of helpful errors about why the build failed.
How can I get TeamCity to include the errors from devenv.exe?
You need to report back the additional info to TeamCity in a way it can interpret.
Look at this article to see how to do it:
http://confluence.jetbrains.net/display/TCD7/Build+Script+Interaction+with+TeamCity
For a basic example:
You can report messages for build log in the following way:
##teamcity[message text='<message text>' errorDetails='<error details>' status='<status value>']

Resources