Yanl file with same syntax issue doesn't get same sonar error report

We use sonar maven plugin to check yaml files, but files with same syntax error doesn’t get same error report.

for example:
Two files, both have same indentation error, but we only get sonar issue for one file.

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube 8.9.6, Yaml Analyzer 1.6.0, sonar-maven-plugin:3.9.0.2155.
  • what are you trying to achieve
    run sonar check by maven plugin. “mvn sonar:sonar -Dsonar.analysis.mode=publish -Dsonar.pullrequest.base=master”
  • what have you tried so far to achieve this
    Try maven command with option “-X”, and check the log.
    The yaml analyzer has find the error in files, but it doesn’t show in sonar server.
    Try yaml analayzer project, run UT with files, and it could find the indentation issue.
    So I guess sonar-maven-plugin ignore some issue for files. But I don’t know why and how to check the logs.

maven logs snippet:
[WARNING] Syntax error in file: values240.yaml
[WARNING] Cause: syntax error: expected <block end>, but found ‘<block mapping start>’ at line 26, column 12
[WARNING] Syntax error in file: values241.yaml
[WARNING] Cause: syntax error: expected <block end>, but found ‘<block mapping start>’ at line 26, column 12

But we could only get sonar issue for values241.yaml.

  1. Gerrit review for values240.yaml
  2. Gerrit review for values241.yaml

Could you help to check why it happens, how could we get debug log to maven sonar plugin to reposrt sonar issue?

Thank you!

Hey there.

You should reach out to the maintainers of GitHub - sbaudoin/sonar-yaml: SonarQube plugin to analyze YAML files, which is a community-supported plugin.

Hi Colin,
Thanks for reply.

But I already try the plugin and it already find the issue and report it to SensorContext.
The log is same with maven sonar plugin.
So I think this issue related to maven sonar plugin or something, not sonar-yaml plugin.

Here is the log print the error:
ParsingErrorCheck
Parse error: syntax error: expected <block end>, but found ‘<block mapping start>’

From it, you could find it already find the parsing error, but it doesn’t show in sonar server report.

These issues are raised by the rules the plugin is providing and that the scanner is executing – not the scanenr itself. I would really recommend raising an issue with the maintainer.

OK, thanks. Will check with plugin community.