diff --git a/sonar-project.properties b/sonar-project.properties index 6c29fc3c..3ab432bc 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -13,6 +13,17 @@ sonar.newCode.referenceBranch=stable-5 sonar.exclusions=tests/**,.tox/** +# Exclude test code from copy/paste detection. 'sonar.exclusions' above only +# filters the *source* set (it disambiguates 'sonar.sources=.' from +# 'sonar.tests'), so test files are still indexed as tests and still scored for +# duplication. Unit tests here are unittest.TestCase classes: every class needs +# its own setUp, and per-case arrange/assert blocks are deliberately repeated so +# a failing test reads on its own. Because SonarCloud scores only *new code* on +# a pull request, any PR adding cases to an already-repetitive test module +# inherits duplication accrued across earlier PRs. Production code under +# plugins/ stays fully covered by duplication analysis. +sonar.cpd.exclusions=tests/** + # Ansible module argument_spec is conventionally defined with the dict(...) # constructor (not {...} literals) for readability and consistency across the # collection. Suppress python:S7498 ("prefer literal syntax"), which conflicts