New scan is overiding coverage of previous scan though scan is on unique paths

Team,
I have Mainrepo that has 10services under one project.

ProjectA has 10Teams and each team has its own product.
so structure is like
ProjectA > Team1, Team2, Team10
Team1 = src/services/team1
Team2 = src/services/team2
Team10 = src/services/team10

so my sonar scan everytime it is running is replacing the coverage of previous team. can this be handled that scan is only update and not replace of the code coverage?

sonar properties i have is below

#----- Default SonarQube server
sonar.projectVersion=v1
sonar.branch.name=main
sonar.branch.version=v1
sonar.projectKey=Main_Prod
sonar.projectName=Main
sonar.login=xxxxx
#----- Default source code encoding
#sonar.sourceEncoding=UTF-8

#coverage reports
sonar.python.xunit.reportPath=coverage.xml
sonar.python.coverage.reportPaths=coverage.xml

#Exclusions
# Define the same root directory for sources and tests
sonar.sources = src/
sonar.tests = src/

# Include test subdirectories in test scope
sonar.test.inclusions = src/**/test/**/*

# Exclude test subdirectories from source scope
sonar.exclusions = src/**/test/**/*, src/services/**/*test.*, src/services/**/*.tf
#sonar.exclusions=src/services/**/*.tf
sonar.c.file.suffixes=-
sonar.cpp.file.suffixes=-
sonar.objc.file.suffixes=-

scanner command is this

for team in ${team_list}; do
          generate_coverage()
          sonar-scanner \
          -Dsonar.sources=src/services/$team/ \
          -Dsonar.coverageReportPaths=coverage.xml

note: generate_coverage() is a function that creates coverage.xml that is unique per team.

so above loop runs the scans for each team uniquely.

Hey there.

The answer is probably the same as for your other post – which is to use entirely separate SonarQube projects for each team.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.