uartois / sonar-golang

Sonarqube plugin for the golang language.
GNU Lesser General Public License v3.0
245 stars 32 forks source link

Sonar Scanner is failing saying XML file is not correctly formatted for golang plugin and not displaying results in sonarqube #70

Open Subhajit-Dutta opened 6 years ago

Subhajit-Dutta commented 6 years ago

Description

I am getting below error

NFO: Analyse for /home/dca-cm/coverage.xml [Fatal Error] coverage-04.dtd:1:3: The markup declarations contained or pointed to by the document type declaration must be well-formed. ERROR: Exception: org.xml.sax.SAXParseException: The markup declarations contained or pointed to by the document type declaration must be well-formed.

I have verified coverage.xml in https://www.xmlvalidation.com and found no issue

sonar-golang-plugin-1.2.11----------> Golang plugin sonarqube-6.3.1-----------------------> Sonarqube server

Subhajit-Dutta commented 6 years ago

coverage.docx

Sharing Coverage.xml for reference

Subhajit-Dutta commented 6 years ago

error-golang.txt Here is the log of sonar scanner

thibaultfalque commented 6 years ago

Hi, It's very strange what is this file coverage.docx ? It is not the coverage report ? There are HTML and Go code. Could you share the report generate by gocov test ./... | gocov-xml > coverage.xml ? See this part of readme for more details.

Subhajit-Dutta commented 5 years ago

reports.zip I had shared the coverage.xml and test .xml Surprising if i delete below lines the above error got vanished

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">

this is my sonar-project.properties file

sonar.projectKey=xxxx sonar.projectName=xxxx sonar.projectVersion=1.0

GoLint report path, default value is report.xml

sonar.golint.reportPath=report.xml

Cobertura like coverage report path, default value is coverage.xml

sonar.coverage.reportPath=coverage.xml

if you want disabled the DTD verification for a proxy problem for example, true by default

sonar.coverage.dtdVerification=false

JUnit like test report, default value is test.xml

sonar.test.reportPath=test.xml sonar.sources=./ sonar.tests=./ sonar.test.inclusions=/_test.go sonar.sources.inclusions=/.go sonar.highlighting=false sonar.showProfiling=true sonar.log.level=DEBUG sonar.exclusions=vendor/,proto/,proto_python/,.git/, /*test.go, */.xml, /.py, testutils/, /.js


I can't see any errors in my log but neither coverage report nor unit test case reports getting displayed

thibaultfalque commented 5 years ago

Hello @Subhajit-Dutta, Could you try disabling the DTD check?