Sonar scanner got errors in parsing python code with unicode attributes


(variables in brackets will be replaced in runtime)

-Dsonar.python.pylint.reportPath=pylintout.txt -Dsonar.python.coverage.reportPaths=coverage.xml 

got error:

 ERROR: Unable to parse file: flashcard/solution/
 ERROR: Parse error at line 17 column 61:
    16:     shop_id = db.Column(db.Integer, db.ForeignKey(""))
   -->      _solution, solution = EnumField("solution", ChatSolution.禁用)
    18:     _step, step = EnumField("step", default=Steps.RDS)
    19:     _config, config = JsonField("config", default_fn=lambda

It seems that all references with unicode attribute names will cause errors.

And, what confuses me, that I’ve give the coverage file coverage.xml, but why the scanner still need to parse the source files?

Hi @Craynic_Cai,

Welcome to our community.
We are aware of this bug and we plan to fix it before next release (v2.8), expected next week.

SonarPython needs to parse files not only for executing rules, but as well to provide syntax highlighting, symbol highlighting and other features available in SonarQube/SonarCloud.