Sonar scanner got errors in parsing python code with unicode attributes

sonar-scanner 4.2.0.1873

command:
(variables in brackets will be replaced in runtime)

sonar-scanner 
-Dsonar.projectKey=gitlab-{CI_PROJECT_ID} 
-Dsonar.projectName={CI_PROJECT_NAMESPACE}/{CI_PROJECT_NAME} 
-Dsonar.projectVersion={CI_COMMIT_SHA} 
-Dsonar.language=py 
-Dsonar.python.pylint.reportPath=pylintout.txt -Dsonar.python.coverage.reportPaths=coverage.xml 
-Dsonar.sources=some_folder 
-Dsonar.pullrequest.key={CI_MERGE_REQUEST_IID} 
-Dsonar.pullrequest.branch={CI_COMMIT_REF_NAME} 
-Dsonar.pullrequest.base={CI_MERGE_REQUEST_TARGET_BRANCH_NAME} 
-Dsonar.pullrequest.gitlab.repositorySlug={CI_PROJECT_ID}

got error:

 ERROR: Unable to parse file: flashcard/solution/models.py
 ERROR: Parse error at line 17 column 61:
    15: 
    16:     shop_id = db.Column(db.Integer, db.ForeignKey("shop.id"))
   -->      _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.