Git Product home page Git Product logo

sonarsource / sonar-scanning-examples Goto Github PK

View Code? Open in Web Editor NEW
882.0 50.0 2.2K 946 KB

Shows how to use the Scanners

License: GNU Lesser General Public License v3.0

COBOL 15.43% Java 13.16% PHP 2.52% JavaScript 0.30% ABAP 6.06% Python 7.42% Swift 0.98% Erlang 0.04% HTML 1.16% PLSQL 2.52% C# 1.95% Shell 0.66% Kotlin 0.36% ActionScript 0.13% Visual Basic 6.0 8.69% Dockerfile 0.62% HCL 6.90% Bicep 23.50% Apex 7.61%

sonar-scanning-examples's People

Contributors

agigleux avatar amelie-renard-sonarsource avatar andrei-epure-sonarsource avatar asears avatar brian-cipollone-sonarsource avatar cameronschmidt avatar colin-sonarsource avatar daniel-meppiel-sonarsource avatar dependabot[bot] avatar donhui avatar emanuelschmoczer avatar francoismora avatar friederbluemle avatar gtpgi avatar jeff-zapotoczny-sonarsource avatar joe-tingsanchali-sonarsource avatar leveretka avatar malena-ebert-sonarsource avatar margarita-nedzelska-sonarsource avatar megan-wilson-sonarsource avatar okorach avatar pearsonradu avatar saberduck avatar shalom938 avatar sylvain-combe-sonarsource avatar tomverin avatar tyler-keith-thompson avatar vilchik-elena avatar yacine-maghezzi-sonarsource avatar yassin-kammoun-sonarsource avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sonar-scanning-examples's Issues

Requested but did not find extension point with identifier Xcode.IDEFoundation.IDEResultKitSerializationConverter

Hi Team,

Even after using the latest script (as mentioned) for xcode 11. I am getting the below error while running the coverage report script. am i missing anything here

These are the steps i followed to upgrade to xcode 11.3

  1. Upgrade the OS to Catalina
  2. Install Xcode 11.3 on the local machine
  3. Install command line tools for Xcode 11.3

xccov[6953:154596] Requested but did not find extension point with identifier Xcode.IDEFoundation.IDEResultKitSerializationConverter

CodeNarcSensor has unsatisfied dependency 'class GroovyFileSystem'

Since I updated our SonarQube server to version 7.3 I am struggling with this error:
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.1.1168:sonar (default-cli) on project xxxx: org.sonar.plugins.groovy.codenarc.CodeNarcSensor has unsatisfied dependency 'class org.sonar.plugins.groovy.foundation.GroovyFileSystem' for constructor 'public org.sonar.plugins.groovy.codenarc.CodeNarcSensor(org.sonar.api.profiles.RulesProfile,org.sonar.plugins.groovy.foundation.GroovyFileSystem)' from org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer@2f3928ac:268<[Immutable]:org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer@e784320:288<[Immutable]:org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer@330c1f61:9<[Immutable]:org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer@2b06f498:53<| -> [Help 1]

I am not sure what to do with it.
I tried the latest plugin version 3.5.0.1254, but also 3.4.1.1168.
Both report the same result and break the build.

Any ideas?

failed to push the analyst report to server

I did install and run sonarQube and Mysql on my localhost. I got the erroe message when i run "ant all" under the ant project.

[sonar:sonar] CPD calculation finished
[sonar:sonar] Analysis report generated in 55ms, dir size=13 KB
[sonar:sonar] Analysis reports compressed in 5ms, zip size=5 KB

BUILD FAILED
/home/developer/sonarQube/workspace/sonar-scanning-examples-master/sonarqube-scanner-ant/build.xml:43: org.sonarqube.ws.client.HttpException: Error 500 on http://localhost:9000/api/ce/submit?projectKey=org.sonarqube:sonarqube-scanner-ant&projectName=Example%20of%20SonarQube%20Scanner%20for%20Ant%20Usage : {"errors":[{"msg":"An error has occurred. Please contact your administrator."}]}
at org.sonarqube.ws.client.BaseResponse.failIfNotSuccessful(BaseResponse.java:36)
at org.sonar.scanner.bootstrap.BatchWsClient.failIfUnauthorized(BatchWsClient.java:102)
at org.sonar.scanner.bootstrap.BatchWsClient.call(BatchWsClient.java:71)
at org.sonar.scanner.report.ReportPublisher.upload(ReportPublisher.java:173)
at org.sonar.scanner.report.ReportPublisher.execute(ReportPublisher.java:128)
at org.sonar.scanner.phases.PublishPhaseExecutor.publishReportJob(PublishPhaseExecutor.java:64)
at org.sonar.scanner.phases.PublishPhaseExecutor.executeOnRoot(PublishPhaseExecutor.java:51)
at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:81)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:182)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:247)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:242)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:232)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:47)
at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:86)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:115)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:116)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:233)
at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)
at org.sonarsource.scanner.ant.SonarQubeTask.launchAnalysis(SonarQubeTask.java:99)
at org.sonarsource.scanner.ant.SonarQubeTask.execute(SonarQubeTask.java:81)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
at org.apache.tools.ant.Main.runBuild(Main.java:853)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)

Do i need some username or token for push report to server?

Thasnk

kevin

Use up-to-date java version

Example project uses Java 7, which is outdated.
Use Java 12.
See sonar-scanning-examples/sonarqube-scanner-maven/pom.xml

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.6.0</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
</plugin>

Merging multiple xccovreport-s

Is it possible to pass or merge multiple xccovreports to pass to sonar?

I see the script xccov-to-sonarqube-generic, but that only takes one file.

Sucessful analysis on C# example project but no information on the dashboard

Hi,

I'm not getting any information on the dashboard after running the analysis. See information below:

OS: Windows 7
SonarQube version: Version 6.7.3 (build 38370)
SonarC# version: 7.0.1 (build 4822)installed
Visual Studio Community 2017 is installed (not sure if this is relevant)

