Response
stringlengths
8
2k
Instruction
stringlengths
18
2k
Prompt
stringlengths
14
160
Apparently the issue was that for the badges we were using the URL with http instead of https and that's why the badges images weren't displayed. After we changed the URL to https we got the badges images to be displayed.
Recently I wanted to add badges to an enterprise GitHub repository I order to have an overview of the Sonarqube statuses like coverage or quality gate.The issue is that the badges generated by the Sonarqube server(I am using a Sonarqbe server not Sonarcloud) do not show the image when added to the GitHub repository.I tried using the api from Sonarqube but there isn't any call that helped.Do you have any idea which I can try to make the images visible from a Sonarqube server to a repository from GitHub enterprise?
Sonarqube badge not working on github README
Finally I was able to solve this issue. After a lot of digging, i found a jira ticket (ticket link) for this particular issue. I tried searching through the java rules in sonar and was able to find it. For me, by default, it was not enabled. So had to create a new Sonar Gateway and add my java project to use this gateway and then enable this rule for the newly created gateway. Cheers.
I have a project inspring-bootjava and on doing the sonarqube analysis of the code, javadoc errors are not detected.The issue occurs during maven release when there is an error injavadocthe release build fails to build thejavadocjars and the release is interrupted./** * Method to calculate the sum. * * @param numberOne * First number. * @param numberTwo * Second number. * @return sum of numbers. */ public void sumCalculate(int numOne, int numTwo) { // code here }In the above code, the parameter names given in javadoc with@paramare different from the actual one and the@returnstatement is not actually required. But sonar qube doesnot report any of these issues in the analysis.Kindly guide me how to solve this? Is there any custom rule to be made?Thanks
SonarQube not showing errors in javadoc
After more research, this is not a Sonarqube problem. Thispost(and the way around it) most likely explain the root cause of my problem.Related post:LCOV/GCOV branch coverage with C++ producing branches all over the place
Sonarqube test coverage report says that my c++ statement are only partially covered. Example of a very simplified function containing such statements is as below:std::string test(int num) { return "abc"; }My test as follow:TEST(TestFunc, Equal) { std::string res = test(0); EXPECT_EQ (res, "abc"); }Sonarqube coverage report says that the return stmt is only partially covered by tests (1 of 2 conditions). I am wondering what is other condition that i need to test for?I also saw the following in the report:Condition to cover: 2 Uncovered Condition: 1 Condition Coverage: 50%It seems like i need a test to cover the other condition but i cant figure out what that is.
Sonarqube Partially covered tests
Just do as the suggestion says.Option 1: escape the escape characters with an additional\re = '\\{(\d+)[,\\-](\\d+)\\}'Option 2: make it a raw stringre = r'\{(\d+)[,\-](\d+)\}'In this case, option 2 requires less changes (only therprefix) and is easier to read.
There is a rule in SonaeQube/SonarLint/SonarSource for backslashes:-"\" should only be used as an escape character outside of raw strings [https://rules.sonarsource.com/python/RSPEC-1717][1]So now i am using regular expression like this :-re= '\{(\d+)[,\-](\d+)\}': # Numbered patternSonarQube is giving issue is like : Remove this "\", add another "\" to escape it, or make this a raw string.I cannot avoid the use of backslashes here, Please Suggest me how to solve this.
Sonar Issue: Remove this "\", add another "\" to escape it, or make this a raw string
Inside additional parameters, try adding this:-Dsonar.lanauge=c#If it doesn't work, try using command line runner instead of a TeamCity plugin:Step 1:Download and installSonarQube MSBuild runner from here.Step 2:Create a command line runner in your project build steps in TeamCity with commands below,don't forget to re-order this item to make it run before MSBuild.SonarQube.Scanner.MSBuild.exe begin /k:"%sonar.project%" /d:"sonar.host.url=%sonar.host.url%" /d:"sonar.login=%sonar.login%" /d:"sonar.organization=%sonar.organization%" /v:"%build.number%"This makes SonarQubeRunner hooks into MSBuild.Step 3:Create a command line build step again with the command below:SonarQube.Scanner.MSBuild.exe end /d:"sonar.login=%sonar.login%"This will send the analysis to SonarCube.Update 1:As you know, I have used a couple of params such assonar.loginand etc, don't forget to add them inside Parameters in TeamCity.sonar.login=> your loginsonar.organization=> the organizationsonar.project=> your project in SonarQubesonar.host.url=> host url of SonarCube eg.:https://sonarcloud.io
I am trying to setup SonarQube for a C# project, using Teamcity. The problem is that no C# files gets analyzed.Can you please double check my configuration and let me know if I might have missed anything ? I am all out of ideas on why it does not analyse any C# files.If you need any additional info please let me know and I'll edit the question.
How to configure Teamcitys SonarQube Runner to analyze C# files
Just a simple hack, since thesuperClass [email protected] it to class (if you are already usingLombok):@EqualsAndHashCode(callSuper = false)unless the subclass class has its ownequalsandhashCode.
I was cleaning the code of the system on which I work, cleaning some Sonar tool issues, and I came across the following message:Overide the 'equals' method in this classI did some research but nothing that answered the "why" of this noteWe are using a parent class withEqualsBuilderwhich providesEqualsBuilder.reflectionEquals, so the correction is just to declare the method overwritten by passing theequalsmethod of the parent class@Override      public boolean equals (Object o) {          return super.equals (o);      }by guarantee I'm also overwriting the hashCode method, but in the same way passing the responsibility to the parent class (same case for reflectionHashCodeHashCodeBuilder.reflectionHashCode)@Override      public int hashCode () {          return super.hashCode ();      }But still my question remains, why do I have to override this method if it can be achieved in inheritance?Thank you in advance
Sonar issue: "Overide the "equals" method in this class
Technically speaking, SonarQube (and in this instance, the SonarJava analyzer) has no guarantee that the connection returned by this method will ultimately be closed - hence the issue.If you are confident that your code base has all the required resource-cleaning code in place somewhere else, my suggestion here is to mark this particular issue asWon't fixin the SonarQube UI.
ReturningConnectionusing a method is a common practice, For example in Hikari'sHikariConnectionProviderpublic Connection getConnection() throws SQLException{ Connection conn = null; if (this.hds != null) { conn = this.hds.getConnection(); } return conn; }But Sonar warns about closing connectionConnections, streams, files, and other classes that implement the Closeable interface or its super-interface, AutoCloseable, needs to be closed after use. Further, that close call must be made in a finally block otherwise an exception could keep the call from being made.I want to return a Connection I can use later, so I can't close it in those methodsHow/if can I avoid such warning on main method to return valid connection?EDITAdded a false positive bug in Sonar community:S2095 report on method return ConnectionEDIT 2Issue isn’t reproducible on latest version
Sonar squid:S2095 when method return Connection
Add config file.gometalinter.jsonto the root of your project and specify rules for excluding:{ "exclude": [ ".*_test.go", "/any/folder/" ] }
I am using gometalinterv2 in my Go project for linting. After the lint report is generated, the report file is linked to sonarqube for analysis and presentation.I want to exclude some files like *_test.go from linting. I know there is a --exclude flag for gometalinterv2 to exclude folders. But since _test.go files are in the same folder/package as the source code, this won't work.So is there any way to achieve this (either at linting stage or in sonar properties file)?
Excluding specific set of files from lint issue report
I solved all above issues with below configuration in JenkinsSonarQube configurationJenkin Global tool configurationFreestyle project configuration
Application StackJenkins.NET 4.7SonarQube 7.4Bitbucket (Source control)VS 2015 Update 3VsTest to execute UnitTestPath of Msbuid in Global Tools Configuration isC:\Program Files (x86)\MSBuild\14.0\Bin\Msbuild.exeAlso tried with C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Msbuild.exeWe have created sample project and configured all in one server.We can see multiple kind of errors in log files likeGeneration of the sonar-properties file failed. Unable to complete SonarQube analysis.WARNING: File 'C:\Program Files (x86)\Jenkins\workspace\CICD\UnitTestProject1\Properties\AssemblyInfo.cs' is not located under the root directory 'C:\Program Files (x86)\Jenkins\workspace\CICD.sonarqube\out' and will not be analyzedNo analysable projects were found. SonarQube analysis will not be performedThis only comes when i use msbuild from "Program files"An instance of analyzer SonarAnalyzer.Rules.CSharp.FieldsShouldNotBePublic cannot be created from C:\Users\manish.joisar\AppData\Local\Temp.sonarqube\resources\0\SonarAnalyzer.CSharp.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependenciesI can see message with build succeeded.I can also see successful test run message Total tests: 1. Passed: 1. Failed: 0. Skipped: 0. Test Run Successful.Sonar configuration is done in build configuration under "Execute Sonar scanner" stepI am not sure what is missing here, wrong configuration, wrong msbuild ??
Generation of the sonar-properties file failed. Unable to complete SonarQube analysis
use "projectKey" instead of "projectkey"
We have used AD/LDAP for authentication in SonarQube 7.0... We achieved AD/LDAP authentication successfully...However we want to give project level permissions to different users through program (php / Python).SonarQube suggests to use web api as belowPOST api/permissions/add_user Params 1. login = XXX 2. permission = user / codereviewer / scan / issueadmin 3. projectid (optional ) 4. projectkey (optional ) = ABCExample Request suggested by SonarQube documentationcurl -X POST -v -u admin:admin 'http://localhost:9000/api/permissions/add_user?permission=codeviewer&user=XXX&component=ABC'We attempted to write php curl to handle post web request and get json response as per below :<?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"http://localhost:9000/api/permissions/add_user"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "login=XXX&permission=user&projectkey=ABC"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $server_output = curl_exec ($ch); curl_close ($ch); if ($server_output == "OK") { ... } else { ... } ?>It did not reflect any changes over the ABC project permission for user XXX....Can anyone guide me on this topic ?I want to know algorithm if any for Sonarqube web api post request... e.g. To access this post request we need web api admin login /logout for sonarqube before api/permission OR It needs some cookie or tokens...Thank you for helping me on this..
SonarQube POST api/permissions/add_user , to give project permissions to many users programatically?
There is no automatic way to do that, and note that not all TSLint rules are available through SonarTS. So I would recommend:Create profile with the rules you want manuallyorUse a new feature allowing import of tslint reports (https://docs.sonarqube.org/display/PLUG/Importing+TSLint+and+ESLint+issues+for+TypeScript+files), but until SQ 7.2 is released you can use it only onSonarCloud.P.S.This pagecan help you to find matching rules
I am currently using SonarTS to analyse my Angular 5/6 App. I am running tslint locally using the tslint.json ruleset and have cleared all errors/warnings. After sonar analysis it is apparent that the TsLint quality profile in SonarTS and the tslint.json are not using the same ruleset. Is there anyway to get SonarQube to use my project tslint.json and create a quality profile based on that ruleset?
Sync SonarTS Quality profile with tslint.json Angular Project
Injected MembersYou are right about injected Members (@EJB, @Resource, ...) and there are (now fixed)Issuesin the SONARJAVA Issue Tracker.For exampleSONARJAVA-2744Title: "S2226 should not raise issues for field annotated with @Resource"Solved with Version 5.4 of the Security RulesMembers initialized in #initThere is another (solved) issue:SONARJAVA-1458Members initialized in #init should not trigger squid:S2226.AccordingServletConfig:Usually there is no need to hold a reference toServletConfigbecause it is accessible usingGenericServlet#getServletConfig.
When I try to use the Resource annotation in a servlet, Sonar triggers rule squid:S2226 "Servlets should not have mutable instance fields" and tells me make the variable final or static.But resource injection does not work and final and static variables.Is it a bug in sonar or resource injection is not recommended anymore in servlets ?public class MyServlet extends HttpServlet { @Resource(name = "jdbc/database") private DataSource dataSource; }A similar conundrum appears with ServletConfigprivate ServletConfig config; @Override public void init(ServletConfig config) throws ServletException { this.config = config; }Here,configcannot be made final, but making it static trigger the other rule squid:S2696 : "Instance methods should not write to "static" fields"I meet this situation with SonarLint for Eclipse 3.3.1.201712071600, if that is useful.
Resource annotation in servlets triggers squid:S2226
From your comments on your question, it seems that you haven't tried configuring the path to the report, so it's natural that no coverage data is imported. The analysis cannot intuit where reports are or that it should read them.Having said that, you also indicate that you're generating acobertura.xmlfile, but that's not one of the formatscurrently supported by SonarCFamily for Objective-C. So you'll need to get your coverage data into theGeneric Coverage format, and then include the path to that report using thesonar.coverageReportPathsanalysis property.
I am using Fastlane for building and testing my ObjC project. I usescanaction to run Unit Test cases andslatheraction to generate Code coverage report. I am able to generate cobertura.xml report using slather action, but unable to publish the report to SonarQube.I am using SonarQube 6.4 and fastlane 2.64.0.FastFilescan( workspace: "Sample.xcworkspace", scheme: "SampleTests", code_coverage: true, output_types: "html" ) slather( cobertura_xml: true, output_directory: "./reports", proj: "Sample.xcodeproj", workspace: "Sample.xcworkspace", scheme: "SampleTests", ) sonarAnalysis is published to Sonar but Code Coverage report is not updated. Please let me know where i miss the key.
Publishing Slather Report to SonarQube
After couple of days struggle, We found that answer,if SCM is not configured then "Technical Debt Ratio on new code" won't be computed (details in development storyhttps://jira.sonarsource.com/browse/SONAR-5876)For Maven based project,Add SCM tag details in POM file (https://maven.apache.org/scm/maven-scm-plugin/usage.html)Enable and Add SCM details in SonarQubeA ) Go to Administration --> General Settings --> SCM (Left side menu) 1.set as false to "Disabled the SCM Sensor" and SCM provider "svn" 2.Add User name and password in SVNRun the Sonar scan your project
I have a problem related Tech Debt ratio on new code . when i introduce new code smells , I can see that Debt increased on the new code however the debt ratio always shown as 0 . I have tried changing development code (10 ,15,20) but still i am seeing same issue .Did i missed any configurationSonarQube version : 5.6.6 & 6.7 also .
Technical debt ratio on new code always appear 0%
Use thesonar.branchproperty to run branch the analysis. I guess (not tested) that the main project's quality gate will apply.If that is not an option for whatever reason, usecurlto provision the project and to set the quality gate:curl -s -u admin:admin -XPOST "localhost:9000/api/projects/create?project=b&name=bla" | python -m json.tool curl -s -u admin:admin -XPOST "localhost:9000/api/qualitygates/select?projectKey=b&gateId=1" | python -m json.tool
We are using Jenkins as our CI server, and Sonarqube for code analysis.Currently we are using SonarQube 4.5.7 and we want to upgrade to version 6.5. We have several quality gates, and we can't find anautomaticway to assign the quality gate to the project.In previous version we used thesonar.QualityGateproperty, but this property is now deprecated.How can we let Jenkins setup the quality gatebeforeit starts the analysis?
How to automatically change the Quality Gate?
Indeed, there's a bug for short text in bold.Ticketcreated. It's fixed in SonarQube 7.0.
When I update rule description using extend description, syntax to put text in bold doesn't work when text has less than 3 characters.example:*ABC* giveABCand *WORLD* giveWORLDbut*AB* give AB and *A* give AIs it something I did wrong or not ?S.
Sonar - Rule customization - Markdown syntax issue
Use of the following plugin (SonarJS) helped resolve my confusion and begin analysis - docs.sonarqube.org/display/PLUG/SonarJS
I have a front end project (AngularJS - not latest version) and want to analyze the code with SonarQube.Here is what I did so far.1) Grabbed my project from GitHub and cloned to desktop.2) Downloaded SonarQube-6.5 and extracted to desktop.3) Opened sonarqube-6.5\extensions\plugins (in my extracted directory) and pasted a front end plugin (downloaded fromhttps://github.com/groupe-sii/sonar-web-frontend-plugin)4) Created sonar-project.properties in my web directory of my projectContents# Required metadata sonar.projectKey=project-name sonar.projectName=project name sonar.projectVersion=0.1 # Comma-separated paths to directories with sources (required) sonar.sources=src/app # exclude some files and folders (typically dependencies) sonar.exclusions=bower_components/**/*, node_modules/**/* # Encoding of the source files sonar.sourceEncoding=UTF-8Then I ran the following in command line.cd project root dir"c:\\sonar-scanner-msbuild-3.0.2.656\SonarQube.Scanner.MSBuild.exe" begin /k:"orag.sonarqube:sonarqube-scanner-msbuild" /n:"CMNHMobile-nextrelease" /v:"1.0" c:\pathto ms build\MSBuild.exe /t:Rebuild "c:\sonar-scanner-msbuild-3.0.2.656\SonarQube.Scanner.MSBuild.exe" endAfter these steps I do not see any project listed in my localhost:9000 (SonarQube)What can I do to show the project for analysis?
SonarQube / AngularJS - How to I get SonarQube up and running to get my Angular project integrated / analyzed?
S1451is configured with the required/desired header. The easiest thing to do would be to look at the configuration of the rule in the profile that's being applied & copy/paste the configured header into your file.
I am using the sonar (v5.6.6) and c# plugin (v6.3)for code analysis. After sonar analysis execution. MyC# Codeviolated ruleS1451(Rule Name:Track lack of copyright and license headers).I tried many of the copyright formats, but no luck all fails to compliant with this rule.How to make the code to compliant with rule S1451?
Issue on make the code compliant for sonar rule S1451 for C#
You should usesonar.branchproperty.SeeSonarQube Analysis Parameters.
I'm using TFS as my scm, Jenkins, and SonarQube. I'm trying to run a build for my maven project, and I'd like to trigger SonarQube as well. I have everything working fine, but I'd like to add the name of the branch from TFS as part of the project key in SonarQube.So, in mypom.xmlfile, I have the following line in my properties.<sonar.projectKey>com:${env.GIT_BRANCH}</sonar.projectKey>I then get this error:"com.origin/master" is not a valid project or module key. Allowed characters are alphanumeric, '-', '_', '.' and ':', with at least one non-digit.I was wondering if there's a way for me to parse this variable to get rid of the "origin/" so that I can make this a valid project key.I can domvn sonar:sonar -Dsonar.projectKey="com:%GIT_BRANCH:~7%"but I'm wondering if there's a way to do this having everything in thepom.xmlfileEDIT: I'm building with Jenkins
How to make the git branch name part of the SonarQube project name?
Searching for components bypartial keysis currently not supported.The code that controls the search results of this query is this snippet inComponentMapper.xml:<if test="query.nameOrKeyQuery!=null"> and ( p.kee = #{query.nameOrKeyQuery,jdbcType=VARCHAR} or upper(p.name) like #{query.nameOrKeyUpperLikeQuery,jdbcType=VARCHAR} escape '/' ) </if>Here,nameOrKeyis the value of theqparameter, managed byComponentQuery. In the above snippet you can see that the value is used either tomatch exactlythe project key, or tomatch partiallythe project name.
According to thedocumentationofapi/components/search, parameterq:Limit search to component names or component keys that contain the supplied string.Unfortunately, the statement is true only for names, searching with a key requires complete string. Is there any other possibility to search for projects using only a substring of a key?Tried in 6.3.1 and 6.4, both versions do not work.
SonarQube API: projects with key that includes string
Use absolute filename path in gcovr report solved for me.sonar config file:sonar-project.propertiessonar.projectKey=xxx sonar.sources=src sonar.host.url=http://xxx:xxx sonar.login=xxx sonar.language=c++ sonar.cxx.includeDirectories=xxx sonar.exclusions=xxx sonar.cxx.coverage.reportPath=gcovr_report.xml sonar.cxx.coverage.itReportPath=gcovr_report.xml sonar.cxx.coverage.overallReportPath=gcovr_report.xmlgcov temp file gcda/gcno in directory /xxx/src.create gcovr xml report:gcovr -r /xxx/src --xml-pretty > gcovr_report.xmlreplace filename tag in gcovr_report.xml with absolute path.run sonar runner:~/sonar-scanner-3.0.3.778-linux/bin/sonar-scanner -X
Our Sonar Build Environment details as follows:SonarQube Server Version - 5.6.6 (64-Bit). Sonar Client Build Operating System – Ubuntu 14.04.5 LTS (64-Bit). Sonar-scanner- Version - 3.0.3.778. sonar-cxx-plugin-0.9.7.jar Source Code Language: C++Description:-I have .gcov coverage report. Want to know is it possible to import into Sonarqube dashboard using Cxx community plugin?If so, kindly help me with the steps. Thanks in advance.
Gcov report import in Sonarqube-5.6.6(LTS) using CXX Community Plug-in
First of all, SonarQube 5.5 is old, you should first consider using the latest LTS (5.6) in order to be able to get feedbacks.Versions of projects can be found by using :api/events/index (it's replaced by api/project_analyses/search in 6.3) -> it will return you the date of analysis on which there's a version.And in order to get measures from the past, you can use :api/timemachine/index (it's replaced by api/measures/search_history in 6.3) -> you'll be able to found the measures from the version you want.
How do I get the measures (like code-coverage, technical debt, complexity, nloc, ...) of a certain build version (eg. 1.0.0.20) from the api of SonarQube?My goal is to get these information and display it along with some-other info pertaining to that version got from other sources like bitbucket.I am able to only see the measures of the current (latest) build (eg. 1.0.0.45) version through theapi/measure/componentapi link.Although, I can see these measures for individual builds through the UI under the compare option. But how to get it through rest api?SonarQube Version 5.5Plugins:sonar-scoverage-plugin-5.1.3.jarsonar-scm-git-plugin-1.2.jarsonar-scalastyle-plugin-0.0.1-SNAPSHOT.jarsonar-javascript-plugin-2.11.jar
How to retrieve SonarQube metrics of previous build versions through the api?
Yes, ReSharper has more rules. However, the covered cases might not show such big difference than the advertised numbers. For example SonarLintS2971covers many cases. In ReSharper each of these are considered individual rules.
Jetbrainsbrags on their websitethat Resharper 2016.3 has over two thousand more rules than Visual Studio 2015. But how does Resharper 2016.3 compare to SonarLint? (a popular plugin for Visual Studio 2015)
Does Resharper have more rules than SonarLint?
Very comprehensive documentation is here:Docker - sonarqubeEspecially best practices are mentionned in sectionAdvance Configuration.When you need additional plugins, the best practice is to mount dedicated directory, where plugins are located. This saves you maintenance of the docker images, when updating any plugin.There is also hint, that you can externalize configuration directory, what will help you to manage configuration.
I want to (un)install some SonarQube plug-ins and load a quality profile xml file all within a Docker container.My approach so far is this (part of my Dockerfile):RUN set -x \ && apk add --no-cache unzip curl \ && curl --tlsv1 -o sonarqube.zip -fSL https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-6.3.1.zip \ && unzip sonarqube.zip \ && mv sonarqube-6.3.1 /opt/sonarqube \ RUN java -jar /opt/sonarqube/lib/sonar-application-6.3.1.jar & RUN curl -X POST -u admin:admin http://localhost:9000/api/plugins/uninstall?key=csharp ENTRYPOINT java -jar /opt/sonarqube/lib/sonar-application-6.3.1.jarI tried to start SonarQube in a separate process, as you can see:java -jar /opt/sonarqube/lib/sonar-application-6.3.1.jarBut the next command,curl -X POST ...is failing, probably because the sonar server isn't up and running at this moment:The command '/bin/sh -c curl -X POST -u admin:admin http://localhost:9000/api/plugins/uninstall?key=csharp' returned a non-zero code: 7However, if I don't start a new process for SonarQube (removing&at the end of the line), the docker build keeps hanging telling me that SonarQube is up.How can I configure SonarQube in a Dockerfile? And what is the best way to stop it at the end of the configuration (to avoid conflicts with the entrypoint)?
How to configure SonarQube in a Docker container?
Even the latest version of SonarLint does not support the external plugins(pmd,findbugs,checkstyle etc).It only uses the squid rules in the sonarqube which are written bymodifying and optimising the external plugin rules.The reason why SonarLint doesn't support external plugins is thatpmd,findbugs analyses code in different mannerspmd compares the code by making asyntax treeand findbugs needbyte codeto analyse.So thistakes up a lot of time.To analyse in afaster and efficient mannerthe sonarlintonly supports squid rules from sonar server.soi don't thinkthere will be an update to support external plugins like pmd,findbugs etc.Because most of the external plugin rules haverewritten in an optimised mannerin SonarQube.
I'm using the SonarLint version as 3.1.0 in eclipse Neon. And SonarQube version as 5.6.6.While analyzing the issue for the project, it is noticed that it is not showing the issues for the external plugin (PMD,FindBug,CheckStyle).From theSonar Lint not in sync with server ruleslink I understood that the sonarLint will not support to the external plugin. Is there any idea of supporting the external plugin in the future release of SonarLint version?Can any one please help me.
SonarLint is not showing the issues for the external plugin (PMD,FindBug,CheckStyle)
What I did was:Download Sonarqube LTS version (https://www.sonarqube.org/downloads/)Download and install dependencies and Sonar-Swift fromhttps://github.com/Backelite/sonar-swift(including sonar-scanner)Download sonar-project.properties (https://gist.github.com/Edudjr/db51907068ea76b116d11d9a9b13f05f#file-sonar-project-properties) and configure it according to your project. Place it in your project root folder.Download run-sonar-swift.sh (https://gist.github.com/Edudjr/79a2379842357c33709aecf040d9ae77#file-run-sonar-swift-sh), place it in somewhere in your mac and add to path (/etc/paths). I did a small change in the script because oclint was not running properly.Start your Sonarqube server (sonar.sh console in sonar folder) and run run-sonar-swift.sh in your project root folder. You should be done.
Im trying to analyse swift app using SonarQube. followed the instructions fromhereIm able to run the sonarqube server and running sonar-scanner while running it I'm getting this errorcom.sonarsource.A.A.B.A: No license for swiftI'm using this plug in, backelite-sonar-swift-plugin-0.2.4.jar i feel this plug in is free and we can use it. correct me it I'm wrong.
sonar-swift to analyse xcode project
You have to modify the quality gate (SonarQube way) by adding a rule, that errors (or warns) if the Mutation coverage is "less than" 65
We are using the default 'SonarQube way' quality gate, which has a 'Mutations Coverage' setting, however this does not seem to cause the gate to fail.For example, I have a small test project that does not have enough mutation coverage, and reports this as a code smell:3 more mutants need to be covered by unit tests to reach the minimum threshold of 65% mutant coverageThis comes from a FindBugs quality profile. Is it possible also to fail a quality gate?
Can I get a quality gate to fail if mutation coverage is not high enough?
Not easy but you can try a '@BatchSide' (implements PostJob) plugin, with :1- load last master analyse with web api rest (new GetRequest("api/....)2- consider curent analys results with the PostJobContext Object3- do your own business and then throw MessageException.of("too much errors comparer to master branch");
In SonarQube, I have a project for mymasterbranch and a project for each feature branch:feature/someFeature.I would like that when any of the projects corresponding to my feature branches is analysed, it should be compared with mymasterbranch project. And in case the projects for my feature branches have worse code coverage or overall grade, I would like the Quality Gates to fail.Any idea how to do that using SonarQube?
Compare all feature branches with master
Sonar is doing code analysis for nested (inner) classes. It works well for my commercial project (I cannot share example). Violations are reported for inner static and non-static classes.There are some rules specific to inner classeshttps://sonarqube.com/coding_rules#q=inner|languages=javaFor available example seehttps://sonarqube.com/component_measures/metric/lines/list?id=com.icegreen%3Agreenmail-parentFrom line 358 you have inner class FetchCommandParser that is analysed. There are a few warnings reported for code in that class.Internally, sonar plugin works with source code and bytecode. By defaultall codeyou have is submitted for analysis (you may configure exclusions if you want to).
IntroductionI'm thinking how I can get past specific critical/major issues without making major refactoring and breaking the comparison with previous revisions (diff etc).I know I can split my class into multiple classes that are in the same file without breaking the comparisons. I have done this already.(Will provide an example tonight).However, question is: does SONAR consider accompanying classes in the same .java file when running it's algorithms? Does it consider nested classes?More importantly does it consider them as part of the key 'public class' that has the same name as the file name. Do the calculations for the various metrics consider them as thepublic classwhen generating the warnings?Exampleof how to refactor code so diff is not majorly brokenI had the following code in a very long chain ofif, else if:}else if ("cdbStreet".equals(paramKey)) {And converted it into:}else{ setSearchDataByRequestParametersPart2(searchData, ...); } } return queryString.toString(); } private static void setSearchDataByRequestParametersPart2(SearchRequestData searchData, ...) { if ("cdbStreet".equals(paramKey)) {
Does SONAR implementation consider accompanying classes as part of the public class - metrics
Although Jenkin's context is specific (and the question is old), the answer is more general (and still valid). You can find it on this topic:SonarQube analysis could not be completed because the analysis configuration file could not be found.TLDR;Look at the beginning of the SonarQube session, then you find the REAL problem. The last message is only a kind of not-so-useful summary.
We just installed a Jenkins and a SonarQube server.I already created the SonarQube project, and now I'm configuring the SonarQube part on jenkins.I've a weird behavior: Sometimes, jenkins(or the sonarqube runner, I don't know) is creating a whole bunch of configuration files for sonarqube in the.sonarqubefolder of my workspace. In this case, it seems to work, the results are published. But sometimes(without any changes in between), thoses files are missing, and then the build fails with the following message:11:39:55.091 SonarQube analysis could not be completed because the analysis configuration file could not be found: D:\Jenkins\workspace\MyProjectName\.sonarqube\conf\SonarQubeAnalysisConfig.xml.My sonarQube and jenkins are both being executed on a Windows server 2012 computer(the same in fact). I've an authentication token filled in the sonarqube configuration, and I've the "Enable injection of SonarQube server configuration as build environment variables" checked.I'm not sure to fully understand the process:Should I create myself this project, or is it something that Jenkins should create automatically? If I should create it manually, how and where?If this is something that should be created automatically, why is it not working?
Jenkins: SonarQube analysis could not be completed because the analysis configuration file could not be found
The default ruleset used in standalone mode seems to be defined in classes in the Eclipse Sonarlint plugin jar (e.g. inorg.sonarlint.eclipse.core_2.2.1.201608261350-RELEASE.jar) . This means that it's currently not possible to change this ruleset (unless you want to try and reverse engineer it). Your only option is to connect each machine to a SonarQube server.It seems there are plans to add more customization support in the future (see alsothis answer).
i would like to know where eclipse keeps the ruleset for Sonarlint, so i can copy it to other Eclipses without connecting to a Sonar-Server.As you download Sonarlint, it comes with a standard ruleset. When you connect it to a Sonar-Server it downloads the ruleset defined on the server. So where will be this ruleset stored?Thanks in advance.
Where is the Sonarlint Ruleset file in eclipse?
This issue has been fixed in version4.0of the Java Analyzer, only compatible with SQ LTS5.6. See corresponding JIRA ticketSONARJAVA-1179
We are using Java 8 and Dependency Injection (GUICE). Currently we have a false-positive Sonar issue, about unused method, although this method is invoked via reflection from GUICE Injector, due to Inject Annotation.Affected code:@Inject private void setTransactionalCommandStack(TransactionalCommandStack transactionalCommandStack) { ... }SQ reports a violation of the rule squid:UnusedPrivateMethodUnused "private" methods should be removedat this place and saysPrivate method 'setTransactionalCommandStack' is never used.The Eclipse environment which also has a check for unused methods detects it correctly and only puts a warning if I have no @Inject annotation for the method. The same I would expect in SonarQube.I tested both Annotation javax.inject.Inject and com.google.inject.Inject. In both cases SonarQube reports that the method is unused.SQ version: 5.3Java plugin version: 3.14
Java method with @Inject annotation: False-positive for the rule "Unused "private" methods should be removed"?
Thank you for investigating this issue. I can confirm that we do not takeExcludeFromCodeCoverageinto account. Created a JIRA ticket for this:https://jira.sonarsource.com/browse/SONARCS-611
I have a .Net project and I have recently integrated Sonar to measure the code coverage but the Coverage is very low compared to coverage that I see in DotCover. When I checked in details, found that SonarQube is still counting the C# classes marked with "ExcludeFromCodeCoverage" attributes for Code Coverage. Is there any setting that I need to update in SonarQube build?
SonarQube for .Net project, code coverage not excluding file marked with "ExcludeFromCodeCoverage"
You may want to take a look atsonarqube gradle plugin excluding jacoco integration testsIt seems that this property is not available
Let's say Main module A And Sub modules are B and C .In my gradle file I have added only below configuration for sonar and jacoco.apply plugin: 'spring-boot' apply plugin: 'org.sonarqube' app vly plugin: 'jacoco' jacocoTestReport { group = "Reporting" description = "Generate Jacoco coverage reports after running tests." additionalSourceDirs = files(sourceSets.main.allJava.srcDirs) } sonarqube { properties { property "sonar.projectName", "A" property "sonar.projectKey", "org.codehaus.sonar:A" property "sonar.jacoco.reportPath", "${project.buildDir}/jacoc /test.exec" property "sonar.jacoco.itReportPath", "${project.buildDir}/jacoco/jacoco-it.exec" } }when I run the gradle task :./gradlew clean :A:sonarqube -PprodBuild Successful but showing below infoINFO - JaCoCoItSensor: JaCoCo IT report not found: /../../../../A/build/jacoco/jacoco-it.execIntegration tests are working fine. but only show the code coverage of main module. What I want is, when I run the integration test, the sub module code also covered in the code coverage report.
How to generate code coverage report for integration test using sonar + jacoco in mutli module system using gradle
You could mark yourgetTestasstaticand write your method with using references as follows:protected List<Test> getTests(List<String> testIds) { if (CollectionUtils.isEmpty(testIds)) { return new ArrayList<Test>(); } return testIds.stream() .map(Test::getTest) .collect(Collectors.toCollection(ArrayList<Test>::new)); }
I am getting following warning on Sonar:Replace this lambda with a method referenceCode is :protected List<Test> getTests(List<String> testIds) { List<Test> tests = new ArrayList<>(); if (!CollectionUtils.isEmpty(testIds)) { testIds.stream().forEach(eachTestId -> tests.add(getTest(eachTestId))); } return tests; }How can I get over this warning?
SONAR: Replace this lambda with a method reference
Exclusions are Project Properties, so you could use/api/propertiesWeb Service to automatically get these properties from one project and set them on another project.For example, to migrate code coverage exclusion (propertysonar.coverage.exclusions, as shown in the Settings UI) from projectfooto projectbar:get the value from projectfoo:curlhttp://_your_sonarqube_/api/properties/sonar.coverage.exclusions?resource=foo&format=jsonset the same value on projectbarcurl -u admin:admin -X POST 'http://_your_sonarqube_/api/properties?id=sonar.coverage.exclusions&value=_value_from_foo_&resource=bar'(wherevalue_from_foois the value you obtained from the first Web Service call above)
Is it possible to export exclusions for code coverage and issues in sonarqube from one project and import to other project?
Export of exclusions for code coverage and issues in Sonarqube
For everyone experiencing this same issue:Apparently the problem lies with the C# Plugin. Right before I updated the SonarQube instance from 5.2 to 5.3, I updated all the system plugins that had updates available. One of them was the C# Plugin. Version 4.3 was installed and was updated to 4.4. After "extensive" testing on a virtual machine with a clean SonarQube 5.2 installation, I found out that the SonarQube version had no influence on the technical debt analysis.
We have a build step in TFS 2015 (vNext build system, on prem) that kicks of a code analysis in SonarQube (also on prem | runs a service | database in SQLExpress). Last week we've updated to SonarQube 5.3 (from 5.2) and apparently the first analysis run on 5.3 caused all open issues to be closed/marked as fixed. We had a technical debt of several days (even weeks) and more than 1000 open issues. After the first run the debt was down to < 1h and just 2 issues. After another analysis run the debt is now 1h20min and 5 issues. All the previous issues are marked as 'Fixed'.I've opened a few or those 'fixed' issues, but the code hasn't been changed. Most of the files haven't been touched in months.What I have done so far:I've added a new project to SonarQube and changed the Project Key and Project Name in our build to the new temporary name. Started a build that caused an analysis to run. I was hoping a new analysis on a new project would discover all issues again, but also this analysis doesn't result in all previous found issues.I've installed SonarLint on VS2015 and itdoesshow all issues (about 1500) on the same solution that was analysed.Is there a way to 'reset' the SonarQube technical analysis so that it will analyseallfiles and create (or re-open) issues?Thanks!
SonarQube: Is there a way to reset the technical debt analysis
It seems that we'll see Caché Object Script plugin to SonarQube in production soon. See discussion about thishere
We use InterSystems Cache which has a development language called ObjectScript (kinda looks like VB).It has it's own IDE called Studio.Has anyone been able to successfully use SonarQube with Studio/ObjectScript?There is no plugin for it.Thanks for any help.
Anyone use SonarCube with ObjectScript
You are actually asking question for two different cases :You are hitting a known limitationhttps://jira.sonarsource.com/browse/SONARJAVA-1295we plan to fix this (hard) one in the next release of java plugin.This one is actually not a false positive at all ! :) if your variablelastUpdateis null then the condition is true without evaluating the right hand side of the||and if it is false, thenlastUpdate != nullwill always evaluate to true so you can actually remove it.
I think we found a false positive:private static void copy(File from, File to) throws FileNotFoundException, IOException { FileChannel src = null; FileChannel dst = null; try { src = new FileInputStream(from).getChannel(); dst = new FileOutputStream(to).getChannel(); dst.transferFrom(src, 0, src.size()); } finally { if (src != null) {Change this condition so that it does not always evaluate to "true"or do I miss anything? another example:if (lastUpdate == null|| lastUpdate != null && lastUpdate.before(new Date(System.currentTimeMillis() - 900000)))
java plugin 3.8 - S2583 false positive
Android lint plugin is currently relying on android lint tool (available in the android SDK). Therefore there is no way provided by this sonar plugin to add custom rules. (and no real plan to do so, as we want to provide nice android rules via the java plugin).You could try to write a small plugin to add your custom android lint rules (because I think you can write custom rules for that tool) to sonarqube so then the android lint plugin would be able to import issues related to those rules in sonarqube.
I want to add some custom rules in thesonar-android-masterplugin.Found thisanswerbut its not clear in this where to login as Administrator.But while searching more I got thisExtending Coding Rules, which states that to add custom rules for android-lint XPath and Java can't be used.So please here is my question:Is it possible to add a custom rule in the sonar-android-plugin ?If answer to above question is yes then please provide me with some inputs on how to proceed ?
Sonar Android Plugin Add custom rules
You're not going to be able to pick up that FindBugs report; theFindBugs pluginruns the tool itself, based on therulesconfigured in theprofilein use.
I am trying to setup the SunarQube runner as an sbt task. So far I have managed to generate reports for Scoverage only.I am running thefindbugstask independently, which generated a report.xml, but the sonar runner doesn't pick it up. Relevant settings I pass to the sonar runner:"sonar.dynamicAnalysis" -> "reuseReports", "sonar.scoverage.reportPath" -> s"${crossTarget.value}/scoverage-report/scoverage.xml", "sonar.findbugs.reportPath" -> s"${crossTarget.value}/findbugs/report.xml",Is there another setting I should know? Is there a complete listing of all the settings I can use in Sonar?
SonarQube runner in sbt: findbugs, scalastyle
Since the C# plugin version 4.0, the recommended and only supported way of analyzing projects is through the use of the MSBuild SonarQube Runner, developed jointly with Microsoft. See the documentationhttp://redirect.sonarsource.com/plugins/csharp.htmlThis new way of analyzing C# projects fully integrates with MSBuild, and solves many integration issues such as the one you are currently facing.The Analysis Bootstrapper Plugin for Visual Studio Projects Plugin (aka the Visual Studio Bootstrapper Plugin) that you are trying to enable withsonar.visualstudio.enablehas been deprecated, and might not be installed on your SonarQube server. If it's there, you'll be able to safely uninstall it after you've migrated all your projects to use the MSBuild SonarQube Runner. You also will be able to delete thesonar-project.propertiesfile of migrated projects.
We are usingSonarQube 5.1andlatest MSBuild Sonar Runner C# plugin 4.2.While running the analysis with FxCop Rules enabled we Caused by:java.lang.IllegalArgumentException: The property "sonar.cs.fxcop.assembly" must be set and the project must have been built to execute FxCop rules. This property can be automatically set by the Analysis Bootstrapper for Visual Studio Projects pl ugin, see: http://docs.codehaus.org/x/TAA1Dg. If you wish to skip the analysis of not built projects, set the property "sonar.visualstudio.skipIfNotBuilt".This is thesonar.project.properties:# Project identification sonar.projectKey=TestSonar sonar.projectVersion=1.0-SNAPSHOT sonar.projectName=TestSonar #Core C# Settings sonar.silverlight.4.mscorlib.location=C:/Program Files (x86)/Reference Assemblies/Microsoft/Framework/Silverlight/v5.0 #UnitTests sonar.cs.vstest.reportsPaths=TestSonar_UnitTests/*.trx #CodeCoverage #sonar.cs.vscoveragexml.reportsPaths = C:\Users\sabharadwaj\Documents\Visual Studio 2013\Projects\TestSonar\TestSonar_UnitTests\VS2013_TestSonar.coveragexml sonar.cs.opencover.reportPaths=C:\Users\sabharadwaj\Documents\Visual Studio 2013\Projects\TestSonar\TestSonar_UnitTests\VS2013_TestSonar.coveragexml #FxCop sonar.cs.fxcop.assembly=C:\Users\sabharadwaj\Documents\Visual Studio 2013\Projects\TestSonar sonar.cs.fxcop.fxCopCmdPath=C:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Static Analysis Tools\FxCop\FxCopCmd.exe
The property "sonar.cs.fxcop.assembly" must be set and the project must have been built
-1It seems you're breaking component/module/library conventions or mis used it. FromConfiguration Managementprinciples you're not supposed to "include" (build in the case of Binary Configuration Management) your component multiple times.Having a library which have many other ones which depends on and last ones are independant is just a dependancy that you have to manage appart like any other framework.You're just supposed to install/deploy this component on his own and then just refer to it. Same principles apply onSonarQube Configuration Manager. You can't have shared components analyzed through different "products".They must have their own life cycle. How do you manage evolution of shared librairies when having the four projects living in parallel of each others ?
I have four projects, which have several modules in common.When I try to run a SonarQube complete analysis, only the first project gets successfully analyzed. Starting with the second project, I get an error message along the lines of "XXX module is already present in the server".Each of my four projects contains an aggregator POM. This is what I use to build them and to run the Maven sonar:sonar goal.What would be the best approach to solve this issue?
SonarQube: How to analyze projects that share multiple modules?
You should add Code Coverage Tool to your build process. If you use Maven, then you can add:<build> ... <plugins> ... <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.7.5.201505241946</version> <executions> <execution> <id>jacoco-initialize</id> <goals> <goal>prepare-agent</goal> </goals> </execution> </executions> <configuration> <rules> <rule> <element>CLASS</element> <excludes> <exclude>*Test</exclude> </excludes> </rule> </rules> </configuration> </plugin> </plugins> ... </build>
I am trying to usescm activity plugin 1.8for clearcase and usingsonar 4.3.3and got the blame information in the sonar but did not getting the coverage on new code in dashboard
Not getting the coverage on new code in sonar dashboard
SonarQube version 5.x+ will automatically assign issue to the last committer on the line if:It is a new issue that has been introduced since the last analysisIt was possible to match the SCM user to a SonarQube userSo, if you did an initial analysis of your project, then enabled the SonarQube SCM TFVC plugin, and redid an analysis, none of the issues are new, and so it is expected for all of them to stay unassigned.Start by verifying that you get the SCM data from TFVC properly imported into SonarQube:
I want use the TFVC plugin with sonar. I have copied the filesonar-scm-tfvc-plugin-2.0.jarinSonar\extensions\plugins. I use the following configsonar.properties:sonar.scm.enabled=true sonar.scm.provider=tfvc sonar.tfvc.username=my Tfs UserAccount sonar.tfvc.password.secured=My TFS passwordWhen I run a sonar analysis on the command linec:sonar.net-runner.cmd, the analysis is successful.But on the web side, all issues are not assigned....Is there something wrong ?
How to use sonar TFVC plugin?
A possible is that your project is being recognized as a test project, for which metrics and issues are not imported in SonarQube. By default, it tests for the presence oftestorTestin your project name. Check the logs at the beginning of the analysis to see how the Visual Studio Bootstrapper Plugin detected your projects. You can change this behavior by setting thesonar.visualstudio.testProjectPatternproperty to a different (Java) regular expression.
I am using - .NET framework 4.5.2, SonarQube 5.0, sonar runner 2.4, Analysis Bootstrapper for VS plugin 1.2, C# plugin 3.3.When I run SonarQube analysis, I see my .sln file being found, files get recognized as CS, files get indexed, Analysis Successful message gets displayed on the console. But when I see the dashboard of the project on SonarQube server, I see no metrics getting reported. Even LOC, Duplications, Complexity widgets say 'No Data'.Whereas, on the same setup, I am able to run few other C# projects successfully. I am unable to figure out, what is wrong with the config for this project.Regards, Anantha
C# project not reporting any metric on SonarQube
It seems that there isn't such a rule available. And no custom rules (based on regexp or something else) could be configured via the user interface.But you could write your own java plugin with a set of custom java rules. A simple example (by SonarSource) isavailable on github. It looks quite simple to provide your own rule. May be it worth it.
My scenario: With Java 8 Stream API, developers have the possibility to process collection via Streams normal and parallel (using multiple threads). In a Java EE environment, this should be avoided →Is it discouraged using Java 8 parallel streams inside a Java EE container?Other sources:The current consensus among Java™ EE engineers is that parallelization of bulk operations will revert to sequential processing in the EE container.http://coopsoft.com/ar/Calamity2Article.htmlWill SonarQube provide a rule, or how could I setup a custom rule for that, to detect, warn or inform developers, that they shall not used parallel streams on a java ee application server, that runs under Java 8, hence code reviews are not always possible.
How to setup a SonarQube Warning for parallel streams in a Java EE container?
Sonar is correct in that you shouldn't be usingnew String(). Initializing to empty string (String temp = "") is better. But if you do not use the value of empty string in any case, you should not initialize the variable to anything. You should only initialize a variable to a value you intend to use.This is perfectly, and usually, acceptable:String temp;Your conditional logic should cover all cases of assignment.
I have used the below statement in my code to declare an empty string.String temp = new String();This has led to an issue raised by Sonarqube. So what would be the efficient way to fix this ? Is the below declaration a good way?String temp = "";
How to address Java String instantiation issue reported by Sonarqube
This particular Sonarqube rule uses a regular expression to check the function name. By default it uses this expression:^[a-z][a-zA-Z0-9]*$The function name in your question matches this regular expression. If you want to check other things, you can alter the default regular expression yourself. (You probably have to log in as administrator to change the default setting).I think this particular rule only works for functions defined asfunction thisIsMyFunction()and not for functions defined as variables. AFAIK there is no Sonarqube rule that checks the latter. In fact there even is a Sonarqube rule that encourages developers to define functions as variable if they are defined in a code block (see the 'Function declarations should not be made within blocks' JavaScript rule)I know you canwrite and add your own Sonarqube rules, but I have no experience with that myself.
I started using Sonarqube a few days ago, but I have a question about the Javascript rule "Function names should comply with a naming convention".Some of my developers do not respect naming conventions for naming functions, most of time they define functions like this:onTextfieldChange1111111: function(field, newValue, oldValue, eOpts) { ... }And it looks like this method doesn't fire the rule "Function names should comply with a naming convention".Is it a specific configuration to make this work? Or is there another rule to check this?
Sonarqube Javascript rule "Function names should comply with a naming convention" doesn't work with functions declared in variables
As mentioned in the comment by @Simon Brandhof this is indeed a bug in the selected rule.The issue is due to the fact that primitive are not considered as serializable by the check. Tickethttps://jira.codehaus.org/browse/SONARJAVA-918will fix this issue. Thanks for reporting.
In my code I have the following line:private int[][][] shapes;In the wild it lives inside an enum:public enum TetrisGamePiece { private int id; private int pieceColour; private int[][][] shapes; // <-- This line is not accepted private TetrisGamePiece(int id, int colour, int[][] shape1, int[][] shape2, int[][] shape3, int[][] shape4) { this.id = id; this.pieceColour = colour; this.shapes = new int[][][]{shape1, shape2, shape3, shape4}; } // ... the rest of the enum ... // i've left out instantiation of objects to save space.and I get the following mention from sonarqube:Make "shapes" transient or serializable. Fields in a Serializable class must themselves be either Serializable or transient even if the class is never explicitly serialized or deserialized. That's because under load, most J2EE application frameworks flush objects to disk, and an allegedly Serializable object with non-transient, non-serializable data members could cause program crashes, and open the door to attackers.As far as I was aware, int[] (and int[][] etc) are serializable. Is this a bug in sonarqube or am I misunderstanding the serializability of arrays of basic types?edit: added the enum this lives in, just in case the enum type is relevant
Why does SonarQube consider int[][][] not serializable
This is not a perfect solution but you can try to disassociate the project (in the same UI used to update project association, there is a button to remove association).
I've install the SonarQube plugin in IntelliJ and it's working great - it's a huge help. But how do I turn the warnings off? Since my team just started using SonarQube, we have thousands of issues and every single one is showing up in my IDE and it's gettingverydistracting :'(I don't want to uninstall the plugin and reinstall every time I want to run an analysis - but I do want the warnings to go away on-demand so I can concentrate on getting some work done. I don't have time to just fix Sonar issues all day.Thanks
SonarQube/IntelliJ - How to Hide Warnings?
You can do a lot with Cyclomatic Complexity. Here are some posts on my blog but you could find much more:http://qualilogy.com/en/legacy-c-application-refactoring-reengineering-1/andhttp://qualilogy.com/en/legacy-application-refactoring-reengineering-7/Yes, per class/file it is an average of the complexity of each method/function:http://qualilogy.com/en/legacy-application-refactoring-sqale-plugin-1/
Their wiki only says the obvious (average complexity of the class), but what does it actually mean?I know for method complexity, 15-20 is usually the upper bound for a testable and maintainable code.
What exactly is the class complexity
No this is not possible.This request partially relates tohttp://jira.codehaus.org/browse/SONARIDE-112
The code below is a sample of what eclipse code format I want to use.<profiles version="11"> <profile kind="CodeFormatterProfile" name="equationStyle" version="11"> <setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/> . . . <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/> <setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/> </profile> </profiles>Is it possible to import/add this to SonarQube?
Is it possible to import/add eclipse code formatter .xml in SonarQube?
Coverage% mismatch in a single file shouldn't differ, except for rounding. As for project's %coverage, you'll need to experiment withsonar.exclusions. This is what we're using for a specific Node project:sonar.sources=. sonar.exclusions=src/**/*,test/**/*,node_modules/**/*,public/**/*,coverage/**/*,html-report/**/*,views/**/*,Gruntfile.js,*.html sonar.tests=test
My Jenkins job reads lcov file, generated by Istanbul, via Sonar Runner. The numbers/misses in lcov-report generated by Istanbul do not match with that displayed in Sonar. There is 0-7% difference with Istanbul being stricter by finding more misses.Is it expected? Why the difference?Environment:SonarQube 3.5 and 3.7.4SonarRunner 2.3Sonar JavaScript plugin 1.6Node.js code
Branch coverage% mismatch between Istanbul and Sonar
JS Test Driver was removed as part of the Sonar Javascript 1.5 release,http://jira.codehaus.org/browse/SONARPLUGINS-3408So I switched back to the 1.4 plugin.Regarding the LCOV, I had to match the paths in the LCOV with sonar.sources path. So sonar.sources=webapp/appLCOV was like SF:webapp/app/path/to/js.jsHope that helps, I can correct anything I might have gotten wrong tomorrow when I'm at work again.
I have created a simple project using Node.js, mocha and generated the report for code coverage and unit testing as follows:mocha -R lcov --ui tdd > coverage/coverage.lcov mocha -R xunit --ui tdd > coverage/TEST-all.xmlThe reports generated using the sonar runner does not reflect the coverage on Sonarqube. The sample test javascript project using LCOV that ships with the sonar-examples-master as well shows 0% code coverage in Sonarqube.The sonar properties set are as follows:sonar.language=js sonar.sourceEncoding=UTF-8 sonar.tests=test sonar.javascript.jstestdriver.reportsPath=coverage sonar.javascript.lcov.reportPath=coverage/coverage.lcov sonar.dynamicAnalysis=reuseReportsLooking forward for inputs on how to resolve this issue and enable the SonarQube to report the coverage on an existing LCOV report.Thanks,Neo
Sonarqube not detecting LCOV report generated using mocha
The C/C++ plugin is a commercial plugin, which requires a purchased licenses. I suspect the problem is that it can't find your licenses.According to theofficial instructions, you need to do this:Log in as a System administrator, go to Settings > General Settings > Licenses, paste your license key and Save (was Settings > General Settings > C/C++ (SonarSource) prior to version 1.6).
I'm trying to analyze a example project which was provided by the sonarQube examples. I have this C/C++ version 2.0 plugin installed on my SonarQube. My sonar-project.properties has these contents.sonar-project.propertiessonar.projectKey=org.codehaus.sonar:simple-c-project sonar.projectName=Simple C project analyzed with the SonarQube Runner sonar.projectVersion=1.0 sonar.sources=src sonar.language=c sonar.sourceEncoding=UTF-8When i run the sonar-runner command for this project i get an error as given belowERROR: Error during Sonar runner execution org.sonar.runner.impl.RunnerException: Unable to execute Sonar at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91) at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75) at java.security.AccessController.doPrivileged(Native Method) at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69) at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50) at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102) at org.sonar.runner.api.Runner.execute(Runner.java:90) at org.sonar.runner.Main.executeTask(Main.java:70) at org.sonar.runner.Main.execute(Main.java:59) at org.sonar.runner.Main.main(Main.java:41)Caused by: com.A.A.A.B.A: Missing or bad plugin license. Please check logs.Am i missing any plugins or is the plugin installed not proper.Thank You.
I get this Missing or bad plugin while running sonar-runner on a C project
To analyze a project, either you set the "Project properties" or the "Path to project properties" field. See alsohttp://docs.sonarqube.org/display/SONAR/Analyzing+with+SonarQube+Runner.
I am trying to setup Jenkins plugin with SonarQube.The instructions athttp://docs.codehaus.org/display/SONAR/Triggering+SonarQube+on+Jenkins+Job#TriggeringSonarQubeonJenkinsJob-TriggeringaProjectAnalysiswiththeSonarQubeRunnerseems to be exactly same for bothTriggering a Project Analysis with the SonarQube RunnerTriggering a Task with the SonarQube Runner.I am trying to trigger a project, but i am only getting the option for Task in jenkins. What am i missing?
How to Triggering a Project Analysis with the SonarQube Runner?
Adding the following lines to the settings.xml configuration file should fix this issue :<build> <pluginManagement> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>sonar-maven-plugin</artifactId> <version>2.1</version> </plugin> </plugins> </pluginManagement> </build>
Sonar 3.5.1, Jekins Sonar Plugin 2.1. Plugin is installed in Jenkins. I have added the Post Build Action with Sonar and default settings. I got this error at building-time.I am not sure what to do. Do I have to modify the pom.xml?[ERROR] No plugin found for prefix 'sonar' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/export/home/tpbuild/.m2/repository), central (http://repo.maven.apache.org /maven2)] -> [Help 1] org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException: No plugin found for prefix 'sonar' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/export/home/tpbuild /.m2/repository), central (http://repo.maven.apache.org/maven2)]
Setting up a SONAR Post Build Action in Jenkins (Maven Job)
No, there's currently no better solution for this case. This issue has been identified and we'll take a look at it during the next spring - but I'm not sure that it can be solved easily though.You can and watch and vote here:http://jira.codehaus.org/browse/SONARDOTNT-291
I have been trying to getSonarcode analysis work on a c# project. Since it's a web project I'd also like to run analysis on JavaScript.However, as mentioned in the following link, you cannot run multi-module projects on a .NET solution (http://sonar.15.x6.nabble.com/Multi-language-javascript-amp-c-td5011530.html). The suggested workaround is to trigger two analysis profiles separately and then combine them with the views plugin (http://www.sonarsource.com/products/plugins/governance/portfolio-management/)But this plugin costs about 1800$. Because Sonar has the possibility to analyse multiple projects in .NET through the solution file, it therefore disables multiple modules for .NET solutions (to prevent a specific error).I find it really annoying that by doing this, it forces me to use a paid module (and not a cheap one) to create a sub-optimal workaround.Are there any other better solutions for this?
Sonar runner on a project containing c# and javascript
I have an idea that might help you: Sonar has a clean RESTful interface that can be seen in action via Firebug for example. When you change this project setting (Configuration > General Settings > Code Coverage), peek the HTTP communication and learn how to configure this property via HTTP. It is hopefully not like rocket science. Then you can dynamically set this as you want from your ant script by for example writing a few line long Groovy script into a<script lang="groovy">tag or as you want.
I am using Sonar 3.2 with Ant. I have read that it should be possible to use Cobertura for unit test analysis and JaCoCo for integration test analysis. I have however not found a clear guide on how to do this with Ant. I have set the code coverage engine to be Cobertura like this:<property name="sonar.core.codeCoveragePlugin" value="cobertura" />Can I "reset" it to JaCoCo after Cobertura analysis has been done? Then it would be like this:<property name="sonar.core.codeCoveragePlugin" value="cobertura" /> <property name="sonar.cobertura.reportPath" value=... <property name="sonar.core.codeCoveragePlugin" value="jacoco" /> <property name="sonar.jacoco.itReportPath" value=...Thanks
How to use Cobertura for unit tests and JaCoCo for integration tests simultaneously?
You have to associate every project in Eclipse with the corresponding module in Sonar. For instance, in your example, the "module1" Eclipse project should be associated to the "con.example.project:module1" Sonar project.
I have a maven project of the form<project> <groupId>com.example.project</groupid> <artifactId>project</artifactId> <module>module1</module> <module>module2</module> <module>module3</module> </project>I am able to run Sonar analysis using maven. The project key is com.example.project:project I have also installed the Sonar plugin for Eclipse and would like to analyze my project using Eclipse.My issue is that the Package Explorer in Eclipse shows the modules as projects. This means that when I click on a particular project/module and perform "Configure" -> Associate with Sonar, I do not get the option to pick the top level project (here labelled "project") and only the modules.When I try to input the groupId and artifactId, then those do not match with the sonar project key (com.example.project:project). I think what would work is if I can try to associate the top level project (groupdId: "com.example.project" , artifactid: "project") as opposed to the modules.Is there a way of doing that?I am using Sonar 3.1 and Eclipse Indigo.
sonar-eclipse plugin analysis for multi-module project
It seems that your only option is the cargo plugin.As described in the link to the duplicated question Jetty is executed in the same JVM as Maven.So if JVM options are not possible you have to use the cargo plugin.
I come back here because I have some kind of problem. (I posted 2 or 3 questions before about a project I'm working on, this question is still related to this project)So I have a smartGWT webapplication which I build using Maven. To unit test it, I had to use Selenium RC (to be able to use the user-extensions.js provided by smartClient), and as it must be compatible with the continuous integration, I had to deploy the webapp on a Jetty container. Now I only got one problem left :How can I use Jacoco with Jetty to make Sonar recognize my tests and give me code coverage ?Is there a property in the jetty-maven-plugin that allows me to run the jacoco-agent each time the application is deployed ?Thanks in advance, one more time =)(Sorry for my bad english)
Jacoco w/ Jetty + Selenium RC
To get this from the unanswered questions page: SeeHow to install an older version of PHPUnit through PEAR?for an exact answer to your problem.
I am trying to setupPHP Plugin for Sonar, and this plugin needs specific packages in specific version.So, When I am trying to install PHPUnit 3.5.5 using following command, it is installing newer version. What I do wrong?[VMWARE] root@localhost ~ # pear install phpunit/PHPUnit-3.5.5 Did not download optional dependencies: phpunit/PHP_Invoker, use --alldeps to download automatically phpunit/PHPUnit can optionally use PHP extension "dbus" phpunit/PHPUnit can optionally use PHP extension "soap" phpunit/DbUnit requires package "phpunit/PHPUnit" (version >= 3.6.0), downloaded version is 3.5.5 phpunit/PHPUnit requires package "phpunit/DbUnit" (version >= 1.0.0) phpunit/PHPUnit can optionally use package "phpunit/PHP_Invoker" (version >= 1.1.0) downloading PHPUnit_Selenium-1.2.1.tgz ... Starting to download PHPUnit_Selenium-1.2.1.tgz (23,083 bytes) .......done: 23,083 bytes downloading PHPUnit-3.6.10.tgz ... Starting to download PHPUnit-3.6.10.tgz (118,595 bytes) ...done: 118,595 bytes install ok: channel://pear.phpunit.de/PHPUnit-3.6.10 install ok: channel://pear.phpunit.de/PHPUnit_Selenium-1.2.1 [VMWARE] root@localhost ~
installing phpunit/PHPUnit-3.5.5 via pear (for sonar)
Use jacoco and sonar and have a single jacoco.exec file result for all modules. Sonar will use this file and report the correct coverage for each module. I have use it for a multi module project successfully with Sonar
Imagine a multi-modules Maven project, such as the following one:parent +- core +- mainmainis dependent on thecoremodule.I now write a classCoreClassincore, with 2 methods:method1()andmethod2(). Incoretests, I write a test class that will only testCoreClass.method1().If I run a coverage tool (in my case Cobertura, usingmvn sonar:sonar), I will find that I get50%of test coverage onCoreClass(if we imagine that both methods have the same length).Until now, everything is ok.Now, inmainproject, I write a test class that will test theCoreClass.method2(). Sonormally, I would expect to have100%of line coverage onCoreClasswhen I run an analysis on the whole project.However, I still get my50%.I understand that this is a comprehensive behavior. Indeed, Cobertura will instrumentCoreClassfor coverage analysisonly during the tests execution on thecoremodule, and not on themain. That explains why I still have50%of code coverage.However, my question is to know if there is a way to get therealcode coverage ofCoreClasswhen I am running the tests on all of my modules.Thanks!ps:I know that in a perfect world, it is not the concern of themainmodule to test thecoreclasses. But as you may know, we are not in a perfect world :o)Technical information:Java 1.6, JUnit 4.8.1, Maven 2.0.9 (will be upgraded to 2.2.1 soon, but I don't think it does really matter), Sonar 2.8
How to get the full code coverage on a Maven multi-modules project
Can you reset the accounts as per theSonar FAQ?
I have a Sonar install running on a windows server using MySql 5.1I left my admin password at its default ofadminand created a second users password all of which worked. After a break of a few months of not really using Sonar I tried to log in and it constantly fails to authenticate on both accounts.These are the steps I have taken to resolve it:Update to the latest Sonar 2.8 which successfully updated the databaseSet the password with sql I got from the Sonar docs.update users set crypted_password = '88c991e39bb88b94178123a849606905ebf440f5', salt='6522f3c5007ae910ad690bb1bdbf264a34884c6d' where login = 'admin'Stopped the MySQLserver to make sure its connecting to the database I'm expecting it too. (It was)Set the log level to DEBUG to see if there is anything in the logs but there was nothing.I know I could drop the database and start from scratch but ideally I would like to keep the 12 months of build history I have.Any suggestion?
Sonar default authentication failing
Unfortunately, theJacoco Sensorcannot be disabled from the scanner in the current SonarQube version (v.10.x - Jul 2023).To clarify, Jacoco it's not a plugin, it comes pre-installed by default as asensor, and cannot be uninstalled.As a workaround, you can ignore the scans, or create patterns for coverage exclusions**/**for example.
We have SonarQube analysis running for our .NET projects with Visual Studio Test Coverage enabled. Is there any way to prevent specific sensors from running during analysis?For example, Jacoco runs even though there is no Java code to analyse, and we already have VS code coverage enable so we don't need other coverage sensors to run for this project.I've had a look through the Quality Profiles and Gates but I couldn't find anything related to sensors. Excluding thesonar.coverage.jacoco.xmlReportPathssetting also has no effect since it just reverts to its built-in defaults.
How do I disable specific sensors for a SonarQube project?
I was looking for similar issue. the wait for sonar quality gate in order to break the Jenkins buildI achieved this by adding-Dsonar.qualitygate.wait=true -Dsonar.qualitygate.timeout=300to the command launching the sonar scannersonar-scanner -Dsonar.qualitygate.wait=true -Dsonar.qualitygate.timeout=300 -Dsonar.sourceEncoding='UTF-8' -Dsonar.projectKey=${projectKeyAndName} -Dsonar.projectName=${projectKeyAndName} -Dsonar.branchname=${env.BRANCH_NAME}
I am trying to run my sonar scanner from jenkins and I want my jenkins job to fail when the Quality gate at sonar is not met. I have configured sonar host and sonar scanner with jenkins at global tool level, my project analysis is uploaded in sonar, but the jenkins job is still passing. what am i doing wrong. so, basically I am trying to achieve thishttps://blog.sonarsource.com/breaking-the-sonarqube-analysis-with-jenkins-pipelines/, I can do it via pipelines, but I want to achieve the same thing via a jenkins job. Here is my job just clone a project and run sonar scanner. this is the build stepgit clone 'https://github.com/SonarSource/sonar-scanning-examples.git # clone cd $WORKSPACE # goto cloned workspaceHere are the properties passed to sonarscannerAnalysis properties: sonar.projectKey=org.sonarqube:sonarqube-scanner sonar.java.binaries=. sonar.qualitygate.wait=trueI believesonar.qualitygate.wait=truethis is the extra step that I need to do at sonar scanner step. I want my jenkins job to fail, as soon as Quality gate fails.
How to fail jenkins job if the sonar project does not pass Quality gate stage
After many trial and error, finally got the no.of unit tests in sonar report.Added sonar-scanner using the below command,npm install sonar-scanner --save-devThen in package.json file add the following lines in scripts,"scripts": { "sonar": "sonar-scanner", "sonar-scanner": "node_modules/sonar-scanner/bin/sonar-scanner.bat" }In sonar-project.properties file, add the below linesonar.testExecutionReportPaths=test-report.xmlFinally run sonar usingStartSonar.batand runnpm run sonarAnd when we run https:localhost:9000/projects, we can find no.of unit tests under coverage part.Reference links:https://medium.com/@learning.bikash/angular-code-coverage-with-sonarqube-d2283442080bhttps://medium.com/beingcoders/setup-sonarqube-with-angular-project-in-6-minutes-57a87b3ca8c4
I have run sonar for Angular-Jest project and got the unit test coverage but am not getting number of unit tests.My Sonar properties,(sonarqube version - 7.7)sonar.host.url=http://localhost:9000 sonar.login=admin sonar.password=admin sonar.projectKey=my-app sonar.projectName=my-app sonar.projectVersion=1.0 sonar.sourceEncoding=UTF-8 sonar.sources=src sonar.exclusions=**/node_modules/** sonar.tests=src sonar.test.inclusions=**/*.spec.ts sonar.typescript.lcov.reportPaths=coverage/my-app/lcov.info sonar.scm.disabled=true sonar.path.temp=C:\Sonar\sonarqube-7.7\tempIs there any way to bring number of unit tests under coverage heading?Thanks in advance!
Is there a way to bring number of unit tests under coverage in Sonarqube report for Angular-Jest project?
Did you check github branch rules?Settings -> Branches -> Edit Related Rule(eg. master)Require status checks to pass before mergingVerifySonarQube Code Analysisis checked
Try to prevent the merge of pull requests with a failed Quality Gate by adding a "SonarQube/quality gate" In PR request i can seein branch policy addedI can see the result in extenstion
SonarQube waiting satuts check
As mentioned in some of the comments map() has a return value, which you are not using.Notice all of the examples here:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/mapAre of the formconst a = someArray.map(function)Not justsomeArray.map(function).That's because a will have a value, as the map() function returns it.
i get this message error : Consider using "forEach" instead of "map" as its return value is not being used here. declare const require: { context(path: string, deep?: boolean, filter?: RegExp): { keys(): string[]; (id: string): T; }; };context.keys().map(context);
angular 10 :Consider using "forEach" instead of "map" as its return value is not being used here
Turning my earlier comment into an answer in order to "resolve" this Q.We have been using option 3 at work and are very pleased with the results. I see three main advantages of this approach:It greatly simplifies the actual scanning task (in the additional job).It lowers the requirements towards the environment the analysis runs in. All required artifacts are produced by dedicated build jobs.It reduces the execution time as - again - artifacts required by SQ already exist.
I was wondering how to aggregate the SonarQube Maven analysis for multiple jobs in GitLab CI pipelines.My GitLab CI pipeline builds backend and frontend components in separate jobs (in the same stage). They require different build environments and, hence, they use different images. Skeleton:build-backend: image: my-backend-image stage: build script: - mvn xyz verify build-frontend: image: my-frontend-image stage: build script: - build-frontendIf I add Sonar scanning to both jobs they would overwrite each others results on SonarQube. Hence, AFAIU I need eitherA way to "aggregate" results from each job i.e. somehow tell Sonar that the backend scan and the frontend scan belong together. I don't see options for that.Build a super image that can build both backend and frontend and somehow mingle both builds into the same job. This would have a significant impact on the pipeline as I would loose parallelization.Declareallbuild results in both jobs as GitLab artifacts (we currently do this selectively). This would include Java classes, coverage reports, test reports, etc. . Then introduce an additional job in a later stage that only gets those artifacts and does e.g.mvn sonar:sonar.Is there are simpler solution I missed?
Aggregate SonarQube Maven analysis for multiple jobs in GitLab CI pipeline
The changes have not been applied on system. Run thesudo sysctl -pcommand to apply them and check the value againsudo sysctl vm.max_map_count.
I get this error when starting sonarqube.I have tried:sudo sysctl -w vm.max_map_count=262144Which returns:sysctl: setting key "vm.max_map_count"And then:sudo sysctl vm.max_map_countIt still saysvm.max_map_count = 65530Does anyone know why Ubuntu 18.04 doesn't update vm.max_map_count?Image with response from server commandsThanks in advace,Xander
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
You can build a self-hosted agent to run the pipeline. So that the plugins can be cached on the local agent machine. Refer to the detailed stepshereto create self-hosted agent.You can also manually download the plugin jars with its dependencies, and include them in the code repo. Then you can install them manually in your pipeline using a script task to run below commands: Seehere.mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>For example:mvn install:install-file -Dfile=/plugins/sonar-maven-plugin-3.6.0.1398.jar -DgroupId=org.sonarsource.scanner.maven -DartifactId=sonar-maven-plugin -Dversion=3.6.0.1398 -Dpackaging=jar` mvn install:install-file -Dfile=/plugins/sonar-scanner-api-2.12.0.1661.jar -DgroupId=org.sonarsource.scanner.api -DartifactId=sonar-scanner-api -Dversion=2.12.0.1661 -Dpackaging=jarYou can also try usingmaven-install-pluginin pom file to install the local jars. Seethis threadfor more information.
Maven Sonar scanner is taking a long time to download the plugins ( [INFO] Load/download plugins (done) | time=495872ms) approx. 9 mins every time a build is triggered. Also, the cache is not working as the builds are triggered on the cloud (Azure DevOps)) with an agentless/serverless architecture. What could be solutions to reduce this time that is built faster?[INFO] User cache: /home/vsts/.sonar/cache [INFO] SonarQube version: 7.9.1 [INFO] Default locale: "en", source code encoding: "UTF-8" [INFO] Load global settings [INFO] Load global settings (done) | time=1097ms [INFO] Server id: #####-$$xxxxx$$$ [INFO] User cache: /home/vsts/.sonar/cache [INFO] Load/download plugins [INFO] Load plugins index [INFO] Load plugins index (done) | time=211ms [INFO] Load/download plugins (done) | time=495872ms [INFO] Loaded core extensions: developer-scanner
SonarQube Scanner - Long pause between plugin downloads
Well, I don't think Sonarqube supports that. The only thing that I see you could do, is to run the memory profiler as you are doing, but instead of uploading to sonarqube as per your approach, you could create a html report from the memory profiler results and attach it to your Jenkins build.
I am evaluating python memory profiling. I would like to automate memory leak profiling with Jenkins and publish the report to Sonarqube. The current memory tool I am using is memory_profiler. Does Jenkins & Sonarqube support this integration? Or are there any python memory tools which I should consider which can integrate well into Jenkins & Sonarqube? Thanks
Python memory profiler with Sonarqube & Jenkins
Unfortunately, sonar do not provide many rules about getter/setter :You can configure which files will be reviewed by sonarqube. This could be an exclusion by package or by class name. For instance, you can excludecom.company.business.plip.dtoby adding this to yoursonar-project.properties:sonar.exclusions=src/main/java/com/company/business/plip/dto/**Considering your dto are just empty shells, containing only privated fields and getters/setters ; this wouldn't cause a huge impact to your code coverage.
How can I configure my sonarqube analysis to ignore my getters and setters and not count them as duplicated line. Because I have them both on my entites and on my DTO class. So the duplications % is up to 15%.Thanks in advance.
Sonarqube getter and setter duplications
These warnings are gone after using@CompileStatic.
I have anExceptionclass: (in groovy)class TestException extends RuntimeException { TestException(String msg) { super(msg) } }But sonar is showingArray index is out of boundsonsupercallI didn't get why I am getting this Bug message here. Does anyone have any idea/clue why this bug being shown?
"Array index is out of bounds" on Exceptions's super call in Groovy
For me downgrading Sonarqube to 7.6 resolved this issue.
I have trouble integrating sonar qube for my bit bucket cloud, it would be great if anyone could help me out with this.
Sonar for Bitbucket failed, The 'component' parameter is missing
Jacoco checks coverage of compiled code, not raw Scala code. I believe that in your compiled code there is a private constructor of the class which is not cover by any test and that cause the coverage deficit. You have to investigate the compiled code to verify. However, there is a way to eliminate this problem: adding a trail.trail XConverter object XConverter { def doSomething() = {} }Run the jacoco coverage again you will see that the deficit coverage disappear. This is equivalent to having static methods in an interface in Java, no hidden constructor.
I am using Jacoco-Maven Plugin for Scala Test Coverage, But when I run the tests I see in Index.html in Jacoco the Singleton Objects are getting Covered twice where one gives the Correct Coverage and the other gives a wrong Coverage Number.Image:
Jacoco Plugin for Scala Singleton Objects is covering the same Classes twice and creating a Coverage Deficit
I have faced same issue with you a few months ago. My jacoco version is 0.8.2 and lombok is v1.16.16. I remember the problem was gone after I add lombok.config under root directory of the project. Just notice if you define your own constructors for a class that already marked as Data, then the coverage will be calculated by how many constructors your tests were called.And if this didn't help. You can find a workaround by excluding them in either Jacoco config / SonarQube configExample for excluding in jacoco:<plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.8.2</version> <configuration> <excludes> <exclude>**/your_class_path/**</exclude> </excludes> </configuration> <executions> <execution> <goals> <goal>prepare-agent</goal> </goals> </execution> <!-- attached to Maven test phase --> <execution> <id>report</id> <phase>test</phase> <goals> <goal>report</goal> </goals> </execution> </executions> </plugin>And for SonarQube, you can use -Dsonar.inclusions parameter for inclusion and -Dsonar.exclusions parameter when calling mvn sonar:sonar
I've got a bunch of Code Smells in my Java project around bits of code like this:@Data public class Foobar extends Foo { private String baz; }Mylombok.configsits alongside thepom.xmland looks like:config.stopBubbling = true lombok.addLombokGeneratedAnnotation = trueThis brought up the code coverage numbers, not has not cleared the Code Smells.Seems I'm not theonlyperson encountering this problem.In terms of versions:Lombok 1.18.8 (also tried with 1.18.10)Jacoco 0.8.4SonarQube 7.9.1.27448SonarQube Scanner 4.0.0.1744I've seen a few similar questions on this, but they are all ~5 years old, so I dont believe the answers are still valid.
Sonarqube - Remove this unused private field Code Smell using Lombok @data
I created a powershell to use with Azure DevOps, that possible may be migrated to some shell script that runs in the code build activityhttps://github.com/michaelcostabr/SonarQubeBuildBreaker
I've seen many discussions on-line about Sonar web-hooks to send scan results to Jenkins, but as a CodePipeline acolyte, I could use some basic help with the steps to supply Sonar scan results (e.g., quality-gate pass/fail status) to the pipeline.Is the Sonar web-hook the right way to go, or is it possible to use Sonar's API to fetch the status of a scan for a given code-project? Our code is in BitBucket. I'm working with the AWS admin who will create the CodePipeline that fires when code is attempted to be pushed into the repo.sonar-scannerwill be run, and then we'd like the pipeline to stop if the quality does not pass the Quality Gate.If I would use a Sonar web-hook, I imagine the value forhostwould be, what, the AWS instance running the CodeBuild?Any pointers, references, examples welcome.
How to get SonarQube results back to CodeBuild
place the value between quotation marks. sonar.projectName="Temperature Converter"
I want to run sonarqube scanning on xcode project using run-sonar-swift.sh script. My xcode project name isTemperature Converter. But when I provide this name it takes onlyConverterand not full name insonar.swift.projectfield. How to provide project name having spaces to sonar-project.properties.
How to pass xcode project name with spaces in sonar-project.properties file
Try to add below line also.-Dsonar.gitlab.unique_issue_per_inline=trueit should look like.sonar-scanner -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_TOKEN -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME -Dsonar.gitlab.project_id=$CI_PROJECT_ID -Dsonar.gitlab.unique_issue_per_inline=true
I'm [email protected] and[email protected],My gitlab-ci.yml is:sonar-scanner \ -Dsonar.projectKey=$SONAR_KEY \ -Dsonar.sources=. \ -Dsonar.host.url=$SONAR_URL \ -Dsonar.login=$SONAR_LOGIN -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA \ -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME \ -Dsonar.gitlab.project_id=$CI_PROJECT_IDCommit in non-master branchIf this commit not on theMasterbranch, when quality gate is failed, SonarQube always generates global comment like below:But always says "reported no issues" and `no inline comment`,Commit in Master branchHowever, commit inMasterbranch (with same changes), it generates global comment with issues and inline comments :I expect it generates global comment with issues and inline comment on all branch.Any help would be appreciated!
SonarQube gitlab-plugin shows inline comment only in Master branch
You need not setSONAR_TOKEN. If you are getting authorization error, because of a bad encrypted token.The problem is with the travis encryption.Correct encryption syntax:travis encrypt 309473973909Z09R830 -r my-org/my-repoNo variable name, no quote.If you are running travis encrypt inside your repo directory you can just usetravis encrypt 309473973909Z09R830Kindly replace you token for309473973909Z09R830This token can be used in place ofsecretas specified in the official travisdocumentation.
I am trying to use SonarCloud with Travis-CI and getting the following error:* What went wrong:Execution failed for task ':sonarqube'.You're only authorized to execute a local (preview) SonarQube analysis without pushing the results to the SonarQube server. Please contact your SonarQube administrator.Hereis the project on Github that I am trying to setup CI using Travis.Hereis the link for the Travis build that is failing executing the SonarQube step.Hereis the Travis config fileHereis the link for the Sonarcloud project.On Travis I added the added the Env variable SONAR_TOKEN to 9d2401997a7368e6f351d50d7d99bbf1fae84624 and I see that it is picked up fine on the Travis Job Log.I am very new to both Travis and Sonarqube, so any help is greatly appreciated.Thanks, Shashi
Authorization error when using Sonarcloud on Travis CI
Came across the same question. When I added a webhook via the UI on project level, I get this config generated in scanner context:- sonar.webhooks.project=1 - sonar.webhooks.project.1.name=Jenkins - sonar.webhooks.project.1.url=https://myJenkins/sonarqube-webhook/This works, however if I add the same config via the command line, it doesn't.On the cli it works if I use this:- sonar.webhooks.project=https://myJenkins/sonarqube-webhook/webhook/In the Jenkinsfile you can useenv.JENKINS_URLto get the Jenkins URL.
I'm looking for a way to programmatically configure the sonarqube webhook at a project level. The api/webhooks appears to be only for delivery. The project configuration webhooks page lists sonar.webhooks.project as a key but I've been unsuccessful getting this to work and there is no mention of it on the documentation page.Any help appreciated
Programmatically configuring sonarqube webhook
You can unset the JAVA_TOOL_OPTIONS variable and it will work example:unset JAVA_TOOL_OPTIONS && /sonar-scanner/bin/sonar-scanner XXX
Getting error "Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8" while publishing code metrics on SonarQube from VSTS Build machine through build definition.find below sonar-project.properties file,sonar.projectBaseDir=$(Build.SourcesDirectory)/app sonar.verbose=true sonar.analysis.mode=publish sonar.sourceEncoding=UTF-8 sonar.sources=$(Build.SourcesDirectory)/app sonar.language=ts sonar.ts.tslint.projectPath=tsconfig.json sonar.ts.tslint.path=node_modules/tslint/bin/tslint sonar.ts.tslint.typeCheck=true sonar.exclusions=node_modules/** sonar.ts.coverage.lcovReportPath=$(Build.SourcesDirectory)/app/coverage/lcov.infoError is:Don't know what is wrong here?
Getting error "Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8" while publishing code metrics on SonarQube from VSTS Build machine
You can always create a sonar configuration file in your project's root directory'sonar-project.properties' and add the file to your duplications exclusion list like:sonar.cpd.exclusions=src/main/java/com/%FileToBeExcluded%.javaFor more info:https://docs.sonarqube.org/latest/analysis/scan/sonarscanner/
I have a directory that contains both generated and non-generated files. Neither of the generated or non-generated files have a filename identifier (such as *Generated.java). I need sonar to calculate duplication in the non-generated files but not in the generated files. For practical business reasons, I cannot restructure or rename these files.I have looked throughNarrowing the Focusmultiple times and cannot find a way to do what I am looking for.I have also tried usingIgnore Issuesbut this does not ignore duplication, only sonar "Issues".Ideally, I would like to provide my code generator with a way to let sonar know that the file should be ignoredfor duplications only. That is, the file should still be included in the analysis for any issues but will not add to the code duplication total. (This would provide a maintainable solution for me rather than having to manually exclude all non-generated files in the present and future)Is there a solution that I am overlooking? There doesn't seem to be any built-in functionality in Sonar for this. If not, is there a work-around?Please let me know if there is any more needed information.Thank you.
SonarQube Scanner - Disable Duplication Calculation in Specific File
Assign a valid certificate to your website. Using localhost is not the best choice; you should use and configure a valid domain name (https:/mycompany.com for example). On the machine you use to analyse you must update the Java Runtime by registering the certificate associated with this name and maybe also other (root) certificates in the certificate chain. Seethisblog for all the details. After executing these steps you should be able to upload the analysis to you SonarQube instance.
We have a SonarQube server which is by default running on HTTP and 9000 port. We decided to use SonarQube over HTTPS configured using IIS reverse proxy and disable HTTP.Previously in sonar-scanner.properties,sonar.host.url is configured to run as mentioned below.sonar.host.url=http://localhost:9000and now we want to change it to sonar.host.url=https://localhost.On the browserhttps://localhostworks fine. However when I configure this url in sonar-scanner.properties and try to run the sonar analysis, it says url can not be reached. Could anyone give me some suggestions to fix this issue.Regards, Sharieff.
How to run sonar analysis when Sonar server is configured over HTTPS
It seems your test file is not treated as a test file, but as a source file. I say this based on the kind of errors that are reported (remove unused variable) and the kind of errors that arenotreported (no assertions). As you might know, different rules are applied to sources and tests.SonarLint decides whether a file is a test file or not based on theTest file regular expressionspreference, which you can find inWindow / Preferences / SonarLint. The default value is**/*Test.*,**/test/**/*, this seems to work well in a wide range of cases, and looking at your screenshot, it should work for yours too. So first of all verify this setting. If the value is different from the default, I suggest to change it back to the default as a sanity check. Then you can tweak the value according to your needs.It's also good to verify that my theory is correct about SonarLint treating the file as test instead of source, by inspecting theSonarLint Console:In theConsoleview, click on theOpen Consoledropdown, selectSonarLint ConsoleIn theConfigure logsdropdown enableVerbose outputTrigger an analysis of the test file (make a change and save the file)You should see output like this:[ baseDir: ... workDir: ... extraProperties: ... inputFiles: [ /path/to/your/test/SonarProofTest.java [test] ] ]The[test]at the end of the filename indicates the file is treated as a test file. If it's not there, then the file is treated as a source file.
I have read all of the threads about SonarLint not being in synch with SonarQube, but it's just not clicking.I created a simple Maven project to test SonarLint & SonarQube. I added the sonar-maven-plugin to the project and then ran mvn sonar:sonar.The project was uploaded to SonarQube. When I looked in SonarQube, I see that it shows squid:S2699 (junit test doesn't have an assertion) as a blocker.However, in eclipse, there is no such issue shown by SonarLint.I purposely chose this one as it's not a PMD/FindBugs/Checkstyle issue.I have verified that squid:S2699 is active on the server. Obviously it is, because SonarQube displayed it.There is only 1 Quality Profile: SonarWay.Edit: I am in connected mode.Does anyone have any idea why?I am using:Eclipse Neon.3 Release (4.6.3)sonar-maven-plugin 3.0.2maven 3.3.9 (the one embedded in eclipse)SonarLint 3.2.0.201706271328SonarQube 6.3 (build 19869)Here are the screenshots as proof.
SonarLint synchronization with SonarQube
What you're asking for is not possible. You'll have to query the api/measures/component many times to get all measures from all projects.
I'd like to retrieve multiple metrics for ALL projects in SQ in one GET request. Is this possible?It seems like GET api/measures/component can give me the XML I want, but only if given a specific componentKey (project name). The only other alternative seems to be to go one by one through each component, which wouldn't be ideal given that I have over 500 projects I would like get metrics for.
SonarQube API - multiple metrics for all components/projects
When analysing a Pull Request, the quality profile that will be used is always the same as the one configured for the project in the web application (or the default one if none has been explicitly set in the UI).So if you get this message and you think that you customized the quality profile for your project, chances are that this is not exactly the same project you're looking at. One of the reasons might be that you don't have the exact same project key (for whatever reason).
Does anyone know if the pluginhttps://docs.sonarqube.org/display/PLUG/GitHub+Pluginworks correctly if using a custom Quality profile for a project? Apparently it looks like even though I have setup from the Sonar server a different Quality Profile for my project, the default one is still being used, as seen from the logs:[org.sonarqube.gradle.SonarQubeTask] Quality profile for java: Sonar wayWith sonar.profile option being deprecated, how does the GitHub plugin works in this case when we have custom Quality Profile setup for a project?
Can a sonar quality profile be set when analysing a Github Pull Request with SonarQube Github Plugin?
You can get the The SQALE Rating using Web Service API SonarqubeGET URLSONARQUBE/api/resources?metrics=sqale_rating
I was looking at the web service API V5.5 documentation for SonarQube and would like to retrieve two things at the project level:SQALE ratingTechnical DebtWhich API can I exactly use to get these values directly?
How to retrieve SQALE rating and Technical debt information?
It sounds like you started up your new instance without the code analyzers.Unfortunately, installing the analyzers now won't restore your profile customizations. You allude to having backup profile files, so you may be able to get them back that way, but you should be aware that you'lllose some rule customizations.Assuming you backed up your database before the upgradelike the docs tell you to, your best bet is to restore your DB backup to the pre-upgrade state, install the missing code analyzers,thenrun the database upgrade.
I saw many posts with this question, but I didn't find the answer so I ask. I upgraded Sonarqube from 4.5 to 5.6 and it works fine, but the quality profiles are empty. I tried to restore one with the backup/restore option but the rules are ignored:image. Can you help me?
Rules ignored when restore quality profile in SonarQube
I will make more test tomorrow but for now I can't reproduce the issue. Here is the test code I am using (based on your partial example). Could you tell me if this code is raising the issue? If not, could you provide a full repro case?public class MyClass : MyBaseClass { private readonly string _a; public MyClass(string a) { _a = a; } public override string ToMyString() { var test = new MyNewClass(_a); return test.MyValue(); } } class MyNewClass { private readonly string _a; public MyNewClass(string _a) { this._a = _a; } public string MyValue() { return _a; } }
I think I have found a false positive while using a private readonly variable. In the following example I get a warning:Remove the "_a" field and declare it as a local variable in the relevant method.S1450public class MyClass : MyBaseClass { private readonly string _a; public MyClass(string a) { _a = a; } public override string ToMyString(){ var test = new MyNewClass(_a); return test.MyValue(); } }(ToMyString is acually alot more complex then my above example)Am I doing something wrong here or is this false positive?I am using C# .Net Core on VS 2017 RC3 with SonarAnalyzer.CSharp 1.22.0-RC1
SonarQube false positive S1450 for VS 2017 RC C#
We could make Sonarqube and Xamarin work with the following lines. Replace{token}with your project's token.cd MyProject.sln mono /Users/jenkins/Documents/sonar-scanner-msbuild-4.4.2.1543-net46/SonarScanner.MSBuild.exe begin /k:"myProject" /d:sonar.host.url="http://localhost:9000" /d:sonar.login="{token}" msbuild /t:Rebuild mono /Users/jenkins/Documents/sonar-scanner-msbuild-4.4.2.1543-net46/SonarScanner.MSBuild.exe end /d:sonar.login="{token}"
I've an OSX build server which I would like to analyse my Xamarin project.The build server has Jenkins and Xamarin Studio installed.I'm running SonarQube in a Docker container.Can somebody help me with this, because the analysis does not detect .cs files. (And I have the C# plugin installed on SonarQube)
SonarQube Xamarin analysis on OSX
For each custom analyzer you want to use in SonarQube (example: Wintellect), you need to use the Roslyn SDK for SonarQube tool to create plug-ins that can be imported into SonarQube. Directions and info can be foundhere.
I have a SonarQube 5.3.1 in place with the C# Plugin 4.5.0 installed. Basic included rules are detected as expected.Now, I want to use the Roslyn SDK project (https://github.com/SonarSource-VisualStudio/sonarqube-roslyn-sdk) to add my tailor made analyzers into account.I'm pretty sure they are okay because they are raised in both Visual Studio and when using msbuild in command line.My problem now is to be able to upload those issues into Sonar, I must be missing something.I obviously use the SonarQube Scanner for MSBuild v2.0, have installed my generated jar and have activated the rules (the appear in "Code Smell"), try to build a project with which my rules should break (and they do, as I said earlier), but it does not seem to pick up my rules.The doc (https://blogs.msdn.microsoft.com/visualstudioalm/2016/02/18/sonarqube-scanner-for-msbuild-v2-0-released-support-for-third-party-roslyn-analyzers/) says it should "produce an error report containing analysis errors and warnings for all of the analyzers" and then upload it to SonarQube, but I cannot find this report. At the very least, just a SonarLint output file with no related rule whatsoever.I've also tried with the Wintellect Analyzer as the github page suggests (https://github.com/SonarSource-VisualStudio/sonarqube-roslyn-sdk) with no success.My guess is there's something wrong somewhere in the configuration but I don't know where, any idea ?
SonarQube with custom Roslyn-based rules
There is an example on their page now.https://docs.sonarqube.org/display/DEV/Adding+Hooksimport org.sonar.api.ce.posttask.PostProjectAnalysisTask; import org.sonar.api.server.Server; public class MyHook implements PostProjectAnalysisTask { private final Server server; public MyHook(Server server) { this.server = server; } @Override public void finished(ProjectAnalysis analysis) { QualityGate gate = analysis.getQualityGate(); if (gate.getStatus()== QualityGate.Status.ERROR) { String baseUrl = server.getURL(); // TODO send notification } }
I have been searching for any PostProjectAnalysisTask working code example, with no look.Thispage states thatHipChat pluginuses this hook, but it seems to me that it still uses the legacy PostJob extension point ...
Sonarqube PostProjectAnalysisTask example?
I assume this issue is related to your filter settings.So, what are the possible reasons of so many issues being ignored?First, sonar report contains all issues of the project.If you have your flag "Report new issues only", then all the issues that are already exist in sonar database will be omitted.Next, flag "Add comments to changed lines only" allows plugin to ignore all issues that belongs to lines of code not changed in current commit. (For example, if sonar database refreshes once a day, all issues created in all commits during that day will be new, but only author of each of them supposed to care - so they are only visible to the author.Finally, by default only issues with Major (and higher) severity will mark build as failed.You may change filter settings. See projectWikifor details on how to do that.This behaviour could also be related to theissue JENKINS-43047with nested modules. If your project has several nested levels, the path of module component in the exported sonar-report.json is not the full path but the path component of the module. The plugin hasn't process it correctly before the version 1.0.8.Another issue isJENKINS-43730, if you have 0 project configurations added. Add default configuration so your sonar report could be found by plugin
I use Gerrit-Sonar plugin in my Jenkins jobs.When I run the job, I get an exact result in the logs, that "n issues were found" and the report was sent to Gerrit. However, when I watch the review in Gerrit, it says that "No issues were found" and review gets a +1 score.What could be the cause of this behaviour?
Sonar-Gerrit Jenkins plugin ambiguous results
There's no way to do this for the moment in SonarQube, but I've created a ticket to handle this :https://jira.sonarsource.com/browse/SONAR-7907
I am attempting to connect a new SonarQube (5.6 LTS) instance to my client's Jazz repository (with version 1.1 of the Jazz plugin) and have run into an interesting snag. The Jazz users are connected using the corporate AD and the usernames returned by RTC's lscm annotate command is in the form of "lastname, firstname" so the result looks like:9 Smith, John (1000) 2014-04-03 04:32 PM 272 some code here;The issue comes up when trying to tie this to a user in Sonar. I cannot add the scm account "Smith, John" through the UI (it turns it into two accounts "Smith" and "John"). Also, the issue search fails to deal well with the comma so you can't go to the issue page and just filter by author = 'smith, john'.I have to believe I'm not the first person to come across this issue but I've been unable to find any solutions online. There are a couple of workarounds that I may end up trying but would prefer it if I didn't have to stray far from a plain OOTB SonarQube install.
SonarQube blame information for Jazz RTC contains comma in username
I faced this error recently. Analysis successful but report processing failed[Saying .sonarlock file couldn't be deleted]I had warnings in the build but no error.we need to check the logs of sonar analysis for more information.So from build console navigate to sonar url.[INFO] [20:02:34.373] ANALYSIS SUCCESSFUL, you can browsehttp://localhost:9000/dashboard/index/com.appClick onAdministration->background tasks->(check your failed build with logs link at end)->open logs to check the error.I had validation failed error for multimodule mvn project in sonar logs.org.sonar.api.utils.MessageException: Validation of project failed:o Module "com.app:app-bootstrap" is already part of project "com.app:appco"Fixed it by updating the group id's of all my projects modules and submodules.
I am running command 'gradle sonarqube --stacktrace" which started resulting in the following:Analysis report generated in /Users/shashank.devan/dev/myproject/build/sonar/batch-report 23:38:14.994 DEBUG - Couldn't delete lock file: /Users/shashank.devan/dev/myproject/./.sonar_lock java.nio.file.NoSuchFileException: /Users/shashank.devan/dev/myproject/./.sonar_lock > Buildiat sun.nio.fs.UnixException.translateToIOException(UnixException.java:86) at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) at sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:244) at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103) at java.nio.file.Files.delete(Files.java:1126) at org.sonar.home.cache.DirectoryLock.unlock(DirectoryLock.java:98) at org.sonar.batch.scan.ProjectLock.stop(ProjectLock.java:57).. .. What went wrong: Execution failed for task ':myproject:sonarqube'. > Unable to execute SonarDid I miss something? The command was working fine for other directories.
Sonarqube: Job fails with Couldn't delete lock file: .././.sonar_lock java.nio.file.NoSuchFileException
This is not currently possible with SonarQube 5.4. We may later add this feature but this is not our top priority.
Is it possible to run SonarQube in "Incremental" analysis mode and get not only code quality issues on the current branch but also other metrics, especially Code Coverage? (We are really interested to see how code coverage changed in the feature branch, comparing with the "develop" branch) How this can be configured?sonar.analysis.mode=incremental
SonarQube incremental analysis for the Code Coverage