Closed goz closed 7 years ago
Hi, Thanks for your feedback.
I have tried to execute in preview mode with this parameter:
sonar.analysis.mode=preview
sonar.issuesReport.console.enable=true
the first time I did not have error because I did not have new issues.
the second time, I had new issue for test and the issue is showing.
I hope will help you. Regards.
I didn't get any issues, but when I run golint manually it reports some issues, and also report.xml showing some errors.
Here is my environment :
my sonar-project.properties file :
sonar.projectKey=key
sonar.projectName=Service
sonar.projectVersion=1.0
sonar.sources=./
sonar.exclusions=./vendor/**,./src/github.com/alecthomas/**
sonar.analysis.mode=preview
sonar.golint.reportPath=./report.xml
sonar.issuesReport.console.enable=true
sonar.github.oauth=xxx
sonar.github.repository=x/y
sonar.github.pullRequest={ghprbPullId}
report.xml
<?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="5.0">
<file name="digital.go">
<error column="2" line="16" message="exported const ConfigName should have comment (or a comment on this block) or be unexported" severity="warning" source="golint"></error>
<error column="9" line="8" message="could not import github.com/spf13/viper (can't find import: github.com/mataharimall/digital/vendor/github.com/spf13/viper)" severity="error" source="gotype"></error>
<error column="2" line="9" message="could not import github.com/maps90/go-core (can't find import: github.com/mataharimall/digital/vendor/github.com/maps90/go-core)" severity="error" source="gotype"></error>
<error column="9" line="10" message="could not import github.com/maps90/go-core/log (can't find import: github.com/mataharimall/digital/vendor/github.com/maps90/go-core/log)" severity="error" source="gotype"></error>
<error column="2" line="11" message="could not import github.com/mataharimall/digital/app/baznas (can't find import: github.com/mataharimall/digital/app/baznas)" severity="error" source="gotype"></error>
<error column="40" line="14" message="undeclared name: core" severity="error" source="gotype"></error>
<error column="40" line="31" message="undeclared name: core" severity="error" source="gotype"></error>
<error column="6" line="21" message="undeclared name: config" severity="error" source="gotype"></error>
<error column="2" line="24" message="undeclared name: core" severity="error" source="gotype"></error>
<error column="2" line="25" message="undeclared name: logger" severity="error" source="gotype"></error>
<error column="14" line="25" message="undeclared name: config" severity="error" source="gotype"></error>
<error column="46" line="25" message="undeclared name: config" severity="error" source="gotype"></error>
<error column="26" line="28" message="undeclared name: baznas" severity="error" source="gotype"></error>
<error column="7" line="43" message="undeclared name: core" severity="error" source="gotype"></error>
<error column="12" line="48" message="undeclared name: config" severity="error" source="gotype"></error>
<error column="11" line="49" message="undeclared name: config" severity="error" source="gotype"></error>
<error column="60" line="24" message="error return value not checked (core.NewConfiguration(ConfigName, ConfigPath).ReadInConfig())" severity="warning" source="errcheck"></error>
<error column="8" line="45" message="error return value not checked (route(r))" severity="warning" source="errcheck"></error>
</file>
</checkstyle>
I run this via Jenkins, trying to automate coding style. Any idea?
Thanks
AFAIK, the plugin should report 3 issues:
<error column="2" line="16" message="exported const ConfigName should have comment (or a comment on this block) or be unexported" severity="warning" source="golint"></error>
<error column="60" line="24" message="error return value not checked (core.NewConfiguration(ConfigName, ConfigPath).ReadInConfig())" severity="warning" source="errcheck"></error>
<error column="8" line="45" message="error return value not checked (route(r))" severity="warning" source="errcheck"></error>
The remaining errors are issues with the tools which cannot access some code.
@thibaultfalque do we support them?
@danielleberre Yes, I have checked the rules and I support this error for "errcheck" . I added acceptance tests for this messages.
@gozali The Sonarqube documentation say:
When running an analysis in preview or incremental mode, the SonarQube platform provides the ability to generate a report of issues so developers can see whether they're about to inject new technical debt before submitting their new code. This way, they can make sure they're not committing code with new issues, and therefore that no new technical debt will be reported on the SonarQube server after the next full analysis.
So I think Sonarqube have register this violations and output "no new issue" because there is not new issue in the code since the last analysis. But if you run "gometalinter" or "golint" they are showing "errors" because there is not notion of history and quality.
finally I figure it out, I should fix the path and scan only go files. thanks @thibaultfalque @danielleberre
Actually this is not an issue but more like a question. I'm trying to running an analysis in preview mode but somehow I didn't get anything. Is preview mode not supported yet?
Thanks