Output of MSBuild /version:

C:\CSharpProject>MSBuild /version
Microsoft(R) Build Engine versão 15.6.82.30579 para .NET Framework
Copyright (C) Microsoft Corporation. Todos os direitos reservados.

15.6.82.30579

Output of SonarScanner.MSBuild.exe /h:

C:\CSharpProject>SonarScanner.MSBuild.exe /h
SonarScanner for MSBuild 4.2
Using the .NET Framework version of the Scanner for MSBuild

Usage:

  SonarScanner.MSBuild.exe [begin|end] /key:project_key [/name:project_name] [/version:project_version] [/d:sonar.key=value] [/s:settings_file]

    When executing the begin phase, at least the project key must be defined.
    Other properties can dynamically be defined with '/d:'. For example, '/d:sonar.verbose=true'.
    A settings file can be used to define properties. If no settings file path is given, the file SonarQube.Analysis.xml in the installation directory will be used.
    Only the token should be passed during the end phase, if it was used during the begin phase.

First lines of StartSonar seem to indicate everything is fine with the server:

C:\Users\matheus.alencar>StartSonar.bat
wrapper  | --> Wrapper Started as Console
wrapper  | Launching a JVM...
jvm 1    | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
jvm 1    |   Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.
jvm 1    |
jvm 1    | 2018.05.03 15:28:32 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory C:\sonarqube-6.7.3\temp
jvm 1    | 2018.05.03 15:28:32 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
jvm 1    | 2018.05.03 15:28:32 INFO  app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [C:\sonarqube-6.7.3\elasticsearch]: C:\Program Files\Java\jre1.8.0_161\bin\java -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djdk.io.permiss
ionsUseCanonicalPath=true -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j.skipJansi=true -Xms512m -Xmx512m -XX:+HeapDumpOnOutOfMemoryError -Delasticsearch -Des.path.home=C:\sonarqube-6.7.3\elasticsearch -cp lib/* org.elasticsearch.bootstrap.Elasticsearch -Epath.conf=C:\sonarqube-6.7.3\temp\conf\es
jvm 1    | 2018.05.03 15:28:32 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
jvm 1    | 2018.05.03 15:28:32 INFO  app[][o.e.p.PluginsService] no modules loaded
jvm 1    | 2018.05.03 15:28:32 INFO  app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
jvm 1    | 2018.05.03 15:28:47 INFO  app[][o.s.a.SchedulerImpl] Process[es] is up
jvm 1    | 2018.05.03 15:28:47 INFO  app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='web', ipcIndex=2, logFilenamePrefix=web]] from [C:\sonarqube-6.7.3]: C:\Program Files\Java\jre1.8.0_161\bin\java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=C:\sonarqube-6.7.3\temp -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -cp ./lib/common/*;./lib/server/*;C:\sonarqube-6.7.3\lib\jdbc\h2\h2-1.3.176.jar org.so
nar.server.app.WebServer C:\sonarqube-6.7.3\temp\sq-process1642370009301652133properties
jvm 1    | 2018.05.03 15:29:02 INFO  app[][o.s.a.SchedulerImpl] Process[web] is up
jvm 1    | 2018.05.03 15:29:02 INFO  app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='ce', ipcIndex=3, logFilenamePrefix=ce]] from [C:\sonarqube-6.7.3]: C:\Program Files\Java\jre1.8.0_161\bin\java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=C:\sonarqube-6.7.3\temp -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -cp ./lib/common/*;./lib/server/*;./lib/ce/*;C:\sonarqube-6.7.3\lib\jdbc\h2\h2-1.3.176.j
ar org.sonar.ce.app.CeServer C:\sonarqube-6.7.3\temp\sq-process7575082232986203890properties
jvm 1    | 2018.05.03 15:29:06 INFO  app[][o.s.a.SchedulerImpl] Process[ce] is up
jvm 1    | 2018.05.03 15:29:06 INFO  app[][o.s.a.SchedulerImpl] SonarQube is up

Output of begin step:

C:\CSharpProject>SonarScanner.MSBuild.exe begin /k:"org.sonarqube:sonarqube-scanner-msbuild" /n:"Example of SonarQube Scanner for MSBuild Usage" /v:"1.0"
SonarScanner for MSBuild 4.2
Using the .NET Framework version of the Scanner for MSBuild
Default properties file was found at C:\sonar-scanner-msbuild-4.2.0.1214-net46\SonarQube.Analysis.xml
Loading analysis properties from C:\sonar-scanner-msbuild-4.2.0.1214-net46\SonarQube.Analysis.xml
Pre-processing started.
Preparing working directories...
15:30:55.675  Updating build integration targets...
15:30:55.691  Fetching analysis configuration settings...
15:30:56.143  Provisioning analyzer assemblies for cs...
15:30:56.143  Installing required Roslyn analyzers...
15:30:56.268  Pre-processing succeeded.

Output of MSBuild.exe /t:Rebuild:

C:\CSharpProject>MSBuild.exe /t:Rebuild
Microsoft(R) Build Engine versão 15.6.82.30579 para .NET Framework
Copyright (C) Microsoft Corporation. Todos os direitos reservados.

Compilando os projetos desta solução um de cada vez. Para habilitar o build paralelo, adicione a opção "/m".
Compilação de 03/05/2018 15:32:50 iniciada.
Projeto "C:\CSharpProject\SomeConsoleApplication.sln" no nó 1 (Rebuild destino(s)).
ValidateSolutionConfiguration:
  Compilando a configuração de solução "Debug|Any CPU".
O projeto "C:\CSharpProject\SomeConsoleApplication.sln" (1) está compilando "C:\CSharpProject\SomeConsoleApplication\SomeConsoleApplication.csproj" (2) no nó 1 (Rebuild destino(s)).
CoreClean:
  Excluindo o arquivo "C:\CSharpProject\SomeConsoleApplication\bin\Debug\SomeConsoleApplication.exe.config".
  Excluindo o arquivo "C:\CSharpProject\SomeConsoleApplication\bin\Debug\SomeConsoleApplication.exe".
  Excluindo o arquivo "C:\CSharpProject\SomeConsoleApplication\bin\Debug\SomeConsoleApplication.pdb".
  Excluindo o arquivo "C:\CSharpProject\SomeConsoleApplication\obj\Debug\SomeConsoleApplication.csprojResolveAssemblyReference.cache".
  Excluindo o arquivo "C:\CSharpProject\SomeConsoleApplication\obj\Debug\SomeConsoleApplication.csproj.CoreCompileInputs.cache".
  Excluindo o arquivo "C:\CSharpProject\SomeConsoleApplication\obj\Debug\SomeConsoleApplication.exe".
  Excluindo o arquivo "C:\CSharpProject\SomeConsoleApplication\obj\Debug\SomeConsoleApplication.pdb".
GenerateBindingRedirects:
  Nenhum redirecionamento de associação sugerido de ResolveAssemblyReferences.
GenerateTargetFrameworkMonikerAttribute:
Ignorando o destino "GenerateTargetFrameworkMonikerAttribute" porque todos os arquivos de saída estão atualizados em relação aos arquivos de entrada.
CreateProjectSpecificDirs:
  Criando o diretório "C:\CSharpProject\.sonarqube\conf\0".
CoreCompile:
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Roslyn\csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /platform:anycpu32bitpreferred /errorreport:prompt /warn:4 /define:DEBUG;TRACE /highentropyva+ /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\Microsoft.CSharp.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NET
  Framework\v4.5.2\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Data.DataSetExtensions.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Data.dll" /reference:"C:\Program Files (x86)\R
  eference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Net.Http.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Xml.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Xml.Linq.dll" /debu
  g+ /debug:full /filealign:512 /optimize- /out:obj\Debug\SomeConsoleApplication.exe /ruleset:C:\CSharpProject\.sonarqube\conf\SonarQubeRoslyn-cs.ruleset /errorlog:C:\CSharpProject\SomeConsoleApplication\bin\Debug\SomeConsoleApplication.exe.RoslynCA.json /subsystemversion:6.00 /target:exe /warnaserror- /utf8output /analyzer:C:\Users\matheus.alencar\AppData\Local\Temp\.sonarqube\resources\0\Google.Protobuf.dll /analyzer:C:\Use
  rs\matheus.alencar\AppData\Local\Temp\.sonarqube\resources\0\SonarAnalyzer.CSharp.dll /analyzer:C:\Users\matheus.alencar\AppData\Local\Temp\.sonarqube\resources\0\SonarAnalyzer.dll /additionalfile:C:\CSharpProject\.sonarqube\conf\cs\SonarLint.xml /additionalfile:C:\CSharpProject\.sonarqube\conf\0\ProjectOutFolderPath.txt Program.cs Properties\AssemblyInfo.cs "C:\Users\matheus.alencar\AppData\Local\Temp\.NETFramework,Version
  =v4.5.2.AssemblyAttributes.cs"
  Usando compilação compartilhada com o compilador do diretório: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Roslyn
Program.cs(4,18): warning S1118: Add a 'protected' constructor or the 'static' keyword to the class declaration. [C:\CSharpProject\SomeConsoleApplication\SomeConsoleApplication.csproj]
Program.cs(9,17): warning S2583: Change this condition so that it does not always evaluate to 'true'; some subsequent code is never executed. [C:\CSharpProject\SomeConsoleApplication\SomeConsoleApplication.csproj]
_CopyAppConfigFile:
  Copiando o arquivo de "App.config" para "bin\Debug\SomeConsoleApplication.exe.config".
CopyFilesToOutputDirectory:
  Copiando o arquivo de "obj\Debug\SomeConsoleApplication.exe" para "bin\Debug\SomeConsoleApplication.exe".
  SomeConsoleApplication -> C:\CSharpProject\SomeConsoleApplication\bin\Debug\SomeConsoleApplication.exe
  Copiando o arquivo de "obj\Debug\SomeConsoleApplication.pdb" para "bin\Debug\SomeConsoleApplication.pdb".
Projeto de compilação pronto "C:\CSharpProject\SomeConsoleApplication\SomeConsoleApplication.csproj" (Rebuild destino(s)).

O projeto "C:\CSharpProject\SomeConsoleApplication.sln" (1) está compilando "C:\CSharpProject\SomeConsoleApplicationTest\SomeConsoleApplicationTest.csproj" (3) no nó 1 (Rebuild destino(s)).
CoreClean:
  Excluindo o arquivo "C:\CSharpProject\SomeConsoleApplicationTest\bin\Debug\SomeConsoleApplicationTest.dll".
  Excluindo o arquivo "C:\CSharpProject\SomeConsoleApplicationTest\bin\Debug\SomeConsoleApplicationTest.pdb".
  Excluindo o arquivo "C:\CSharpProject\SomeConsoleApplicationTest\bin\Debug\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll".
  Excluindo o arquivo "C:\CSharpProject\SomeConsoleApplicationTest\bin\Debug\SomeConsoleApplication.exe".
  Excluindo o arquivo "C:\CSharpProject\SomeConsoleApplicationTest\bin\Debug\SomeConsoleApplication.pdb".
  Excluindo o arquivo "C:\CSharpProject\SomeConsoleApplicationTest\bin\Debug\SomeConsoleApplication.exe.config".
  Excluindo o arquivo "C:\CSharpProject\SomeConsoleApplicationTest\bin\Debug\pt-BR\Microsoft.VisualStudio.QualityTools.UnitTestFramework.resources.dll".
  Excluindo o arquivo "C:\CSharpProject\SomeConsoleApplicationTest\obj\Debug\SomeConsoleApplicationTest.csprojResolveAssemblyReference.cache".
  Excluindo o arquivo "C:\CSharpProject\SomeConsoleApplicationTest\obj\Debug\SomeConsoleApplicationTest.csproj.CoreCompileInputs.cache".
  Excluindo o arquivo "C:\CSharpProject\SomeConsoleApplicationTest\obj\Debug\SomeConsoleApplicationTest.csproj.CopyComplete".
  Excluindo o arquivo "C:\CSharpProject\SomeConsoleApplicationTest\obj\Debug\SomeConsoleApplicationTest.dll".
  Excluindo o arquivo "C:\CSharpProject\SomeConsoleApplicationTest\obj\Debug\SomeConsoleApplicationTest.pdb".
GenerateTargetFrameworkMonikerAttribute:
Ignorando o destino "GenerateTargetFrameworkMonikerAttribute" porque todos os arquivos de saída estão atualizados em relação aos arquivos de entrada.
CreateProjectSpecificDirs:
  Criando o diretório "C:\CSharpProject\.sonarqube\conf\1".
CoreCompile:
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Roslyn\csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE /highentropyva+ /reference:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Fr
  amework\.NETFramework\v4.5.2\mscorlib.dll" /reference:C:\CSharpProject\SomeConsoleApplication\bin\Debug\SomeConsoleApplication.exe /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.dll" /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\SomeConsoleA
  pplicationTest.dll /ruleset:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Team Tools\Static Analysis Tools\\Rule Sets\MinimumRecommendedRules.ruleset" /subsystemversion:6.00 /target:library /warnaserror- /utf8output ProgramTests.cs Properties\AssemblyInfo.cs "C:\Users\matheus.alencar\AppData\Local\Temp\.NETFramework,Version=v4.5.2.AssemblyAttributes.cs"
  Usando compilação compartilhada com o compilador do diretório: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Roslyn
_CopyFilesMarkedCopyLocal:
  Copiando o arquivo de "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll" para "bin\Debug\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll".
  Copiando o arquivo de "C:\CSharpProject\SomeConsoleApplication\bin\Debug\SomeConsoleApplication.exe" para "bin\Debug\SomeConsoleApplication.exe".
  Copiando o arquivo de "C:\CSharpProject\SomeConsoleApplication\bin\Debug\SomeConsoleApplication.pdb" para "bin\Debug\SomeConsoleApplication.pdb".
  Copiando o arquivo de "C:\CSharpProject\SomeConsoleApplication\bin\Debug\SomeConsoleApplication.exe.config" para "bin\Debug\SomeConsoleApplication.exe.config".
  Copiando o arquivo de "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\PublicAssemblies\pt-BR\Microsoft.VisualStudio.QualityTools.UnitTestFramework.resources.dll" para "bin\Debug\pt-BR\Microsoft.VisualStudio.QualityTools.UnitTestFramework.resources.dll".
  Criando "C:\CSharpProject\SomeConsoleApplicationTest\obj\Debug\SomeConsoleApplicationTest.csproj.CopyComplete" porque "AlwaysCreate" foi especificado.
CopyFilesToOutputDirectory:
  Copiando o arquivo de "obj\Debug\SomeConsoleApplicationTest.dll" para "bin\Debug\SomeConsoleApplicationTest.dll".
  SomeConsoleApplicationTest -> C:\CSharpProject\SomeConsoleApplicationTest\bin\Debug\SomeConsoleApplicationTest.dll
  Copiando o arquivo de "obj\Debug\SomeConsoleApplicationTest.pdb" para "bin\Debug\SomeConsoleApplicationTest.pdb".
Projeto de compilação pronto "C:\CSharpProject\SomeConsoleApplicationTest\SomeConsoleApplicationTest.csproj" (Rebuild destino(s)).

Projeto de compilação pronto "C:\CSharpProject\SomeConsoleApplication.sln" (Rebuild destino(s)).


Compilação com êxito.

"C:\CSharpProject\SomeConsoleApplication.sln" (Rebuild destino) (1) ->
"C:\CSharpProject\SomeConsoleApplication\SomeConsoleApplication.csproj" (Rebuild destino) (2) ->
(CoreCompile destino) ->
  Program.cs(4,18): warning S1118: Add a 'protected' constructor or the 'static' keyword to the class declaration. [C:\CSharpProject\SomeConsoleApplication\SomeConsoleApplication.csproj]
  Program.cs(9,17): warning S2583: Change this condition so that it does not always evaluate to 'true'; some subsequent code is never executed. [C:\CSharpProject\SomeConsoleApplication\SomeConsoleApplication.csproj]

    2 Aviso(s)
    0 Erro(s)

Tempo Decorrido 00:00:04.08

and finally, output of SonarScanner.MSBuild.exe end step:

C:\CSharpProject>SonarScanner.MSBuild.exe end
SonarScanner for MSBuild 4.2
Using the .NET Framework version of the Scanner for MSBuild
Default properties file was found at C:\sonar-scanner-msbuild-4.2.0.1214-net46\SonarQube.Analysis.xml
Loading analysis properties from C:\sonar-scanner-msbuild-4.2.0.1214-net46\SonarQube.Analysis.xml
Post-processing started.
SONAR_SCANNER_OPTS is not configured. Setting it to the default value of -Xmx1024m
Calling the SonarQube Scanner...
The SonarQube Scanner has finished
15:37:19.682  Creating a summary markdown file...
15:37:19.682  Analysis results: http://localhost:9000/dashboard/index/org.sonarqube:sonarqube-scanner-msbuild
15:37:19.682  Post-processing succeeded.

C:\CSharpProject>

Thank you.

Sonar Scanner not reporting memory leaks issues for c project

Code:
#include <stdio.h>
#include <unistd.h>
#define BUFSIZE1 512
#define BUFSIZE2 ((BUFSIZE1/2) - 8)

int main(int argc, char **argv) {
char *buf1R1;
char *buf2R1;
char *buf1R2;
buf1R1 = (char *) malloc(BUFSIZE2);
buf2R1 = (char *) malloc(BUFSIZE2);
buf1R2 = (char *) malloc(BUFSIZE1);
strncpy(buf1R2, argv[1], BUFSIZE1-1);
}

Even though all 4.7k+ rules are activated sonarqube 7.6 not detecting memory leak issues

SonarQube analyses C# issue Line 736 is out of range

Hi Team,
I am facing below error while exeucting Sonar Analysis for C# project. Follow steps from:
https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+MSBuild

This is happening for both SonarCloud as well as Sonar Local instance.

Env Details:
SonarQube: 7.4
SonarScanner for MSBuild 4.4.2
SonarQube Scanner 3.2.0.1227
Java 1.8.0_131 Oracle Corporation (64-bit)
Mac OS X 10.13.6 x86_64

ERROR: Line 736 is out of range for file /xxxxx.cs. File has 735 lines.

Below is the short stacktrace.
INFO: Importing results from 6 proto files in ‘/.sonarqube/out/0/output-cs'
INFO: Importing results from 6 proto files in ‘/.sonarqube/out/1/output-cs'
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 4.903s
INFO: Final Memory: 23M/646M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Line 736 is out of range for file /xxxxx.cs. File has 735 lines.
ERROR:
The SonarQube Scanner did not complete successfully
10:03:23.755 Creating a summary markdown file...
10:03:23.763 Post-processing failed. Exit code: 1

More details are available also at:
https://stackoverflow.com/questions/53493806/sonarqube-analyses-issue-line-is-out-of-range-for

xccov-to-sonarqube-generic.sh takes long time in Xcode12

We recently upgraded to Xcode 12 and noticed the below issue.

01:47:46 + ./xccov-to-sonarqube-generic.sh ./fastlane/ui_test_output/ABCEarlGreyTests.xcresult

01:47:46 2021-01-06 22:47:46.049 xccov[24889:354229] Requested but did not find extension point with identifier Xcode.IDEFoundation.IDEResultKitSerializationConverter
03:34:20 2021-01-07 00:34:20.420 xccov[40613:629084] Requested but did not find extension point with identifier Xcode.IDEFoundation.IDEResultKitSerializationConverter
03:34:20 [Pipeline] junit
03:34:20 Recording test results

Any suggestions? Thanks!

0 files to be analyzed

Hi, I'm not being able to make the CSharpProject work; I'm using sonar.msbuild version 4.1.1.

The following is an extract of the output of the "end" command of the analysis. Please, notice the 2 files indexed, 0 files to be analyzed.

INFO: -------------  Scan SomeConsoleApplicationTest
INFO: Base dir: C:\Users\lurodrig\Desktop\personal\code samples\sonar-samples\sonar-scanning-examples-master\sonar-scanning-examples-master\sonarqube-scanner-msbuild\CSharpProject\SomeConsoleApplicationTest
INFO: Working dir: C:\Users\lurodrig\Desktop\personal\code samples\sonar-samples\sonar-scanning-examples-master\sonar-scanning-examples-master\sonarqube-scanner-msbuild\CSharpProject\.sonarqube\out\.sonar\POSTPRODUC_POSTPRODUC_69A603A4-4241-4F3B-846C-E95307293CF0
INFO: Test paths: ProgramTests.cs, Properties/AssemblyInfo.cs
INFO: Source encoding: UTF-8, default locale: es_ES
INFO: Language is forced to cs
INFO: Index files
INFO: 2 files indexed
INFO: Quality profile for cs: Sonar way
INFO: Sensor Embedded CSS Analyzer Sensor [css]
INFO: 0 source files to be analyzed
INFO: Sensor Embedded CSS Analyzer Sensor [css] (done) | time=2ms
INFO: Sensor C# Properties [csharp]
INFO: Sensor C# Properties [csharp] (done) | time=0ms
INFO: Sensor SonarJavaXmlFileSensor [java]
INFO: Sensor SonarJavaXmlFileSensor [java] (done) | time=0ms
INFO: Sensor Analyzer for "php.ini" files [php]
INFO: Sensor Analyzer for "php.ini" files [php] (done) | time=1ms
INFO: SCM Publisher is disabled

The result of this is that no issues are reported in the analysis, so no issues detected to fix :(

Excessive "did not find extension point…" output slows script execution time

As reported by many users in issue #63, execution time of the script is extremely slow when run using the .xcresult bundle format introduced in Xcode 11. Each time any xccov command is run, there is a delay followed by the following output:

Requested but did not find extension point with identifier Xcode.IDEFoundation.IDEResultKitSerializationConverter

Unable to import Xcode Coverage data on XCode 12

Hi,

We are getting this error when running xccov-to-sonarqube-generic.sh script on XCode 12 to generate XML coverage file.
Error: Error Domain=XCCovErrorDomain Code=0 "Failed to load result bundle" UserInfo={NSLocalizedDescription=Failed to load result bundle, NSUnderlyingError=0x7fc20a10a960 {Error Domain=IDEFoundation.ResultBundleError Code=0 "This version of Xcode does not support opening result bundles created with versions of Xcode and xcodebuild using the v1 API."}}

Do we have an update regarding the new XCode version?

I'm running the script as shown:
./xccov-to-sonarqube-generic.sh "/DerivedData/Logs/Test/*.xcresult" > sonarqube.generic-coverage.xml

XCode Version 12.0.1 (12A7300)

The sonar-maven-plugin does't support parallel compilation

as below,The sonar-maven-plugin 3.7 support parallel compilation.would you pls help to resolve it?

18:02:12 [INFO] --------------------------------[ pom ]---------------------------------
18:02:12 [WARNING] *****************************************************************
18:02:12 [WARNING] * Your build is requesting parallel execution, but project *
18:02:12 [WARNING] * contains the following plugin(s) that have goals not marked *
18:02:12 [WARNING] * as @threadsafe to support parallel building. *
18:02:12 [WARNING] * While this /may/ work fine, please look for plugin updates *
18:02:12 [WARNING] * and/or request plugins be made thread-safe. *
18:02:12 [WARNING] * If reporting an issue, report it against the plugin in *
18:02:12 [WARNING] * question, not against maven-core *
18:02:12 [WARNING] *****************************************************************
18:02:12 [WARNING] The following plugins are not marked @threadsafe in ad-project:
18:02:12 [WARNING] org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746
18:02:12 [WARNING] Enable debug to see more precisely which goals are not marked @threadsafe.
18:02:12 [WARNING] *****************************************************************
1

sonar-scanner throws parsing error for sonarqube-generic-coverage.xml

Error generic coverage report:
INFO: ------------- Run sensors on project
INFO: Sensor Generic Coverage Report
INFO: Parsing /Users//sonarqube-generic-coverage.xml
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 2:58.549s
INFO: Final Memory: 63M/240M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
ERROR: Error during parsing of the generic coverage report '/Users//sonarqube-generic-coverage.xml'. Look at SonarQube documentation to know the expected XML format.

Description:
The sonar-scanner throws parsing error for sonarqube-generic-coverage.xml when file size >2MB generated by xccov-to-sonarqube-generic.sh. The coverage reports are generated for Generic Coverage correctly as per https://docs.sonarqube.org/latest/analysis/generic-test/
Screenshot 2021-01-08 at 2 37 54 PM

The project uses swift and objective-c language. The reporting is successful when the sonarqube-generic-coverage.xml is around 2MB.
Screenshot 2021-01-08 at 2 29 14 PM

Info:
SonarScanner 4.5.0.2216
Java version 8, 11, 15
Mac OS X 10.15.6 x86_64

xccov-to-sonarqube-generic.sh doesnt support code coverage for me

Hello , xccov-to-sonarqube-generic.sh this code take a long time in my project.
My Xcode Version is 10 . So I don't have xccovarchive . I have xcresult file.
bash xccov-to-sonarqube-generic.sh Build/Logs/Tests/xcresult/_Test/action.xccovreport > sonar.xml

and this code take a about 5 hours. (xcresult file size 30 mb )

no line coverage with maven-multimodule example

Hi,

i don't see any line coverage in Sonarqube UI if i run:

mvn clean verify sonar:sonar

on the project:

I only see 6 Code Smells and the 4 Unit Tests.

I see the line coverage in the jacoco output in the project folder:

  • sonarqube-scanner-maven/maven-multimodule/tests/target/site/jacoco-aggregate/index.html

Any hints what's maybe wrong?

DevSecOps - SonarQube

We need Add the SonarQube dependency in pom.xml

Our code is-

<!--
 Pom file to download jenkins war file and install it using `mvn exec:exec -Dvar.port=8000`
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.Play</groupId>
<artifactId>mvn-jkn</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>mvn-jkn</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>eslint</artifactId>
<version>0.5.1</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
 <!--  TO BE REPLACED WITH WAR PLUGIN  -->
<version>1.6.0</version>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>

We had replace <!-- TO BE REPLACED WITH WAR PLUGIN --> with<artifactId>maven-war-plugin</artifactId>but thing not working. Hence need expertise advice.

Multi-module project example

I'm not able to configure the properties for a multi-module gradle project. Only works via command line so far. An example would be very helpful.

Examples showing defaults per project that can be overridden?

Hi I'm trying to locate an example where the project has a default sonar properties file which can be added to source control and then another sonar properties file that a developer can then override the default settings.

Is this possible with sonarqube?

Exclude androidTest and test folder

How can exclude androidTest and Test folder from sonar analysis. I tried this but not working the report error.
sonarqube { properties { property 'sonar.sources', "src/main/java" property 'sonar.exclusions', "/androidTest/**/*.java" } androidVariant 'devDebug' }

I am not write any test code that's why they return error when I am try to run ./gradlew sonarqube.

Can you please suggest me how can I ignore these folder from sonar.

Multi-module project configuration

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    version - 6.7.7
  • what are you trying to achieve
    We want to configure SonarQube for multi language project. Where project can have c,c++,java, js, xml and html.

Project can have multiple sub projects or sub modules in it.

Possible project structure would be as following, I am facing problem as there are multiple possible build folders where sonar.cfamily.build-wrapper-output=build/bz_output needs to point.

I need to holistic approach for sonarqube scanner.

Currently I have configured and I am running sonar-scanner command in each C++ CMakeList project.
And I endup with various erros. as following.

project
│   README.md
│   .gitlab-ci.yaml  
│   sonar-project.properties
│
└───SubProject1_c/cxx Cmake
│   │   CMakeLists.txt
│   │
│   └───src
│       │   file111.cxx
│       │   file112.hxx
│       │   ...
│       └───build
└───SubProject2_c/cxx Cmake
│   │   CMakeLists.txt
│   └───src
│       │   file111.cxx
│       │   file112.hxx
│       │   ...
│       └───build
└───SubProject_NPM
│   │   file021.txt
│   │ 
│   └───src
│       │   file111.js
│       │   file112.html
└───SubProject_java
│   │   file021.txt
│   │ 
│   └───src
│       │   file111.java

  • what have you tried so far to achieve this
    I tried keeping sonar.project.properties in each modules of sub folder and also tried with keeping single sonar.project.properties file but both didint worked for me.

