How to view MyPy report from SonarQube UI

Must-share information (formatted with Markdown):

SonarQube version : Community Build v25.2.0.102705 MQR Mode

SonarQube is deployed using Helm

In our CI job, we are importing our mypy report so SonarQube with -Dsonar.python.mypy.reportPaths=mypy-report.txt, but I just can’t find it in the UI. Our SonarQube instance only reports SonarQube issues in the UI, not MyPy’s.

I searched through the forum for explanation, and there are a few posts mentioning MyPy with SonarCloud.

There is also this documentation page mentioning how to import a report (but not where to visualize it): Importing third-party issues | SonarQube Community Build Documentation

Here is the log extract from our CI

e[32;1m$ sonar-scanner -Dsonar.host.url="${SONAR_HOST_URL}" -Dsonar.qualitygate.wait=true -Dsonar.projectKey="${SONAR_PROJECT_KEY}" -Dsonar.projectBaseDir="${SONAR_PROJECT_BASE_DIR}" -Dsonar.sources="${SONAR_SOURCES}" -Dsonar.log.level="${SONAR_LOG_LEVEL}" -Dsonar.projectVersion="${SONAR_PROJECT_VERSION}" -Dsonar.projectDescription="${SONAR_PROJECT_DESCRIPTION}" -Dsonar.python.version="${SONAR_PYTHON_VERSION}" -Dsonar.python.ruff.reportPaths="${RUFF_REPORT_FILE}" -Dsonar.python.mypy.reportPaths="${MYPY_REPORT_FILE}"e[0;m
11:50:24.742 INFO  Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
11:50:24.749 INFO  Project root configuration file: NONE
11:50:24.778 INFO  SonarScanner CLI 7.1.0.4889
11:50:24.781 INFO  Java 17.0.14 Amazon.com Inc. (64-bit)
11:50:24.783 INFO  Linux 6.1.129-138.220.amzn2023.x86_64 amd64
11:50:24.865 INFO  User cache: /builds/papai/ml/papai-ml/.sonar/cache
11:50:27.022 INFO  Communicating with SonarQube Community Build 25.2.0.102705
11:50:27.024 INFO  JRE provisioning: os[linux], arch[x86_64]
11:50:27.876 INFO  Starting SonarScanner Engine...
11:50:27.877 INFO  Java 17.0.13 Eclipse Adoptium (64-bit)
11:50:30.304 INFO  Load global settings
11:50:30.770 INFO  Load global settings (done) | time=466ms
11:50:30.776 INFO  Server id: 44A2E948-AZUi2SBN8iqoX12JCxi_
11:50:30.795 INFO  Loading required plugins
11:50:30.796 INFO  Load plugins index
11:50:30.844 INFO  Load plugins index (done) | time=49ms
11:50:30.844 INFO  Load/download plugins
11:50:30.963 INFO  Load/download plugins (done) | time=119ms
11:50:31.657 INFO  Process project properties
11:50:31.693 INFO  Process project properties (done) | time=36ms
11:50:31.710 INFO  Project key: [MASKED]
11:50:31.713 INFO  Base dir: /builds/papai/ml/papai-ml
11:50:31.715 INFO  Working dir: /builds/papai/ml/papai-ml/.scannerwork
11:50:31.727 INFO  Load project settings for component key: '[MASKED]'
11:50:31.782 INFO  Load project settings for component key: '[MASKED]' (done) | time=52ms
11:50:31.834 INFO  Load quality profiles
11:50:31.948 INFO  Load quality profiles (done) | time=113ms
11:50:31.971 INFO  Auto-configuring with CI 'Gitlab CI'
11:50:32.013 INFO  Load active rules
11:50:32.460 INFO  Load active rules (done) | time=451ms
11:50:32.470 INFO  Load analysis cache
11:50:32.705 INFO  Load analysis cache | time=236ms
11:50:32.811 INFO  Preprocessing files...
11:50:33.609 INFO  4 languages detected in 422 preprocessed files
11:50:33.610 INFO  0 files ignored because of scm ignore settings
11:50:33.614 INFO  Loading plugins for detected languages
11:50:33.614 INFO  Load/download plugins
11:50:33.629 INFO  Load/download plugins (done) | time=15ms
11:50:33.909 INFO  Load project repositories
11:50:34.178 INFO  Load project repositories (done) | time=268ms
11:50:34.218 INFO  Indexing files...
11:50:34.220 INFO  Project configuration:
11:50:34.293 INFO  422 files indexed
11:50:34.297 INFO  Quality profile for docker: Sonar way
11:50:34.298 INFO  Quality profile for json: Sonar way
11:50:34.299 INFO  Quality profile for py: Sonar way
11:50:34.301 INFO  Quality profile for yaml: Sonar way
11:50:34.301 INFO  ------------- Run sensors on module [MASKED]
11:50:34.403 INFO  Load metrics repository
11:50:34.466 INFO  Load metrics repository (done) | time=62ms
11:50:35.568 INFO  Sensor JaCoCo XML Report Importer [jacoco]
11:50:35.570 INFO  'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
11:50:35.571 INFO  No report imported, no coverage information will be imported by JaCoCo XML Report Importer
11:50:35.573 INFO  Sensor JaCoCo XML Report Importer [jacoco] (done) | time=3ms
11:50:35.574 INFO  Sensor IaC CloudFormation Sensor [iac]
11:50:35.617 INFO  0 source files to be analyzed
11:50:35.629 INFO  0/0 source files have been analyzed
11:50:35.631 INFO  Sensor IaC CloudFormation Sensor [iac] (done) | time=59ms
11:50:35.631 INFO  Sensor IaC Kubernetes Sensor [iac]
11:50:35.748 INFO  0 source files to be parsed
11:50:35.748 INFO  0/0 source files have been parsed
11:50:35.754 INFO  0 source files to be analyzed
11:50:35.755 INFO  0/0 source files have been analyzed
11:50:35.756 INFO  0 source files to be checked
11:50:35.761 INFO  0/0 source files have been checked
11:50:35.762 INFO  Sensor IaC Kubernetes Sensor [iac] (done) | time=126ms
11:50:35.763 INFO  Sensor IaC AzureResourceManager Sensor [iac]
11:50:35.912 INFO  0 source files to be analyzed
11:50:35.913 INFO  0/0 source files have been analyzed
11:50:35.914 INFO  Sensor IaC AzureResourceManager Sensor [iac] (done) | time=157ms
11:50:35.914 INFO  Sensor Java Config Sensor [iac]
11:50:35.939 INFO  0 source files to be analyzed
11:50:35.940 INFO  0/0 source files have been analyzed
11:50:35.941 INFO  Sensor Java Config Sensor [iac] (done) | time=26ms
11:50:35.942 INFO  Sensor Python Sensor [python]
11:50:36.024 INFO  Starting global symbols computation
11:50:36.027 INFO  377 source files to be analyzed
11:50:46.028 INFO  281/377 files analyzed, current file: src/explanation/global_interpretability/tree_based/surrogate/tree_representation.py
11:50:47.832 INFO  377/377 source files have been analyzed
11:50:48.018 INFO  Starting rules execution
11:50:48.019 INFO  377 source files to be analyzed
11:50:58.019 INFO  80/377 files analyzed, current file: src/models/model_builder.py
11:51:08.019 INFO  213/377 files analyzed, current file: src/models/custom_model.py
11:51:16.908 INFO  377/377 source files have been analyzed
11:51:16.909 INFO  The Python analyzer was able to leverage cached data from previous analyses for 0 out of 377 files. These files were not parsed.
11:51:16.912 INFO  Sensor Python Sensor [python] (done) | time=40970ms
11:51:16.912 INFO  Sensor Cobertura Sensor for Python coverage [python]
11:51:16.973 INFO  Sensor Cobertura Sensor for Python coverage [python] (done) | time=61ms
11:51:16.973 INFO  Sensor PythonXUnitSensor [python]
11:51:17.009 INFO  Sensor PythonXUnitSensor [python] (done) | time=36ms
11:51:17.010 INFO  Sensor Import of Mypy issues [python]
11:51:17.012 INFO  Sensor Import of Mypy issues [python] (done) | time=3ms
11:51:17.013 INFO  Sensor Import of Ruff issues [python]
11:51:17.013 INFO  Importing /builds/papai/ml/papai-ml/ruff-report.json
11:51:17.025 INFO  Sensor Import of Ruff issues [python] (done) | time=12ms
11:51:17.026 INFO  Sensor JavaScript inside YAML analysis [javascript]
11:51:17.040 INFO  No input files found for analysis
11:51:17.042 INFO  Hit the cache for 0 out of 0
11:51:17.042 INFO  Miss the cache for 0 out of 0
11:51:17.043 INFO  Sensor JavaScript inside YAML analysis [javascript] (done) | time=17ms
11:51:17.045 INFO  Sensor CSS Rules [javascript]
11:51:17.047 INFO  No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
11:51:17.048 INFO  Sensor CSS Rules [javascript] (done) | time=2ms
11:51:17.048 INFO  Sensor IaC Docker Sensor [iac]
11:51:17.102 INFO  1 source file to be analyzed
11:51:17.291 INFO  1/1 source file has been analyzed
11:51:17.292 INFO  Sensor IaC Docker Sensor [iac] (done) | time=247ms
11:51:17.292 INFO  Sensor TextAndSecretsSensor [text]
11:51:17.292 INFO  Available processors: 8
11:51:17.293 INFO  Using 8 threads for analysis.
11:51:17.893 INFO  The property "sonar.tests" is not set. To improve the analysis accuracy, we categorize a file as a test file if any of the following is true:
  * The filename starts with "test"
  * The filename contains "test." or "tests."
  * Any directory in the file path is named: "doc", "docs", "test" or "tests"
  * Any directory in the file path has a name ending in "test" or "tests"

11:51:17.922 INFO  Using git CLI to retrieve untracked files
11:51:17.925 WARN  Analyzing only language associated files, make sure to run the analysis inside a git repository to make use of inclusions specified via "sonar.text.inclusions"
11:51:17.995 INFO  383 source files to be analyzed
11:51:18.680 INFO  383/383 source files have been analyzed
11:51:18.682 INFO  Sensor TextAndSecretsSensor [text] (done) | time=1390ms
11:51:18.689 INFO  ------------- Run sensors on project
11:51:18.880 INFO  Sensor Zero Coverage Sensor
11:51:19.001 INFO  Sensor Zero Coverage Sensor (done) | time=124ms
11:51:19.141 INFO  CPD Executor 59 files had no CPD blocks
11:51:19.141 INFO  CPD Executor Calculating CPD for 318 files
11:51:19.476 INFO  CPD Executor CPD calculation finished (done) | time=334ms
11:51:19.490 INFO  SCM revision ID '[MASKED]'
11:51:19.913 INFO  Analysis report generated in 358ms, dir size=5.4 MB
11:51:21.139 INFO  Analysis report compressed in 1220ms, zip size=3.2 MB
11:51:21.541 INFO  Analysis report uploaded in 403ms
11:51:21.546 INFO  ------------- Check Quality Gate status
11:51:21.547 INFO  Waiting for the analysis report to be processed (max 300s)
11:51:31.974 ERROR QUALITY GATE STATUS: FAILED - View details on [MASKED]/dashboard?id=[MASKED]
11:51:32.531 INFO  EXECUTION FAILURE
11:51:32.535 INFO  Total time: 1:07.798s

Hey @MarcBresson!

mypy reports are indeed supported.

I’ve just tested it out and it works fine on my end. Here’s a small sample project.

mypyexample.zip (2.2 KB)

Does it work for you? Do you notice anything different between your project and this one?

Thank you for your answer!

On my side, I have no “MyPy” tag at all as shown in the image below.

For reference, I’m expecting ~700 MyPy errors :upside_down_face:.

In addition to uploading the external report, is there any more configuration to do?

No, there’s no additional configuration required! I wouldn’t expect these issues to be tagged mypy – they aren’t on my side.

Did you try analyzing the sample project I uploaded?

My bad, I interpreted


as tags.

The analysis is locked behind doors, I’m gonna try to run one myself on your sample project to see what s going on.

Thank you very much for your help.

By the way, I believe a screenshot of how third-party issues are supposed to look like in the doc would be nice :slight_smile: