I have a sonar plugin that post a comment in gitlab when there is new sonar issues in a commit. I would like to add difference of code coverage and code duplication in the comment.
This is made by making a sonar plugin based on PostJob.
The issues are recovered by injection of ProjectIssues in the constructor.
Is there a way to recover the Measures in the post job? I saw that changed in sonar 5.2 but there is no real explanation on how to proceed to read measures.
Thank you for any help.
if the ProjectIssues or PostJobContext have no data you are looking for, you can use the web API rest:
WsRequest wsRequest = new GetRequest("api/...");
but beware the last measures will not be computed at the moment of #BatshSide, you have to wait for the Compute Engine to finish his work. So as you cannot wait in 'BatchSide', look for moving your plugin under #ComputeEngineSide
Related
I have list of projects in my sonarqube dashboard, how can I get quality information like code coverage, code smell, vulnerability, and other details of all the projects in a single api call (sonarqube web api) ?
Referred web-api documentaion (https://next.sonarqube.com/sonarqube/web_api/), but not able to get much help from it.
The following is a short excerpt from code that gets some metrics from a scan after it is completed:
"curl -s -X GET -u ${authString} \'${sonarProps['sonar.host.url']}/api/measures/component?" +
"metricKeys=coverage,duplicated_lines_density" +
"&component=${sonarQubeProjectName}&branch=${branchName}\'"
The syntax of the property references are unimportant for your question. Notice the list of "metricKeys" being supplied.
i gust curious maybe someone heard about solution how to get Report (SSRS Report) in Plugin (i want to export it in pdf from CRM and save in Sharepoint).
I have tried following solution:
https://community.dynamics.com/crm/f/microsoft-dynamics-crm-forum/247210/how-to-run-the-crm-report-through-sdk?pifragment-97030=1#responses
this one is not working anymore because of authentication. I tried to authentificate my user in WebClient inside plugin but no luck. Maybe someone know how to do it
There is an excellent article/blog posted by Bob Guidinger for Generating Report and sending Email for D365 Online.
Once you get first step running, you can extend it to perform you specific operation.
Blog mentioned about Azure function and plugin (combination).
Scheduling Reports in Dynamics 365 - Part 1
I tried this for one of my project and it worked fine with me. This shall be a bit learning curve if you do not know how to create azure functions and some small parts.
Happy Coding!!
Make sure to upvote, Accept if this helps!!
This is a screen where we configure our project, SonarQube shows new issues open, confirmed which is highlighted in yellow, I am using the SonarQube API in my application and want to dump the data to my DB. Accordingly I will create the report. But In Sonar Metrics document I do not find how could I get these value using API.
api/issues/search should get you all you need. Check out the documentation embedded in your SonarQube server (linked at the footer).
From the use-case you describe, parameters sinceLeakPeriod or createdAfter / createdInLast can help out with date filtering. Not to mention other filters like resolved and componentKeys. Exchaustive listing is in the WebAPI documentation.
How do I get a project's last analysis time (the one you can see in the dashboard) with the REST API of SonarQube?
I am working with SonarQube 4.5.6, but if it's only available on later versions I'd still be interested in how it is done.
[EDIT] API relevant since SonarQube v6.3: api/project_analyses/search
[EDIT] Relevant API for SonarQube LTS v5.6.x: api/projects?versions=true
And since you mention later versions, since SonarQube 5.2:
api/ce/component : get the pending tasks, in-progress tasks and the last executed task of a given component (usually a project) (documentation)
P.S.: api/components/show can be used to get the component ID from the project key
P.S.2 : here's a real-life example on public SonarQube project. First get the component ID then query the component -> "submittedAt": "2016-03-07T06:04:31+0100" (slight difference with the dashboard value, due to the processing time on the scanner side)
You can use the Resources API : https://nemo.sonarqube.org/api/resources/index?metrics=date&format=json and look at the 'date' field to get the last analysis time.
Our organization is using SonarQube for managing code quality as well as Docco for handling production of documentation from code comments.
We're running into a conflict between including things like method names in comments for Docco and the 'Sections of Code should not be "commented out"' rule in SonarQube.
Are there any known best practices to get SonarQube to ignore code in comments that are for documentation (even better if for Docco in particular) while still catching old code that has been commented out instead of being removed?
The rule "Sections of code should not be commented out" could be simply disabled in the quality profile related to your project.
sharing this as it could help if anyone having similar issue.
one way is to comment the code along with additional lines or single quote to ignore that line which worked for me
example
# print("sample")
you can write this as
# ' print("sample")