How to import data to sonarqube database? - sonarqube

I have my own report in a custom format and I want to import it somehow to sonar database to use sonar's widgets to show it. Is it possible in general? Is there any tools to do it?

This will require a custom plugin. Not knowing what type of data you're dealing with, I'll guess that the Generic Test Coverage plugin might be a good model.

You shoud try to do it using the webservice api. That's the recommanded way to do it.
The supported api is self documented on your SQ instance. Here is the API of the nemo instance : http://nemo.sonarqube.org/api_documentation

Related

Karate - auto updating request based on product app schema is possible?

I am working on validating the graphQL request and response for a POST method using Karate. Recently the schema undergone changes and now the requests/response changed.I need to re-work completely. Is there any way in updating the requests based on the schema in the product app while running in local other than manual updation?
No there isn't especially for GraphQL. The whole point of the test is to fail when your schema changes and think of this as Karate doing it's job.
If your response schemas are constant across multiple tests, you can choose to extract them into re-usable files: https://stackoverflow.com/a/56987803/143475
Also see: https://stackoverflow.com/a/56273812/143475
But you are generally recommended to keep your tests simple and readable, refer: https://stackoverflow.com/a/54126724/143475

Getting xAPI statements from an xAPI package

I'm trying to get my head around the workings of an xAPI package authored in Rise which has been supplied to me so I can build a test PoC app.
I can see the functions built into the index.html page, and that things like progress and quiz scores are genrated, but where do I find the end-point for a LRS within the package?
I have incorporated the package into a test app I built, but rather than generate and send statements myself I would like use what comes as part of the package.
If I import and play the package in SCORM Cloud, I get generated statements returned.
The only thing I can see is an entry in the tincan.js file, this.recordStores=[] other than that I'm unsure where to go next, any suggestions?
Generally this kind of package implements a set of guidelines that were released with the 0.9 version of the specification (at the time named the Tin Can API and then later changed to xAPI). Those guidelines provide for a packaging and launch mechanism which is what Rise has implemented. The launch mechanism indicates that the endpoint and authentication credentials will be passed on the query string to the launched content where it can retrieve them. The TinCanJS library used by Rise implements functionality to digest the query string and set up objects, those you find in this.recordStores to communicate with the xAPI LRS identified in the query string parameters.
You have two primary options,
Get the query string parameters directly from the launch URL and
process it yourself, potentially using the same global library objects
(TinCan.LRS) already available to get an LRS object that you can
then interact with as you see fit,
Leverage the object already created for you via the this.recordStores list that is already prepared by the package itself
There are pros/cons to both methods and they largely depend on your familiarity with JavaScript and how flexible you need/want to be.

How do I import existing phpcodesniffer results into sonar?

I'm starting out with Sonar. We've got about 10 custom sniffs in our own standard for PHP_Codesniffer and are using a subset of various sniffs of other standards. PHP_Codesniffer works like a charm and generates a report in Checkstyle format.
How can I get Sonar5.1 to import this codesniffer-results-in-checkstyle-format.xml file?
I heard this was possible in older versions of the PHP plugin, but I'm not sure if that relates to a ruleset.xml or to the actual results of the run.
It's no longer possible to import external rules from tools like CodeSniffer, PHPDepend, ... The PHP Plugin rely now exclusively on SonarQube Rules Engine as it is mentioned here : http://docs.sonarqube.org/display/PLUG/PHP+Plugin and it provides out of the box 110 predefined rules.
You can write as of now custom rules unless you customize directly the PHP Plugin.
If some rules are missing, you are more than welcome to share with us your suggestions.

Get uRapidFlow logs for an import profile batch

I am running a php script using a cron job to run a uRapidFlow / RapidFlow import profile. Here is the documented code I found to help me do this.
I need to be able to run through the imported batch, row by row, and do some processing based on if the row was imported successfully or not. It would also be very convenient and useful to be able to send email notifications on failed imports in general as well. If anyone has any idea, or can point me in the right direction, I would be very grateful. I don't see any documentation for this online, so I am going through the module code and database trying to figure it out myself.
I am using Magento EE 1.12.0.2
The best bet, unless you modify the uRapidFlow extension (check license information before doing so). Would be to extend it and use a observed event.
Try the observer : catalog_product_import_finish_before Which is triggered after each product is imported. Bare in mind this solution would be triggered globably for any manual imports, so if you build a small extension, perhaps make it easy to toggle on and off.
More can be found on Magento's observers here : http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/customizing_magento_using_event-observer_method
Note as you've not specified which version of Magento you are using, you'll have to check if that observer is supported in your version.

Sonar - Can we use for OSB/BPEL code review?

I am new to sonar,just heard about this tool.
Can we use this tool to perform code review for FMW(Fusion Middleware) -OSB(Oracle Service Bus)/BPEL project ?
If so can anyone give some inputs on this?
The official plugin-List : http://docs.codehaus.org/display/SONAR/Sonar+Plugin+Library/ does not mention support for your tools.
But sonar can be extended with custom plugins, so you may be able to write your own plugins to provide metrics for your tools.
What level of review you want to cover? It is really easy to make your own review tool for BPEL. All BPEL resources are XML files. For example if you want to check for naming convetion of BPEL activities, you can define a simple XPath based rule.
Ex:
//sequence/#name ~= "^sequence.*".
A Java program can use the above XPath to pull-out all sequence names from the xxxx.bpel file and compare it against a regular expression. Similar rules can be created for checking WSDL usage, partner links, end-point addresses, usage of Error handling etc.

Resources