which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
We are using sonarqube from Azure devops
I want to include only **/*transform.py pattern files in code coverage of each folder on Sonarqube .
what have you tried so far to achieve this
I am able to achieve this using sonar.exclusions property but code smells and other metrics are not visible for my other code. Please let me if there is any way with which i can get code coverage for **/*transform.py files and all other metrics for all files.
In Sonarqube project, coverage of folder is reduced due to other files. Could you please tell me a way so that coverage includes only /*transform.py files? Below is code that i am using
extraProperties: |
sonar.python.coverage.reportPaths=combined-coverage.xml
sonar.sources=DataEngineering/
sonar.inclusions=/transform.py
sonar.tests=DataEngineering/
sonar.test.inclusions=DataEngineering/Test/*
sonar.text.excluded.file.suffixes=.csv, .xml
sonar.dynamicAnalysis=reuseReports
sonar.core.codeCoveragePlugin=cobertura
sonar.sourceEncoding=UTF-8
sonar.python.version=3.8
sonar.qualitygate.wait=true
sonar.qualitygate.timeout=300
My purpose is to get code coverage on files with pattern *transform.py and other metrics like code smells must be visible for whole codebase. Currently using above code, i am not getting other metrics for whole codebase.
To be perfectly honest, including files for code coverage is something we haven’t ever considered, since these should really be an exception.
You could consider having two separate SonarQube projects – one with everything except your transform.py files (and excluding all files from code coverage), and one with just your transform.py files.
Can we introduce ! flag in wildcard file patterns which we can use in sonar.coverage.exclusions to exclude required files which are not matching *transform.py pattern?
Can you please confirm incremental analysis on Sonar?(incremental analysis means if we publish report for incremental changes then will sonar analysis of other unchanged files will be removed or not)
Suppose there are folder structure as mentioned below
Folder1
→ Folder2
→ Folder3
→ Folder4
In my first SonarQube analysis on Folder1, all metrics are visible for above folders.
If i do SonarQube analysis on path Folder1/Folder2 only then will it delete older analysis of other folder or it will update analysis of path Folder1/Folder2 only??
This is not possible, no. To achieve something like this you would probably have to create two projects as a monorepo (each excluding the folders from the other) and then aggregate the two under an application.
Note that monorepos are only available from Entreprise edition.
Product: SonarQube
Version: 10.4.1
Language: Python
I am using azure devops pipeline and in azure devops pipeline, below task are being used
SonarQubePrepare@5
SonarQubeAnalyze@5
SonarQubePublish@5
I got the issue.
In analyze scope settings, i am trying to deactivate python:S1192 rule to ignore code smells and second thing, i am trying to ignore code lines starting with # MAGIC and # MAGIC %md in code smells. These settings were not set properly due to which it is giving issue.
Could you please guide me how can i achieve above things?