我有:
Sonarqube server: 6.7.5 based on Windows Server 2016
Sonar swift plugin: 0.4.2
Scanner on MAC OS X: 3.3.0.1492
一切都很好,但是在sonar-scanner
执行过程的最后,我看到了错误:
java.io.IOException: Cannot run program "git" (in directory "/usr/local/bin"): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at org.eclipse.jgit.util.FS.readPipe(FS.java:500)
at org.eclipse.jgit.util.FS.readPipe(FS.java:464)
at org.eclipse.jgit.util.FS.discoverGitSystemConfig(FS.java:613)
at org.eclipse.jgit.util.FS.getGitSystemConfig(FS.java:653)
at org.eclipse.jgit.util.SystemReader$Default.openSystemConfig(SystemReader.java:99)
at org.eclipse.jgit.internal.storage.file.FileRepository.<init>(FileRepository.java:181)
at org.eclipse.jgit.lib.BaseRepositoryBuilder.build(BaseRepositoryBuilder.java:580)
at org.sonarsource.scm.git.JGitBlameCommand.buildRepository(JGitBlameCommand.java:76)
at org.sonarsource.scm.git.JGitBlameCommand.blame(JGitBlameCommand.java:55)
at org.sonar.scanner.scm.ScmPublisher.publish(ScmPublisher.java:85)
at org.sonar.scanner.phases.PublishPhaseExecutor.afterSensors(PublishPhaseExecutor.java:60)
at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:90)
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:185)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:137)
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)
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 39 common frames omitted
由于run-sonar-swift.sh
的工作,我在sonar-reports
目录中:
total 72816
-rw-r--r-- 1 admin staff 2587363 Mar 21 22:21 .-oclint.xml
-rw-r--r-- 1 admin staff 860879 Mar 21 22:13 .-swiftlint.txt
-rw-r--r-- 1 admin staff 723424 Mar 21 22:14 .-tailor.txt
-rw-r--r-- 1 admin staff 41789 Mar 21 22:13 TEST-report.xml
-rw-r--r-- 1 admin staff 11496916 Mar 21 22:13 coverage-swift.xml
-rw-r--r-- 1 admin staff 4778797 Mar 21 22:21 lizard-report.xml
-rw-r--r-- 1 admin staff 16407860 Mar 21 22:12 xcodebuild.log
在sonar-project.properties
中:
sonar.projectKey=myproject
sonar.projectName=myproject
sonar.projectVersion=1.0
sonar.projectDescription=myproject
sonar.sources=.
sonar.host.url=https://sonarqube.example.com
sonar.login=my_token
sonar.swift.project=myproject.xcodeproj
sonar.swift.workspace=myproject.xcworkspace
sonar.swift.appScheme=SmartScheme
sonar.swift.simulator=platform=iOS Simulator,name=iPhone 8,OS=latest
sonar.sourceEncoding=UTF-8
结果我看到:
一切都很好,但是我没有在SonarQube的Web界面中看到Bug和漏洞。 您能帮我吗,哪个报告应该会生成错误和漏洞。我哪里出错了?