18:31:39.545 INFO: Process Dependency-Check report (done) | time=12ms
18:31:39.545 INFO: Sensor Dependency-Check [dependencycheck] (done) | time=12ms
18:31:39.545 INFO: Sensor CFamily [cpp]
18:31:39.546 ERROR:

The only way to get an accurate analysis of C/C++/Objective-C files is by using the SonarSource build-wrapper
and setting the property "sonar.cfamily.build-wrapper-output", but it was not specified.

If you don't want to analyze C/C++/Objective-C files, then prevent them from being analyzed by setting the following properties:

sonar.c.file.suffixes=-
sonar.cpp.file.suffixes=-
sonar.objc.file.suffixes=-

18:31:39.655 INFO: ------------------------------------------------------------------------
18:31:39.656 INFO: EXECUTION FAILURE
18:31:39.656 INFO: ------------------------------------------------------------------------
18:31:39.656 INFO: Total time: 25.185s
18:31:39.827 INFO: Final Memory: 33M/418M
18:31:39.827 INFO: ------------------------------------------------------------------------
18:31:39.827 ERROR: Error during SonarQube Scanner execution
java.lang.UnsupportedOperationException:

The only way to get an accurate analysis of C/C++/Objective-C files is by using the SonarSource build-wrapper
and setting the property "sonar.cfamily.build-wrapper-output", but it was not specified.

If you don't want to analyze C/C++/Objective-C files, then prevent them from being analyzed by setting the following properties:

sonar.c.file.suffixes=-
sonar.cpp.file.suffixes=-
sonar.objc.file.suffixes=-


at com.sonar.cpp.plugin.R.execute(na:3349)
at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:88)
at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:82)
at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:73)
at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:88)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:177)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:291)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:286)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:264)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)
at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:84)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:121)
at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:71)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:171)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:128)
at org.sonarsource.scanner.cli.Main.execute(Main.java:111)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)

Also I get following if I configure all subprojects with following content.

04:35:03.524 INFO: ------------------------------------------------------------------------
04:35:03.524 INFO: EXECUTION FAILURE
04:35:03.524 INFO: ------------------------------------------------------------------------
04:35:03.525 INFO: Total time: 15.603s
04:35:03.644 INFO: Final Memory: 36M/249M
04:35:03.644 INFO: ------------------------------------------------------------------------
04:35:03.644 ERROR: Error during SonarQube Scanner execution
04:35:03.644 ERROR: File src/server/text.xml can't be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files

sonar.projectKey=ProjectKey

#this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.

sonar.projectName=ProjectKey-ProjectName

sonar.projectVersion=1.0.0

sonar.host.url=

sonar.login=************

sonar.modules=abc

abc.sonar.projectName=abc

abc.sonar.projectKey=abc

abc.sonar.projectBaseDir=.

sonar.sources=.

sonar.exclusions=src/server/textserver/, makefile*,/.properties ,build/** , DevOps/, ProjectInfo.xml, output/, **/.txt, src/test_package/, extensions/, install/**

sonar.cfamily.build-wrapper-output=build/bz_output

Unable to initiate sonar-maven-scan

Fresh server instance, no projects. First-time scan presents error (missing dependency?)

[INFO] --- sonar-maven-plugin:3.4.1.1168:sonar (default-cli) @ udf-id-authority ---
[INFO] User cache: /home/mjaffe/.sonar/cache
[INFO] SonarQube version: 7.2.1
[INFO] Default locale: "en_US", source code encoding: "UTF-8"
[INFO] Publish mode
[INFO] Load global settings
[INFO] Load global settings (done) | time=762ms
[INFO] Server id: AWRIk3VFrEe_XNA6vi10
[INFO] User cache: /home/mjaffe/.sonar/cache
[INFO] Load/download plugins
[INFO] Load plugins index
[INFO] Load plugins index (done) | time=565ms
[INFO] Load/download plugins (done) | time=891ms
[INFO] Loaded core extensions: 
[INFO] Process project properties
[INFO] Load project repositories
[INFO] Load project repositories (done) | time=512ms
[INFO] Load quality profiles
[INFO] Load quality profiles (done) | time=603ms
[INFO] Load active rules
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] udf-id-authority ................................... FAILURE [ 10.214 s]
[INFO] id-authority-schema-processor ...................... SUCCESS [  4.685 s]
[INFO] id-authority-schema ................................ SUCCESS [  8.086 s]
[INFO] id-authority-from-udf .............................. SUCCESS [ 17.548 s]
[INFO] id-authority-demo .................................. SUCCESS [  8.223 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 49.845 s
[INFO] Finished at: 2018-08-03T13:18:10-07:00
[INFO] Final Memory: 55M/276M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.1.1168:sonar (default-cli) on project udf-id-authority: Unable to load component class org.sonar.scanner.report.ActiveRulesPublisher: Unable to load component interface org.sonar.api.batch.rule.ActiveRules: NullPointerException -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.

xccov-to-sonarqube-generic.sh doesn't handle & in filenames

I have a project with a source directory that has spaces and & in it. For example to reproduce, use a folder with the name Drag & Drop.

xccov-to-sonarqube-generic.sh generates an XML that sonar-scanner seems to be unable to parse. It looks like the ampersand should be replaced with &amp; to be parsed properly by sonar-scanner (even though the initial error seems to imply the space is the problem).

ERROR: Error during parsing of the generic coverage report 'sonarqube-generic-coverage.xml'. Look at SonarQube documentation to know the expected XML format.
ERROR: Caused by: Unexpected character ' ' (code 32) (missing name?)
at [row,col {unknown-source}]: [21273,86]

analysis modes

commercial 7.0 version is used, what are current analysis modes? what are the differences between analysis.modes? What is the default analysis mode? which analysis modes are deprecated, which are deleted
preview , issues, incremental, publish....
There is no clear documentation. We nee your help.

How to work without sonar-swift plugin?

Hi @okorach,

Trying to implement the solution of xccov. In my company, I donot have admin rights to sonarqube so cannot download plugin. I need to generate code coverage for iOS somehow really soon.
Does using the "xccov-to-sonarqube-generic.sh" work to generate the coverage in jenkins?
P.S. : Also using XCTest for generating code coverage through command line.
I have to show the coverage in jenkins.
Please help.

Maven multi module: no need to copy paste xmlReportPaths property

The following works for my case:

<!--suppress UnresolvedMavenProperty - for IDEA -->
<sonar.coverage.jacoco.xmlReportPaths>
    ${maven.multiModuleProjectDirectory}/aggregator-project/target/site/jacoco-aggregate/jacoco.xml
</sonar.coverage.jacoco.xmlReportPaths>

This needs to be defined in the parent project only

invalid option '--archive'

On the demo project itself, if I run
bash xccov-to-sonarqube-generic.sh Build/Logs/Test/*.xcresult/*_Test/*.xccovarchive/ > sonarqube-generic-coverage.xml
it gives me an error
Error: Error Domain=DVTCommandLineParserErrorDomain Code=3 "invalid option '--archive'" UserInfo={NSLocalizedDescription=invalid option '--archive'}
I am using Xcode 10.2.1

Does not allow space in xcodeproj file name even with back-slash

I have a project name with space in it eg. 'some name.xcodeproj' also in .plist file. Therefore it fails to build the project. I had tried using 'some\ name.xcodeproj' for values in 'sonar.swift.project' and 'sonar.swift.workspace' properties but they do not work.

Any help is much. appreciated.

sonarqube-scanner-build-wrapper-linux is failing "with undefined reference to `main'"

Recently (~2 months) with some Ubuntu updates, the current build.sh could fail with:

$ ./build.sh
REMOVE PREVIOUS BUILD
BUILDING
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
BUILD FAILURE

So the bw-outputs/build-wrapper-dump.json produced file could be invalid for sonar-scanner analysis.

Current environment version:

$ g++ --version
g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0

I'm not export in C++ compilation, but perhaps -c flag seems required here:

g++ -Wall -o build/BiggestUnInt src/BiggestUnInt.cc
g++ -Wall -o build/HelloWorld src/HelloWorld.cpp
g++ -Wall -o build/SimpleClass src/SimpleClass.cc

Sonar report post 400 error

Please help for the below error.. since i am running the sonar-scanner command directly on jenkins machine it works and genrates sonar reports to sonar dashboard, but its not happening in jenkins pipelin.. it throw below error...

0:56:07.723 DEBUG: Upload report
20:56:07.782 DEBUG: POST 400 http://xx.xx.xx.xx:9000/api/ce/submit?projectKey=stage-project-admin-Dsonar.projectName%3DGD-admin-Dsonar.language%3Dts-Dsonar.sources%3D%2Fhome%2Fjenkins%2Fworkspace%2Fstage-branch-admin%2Fdist%2Fproject-admin%2F-Dsonar.tests%3D%2Fhome%2Fjenkins%2Fworkspace%2Fstage-branch-admin%2Fdist%2Fproject-admin%2F | time=58ms
20:56:07.790 DEBUG: eslint-bridge server will shutdown
20:56:07.958 DEBUG: stylelint-bridge server will shutdown
20:56:07.961 INFO: ------------------------------------------------------------------------
20:56:07.961 INFO: EXECUTION FAILURE
20:56:07.961 INFO: ------------------------------------------------------------------------
20:56:07.961 INFO: Total time: 1:22.233s
20:56:08.103 INFO: Final Memory: 33M/1424M

SonarLint_2.1 has bug

sonarLint for eclipse
java file , *.java ,
When the Chinese symbol appears in the code, the plug-in crashes;

Java code:

public class Test {

public static void main(String[] args) {
	System.out.println("test:");
}

}

errorMsg:

Index files
1 files indexed
Configured Java source version (sonar.java.source): 7
JavaClasspath initialization...
JavaClasspath initialization done: 2 ms
JavaTestClasspath initialization...
JavaTestClasspath initialization done: 2 ms
Java Main Files AST scan...
1 source files to be analyzed
Java Main Files AST scan done: 24 ms
1/1 source files have been analyzed
Java bytecode scan...
Java bytecode scan done: 5 ms
Java Test Files AST scan...
0 source files to be analyzed
Java Test Files AST scan done: 0 ms
Package design analysis...
0/0 source files have been analyzed
Package design analysis done: 0 ms
Index files
1 files indexed
Configured Java source version (sonar.java.source): 7
JavaClasspath initialization...
JavaClasspath initialization done: 2 ms
JavaTestClasspath initialization...
JavaTestClasspath initialization done: 1 ms
Java Main Files AST scan...
1 source files to be analyzed
Unable to parse source file : E:\TEST\work_21\test21\src\com\baidu\disconf\web\web\config\controller\Test.java
Parse error at line 6 column 22:

1: package com.baidu.disconf.web.web.config.controller;
2:
3: public class Test {
4:
5: public static void main(String[] args) {
6: System.out.println("test锛�);
^
7: }
8: }
9:

Java Main Files AST scan done: 3 ms
Java bytecode scan...
Java bytecode scan done: 2 ms
Java Test Files AST scan...
0 source files to be analyzed
Java Test Files AST scan done: 1 ms
Package design analysis...
Package design analysis done: 0 ms
0/0 source files have been analyzed
1/1 source files have been analyzed

Imported coverage data for 0 files

I get the below logs. I have checked that sonarqube-generic-coverage.xml is generated successfully. I am not sure why sonar is treating them as unknown files.

INFO: Source paths: IDKit/Source
▸ INFO: Source encoding: UTF-8, default locale: en_US
▸ INFO: Load server rules
▸ INFO: Load server rules (done) | time=150ms
▸ WARN: Property 'sonar.abap.file.suffixes' is not declared as multi-values/property set but was read using 'getStringArray' method. The SonarQube plugin declaring this property should be updated.
▸ INFO: Language is forced to swift
▸ INFO: Index files
▸ WARN: File '/private/var/slaveadmin/bamboo-agent-home/xml-data/build-dir/dir/IDKit/Source/IDKit.h' is ignored because it doesn't belong to the forced language 'swift'
▸ INFO: 350 files indexed
▸ INFO: Quality profile for swift: Sonar way
▸ INFO: Sensor Generic Coverage Report
▸ INFO: Parsing /private/var/slaveadmin/bamboo-agent-home/xml-data/build-dir/dir/reports/sonar-generic-coverage.xml
▸ INFO: Imported coverage data for 0 files
▸ INFO: Coverage data ignored for 290 unknown files, including:
▸ /var/slaveadmin/bamboo-agent-home/xml-data/build-dir/dir/IDKit/Source/Analytics/Analytics.swift

Can you please suggest?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.