Title: Fix SonarQube double indexing in flat layout by excluding tests from sources by Copilot · Pull Request #1091 · usethis-python/usethis-python · GitHub
Open Graph Title: Fix SonarQube double indexing in flat layout by excluding tests from sources by Copilot · Pull Request #1091 · usethis-python/usethis-python
X Title: Fix SonarQube double indexing in flat layout by excluding tests from sources by Copilot · Pull Request #1091 · usethis-python/usethis-python
Description: Analyze the current SonarQube configuration code
Modify get_sonar_project_properties() to automatically exclude tests/* when using flat layout (sources=./)
Add regression tests for flat layout with and without custom exclusions
Run existing tests to ensure no regressions (16/16 SonarQube tests pass)
Code review completed and feedback addressed
Removed redundant list() cast on line 67
Added comment to clarify TypeAdapter(list).validate_python() returns a list
Changed from append to prepend (insert at index 0) for exclusion
Changed exclusion syntax from ./tests to tests/* for proper SonarQube pattern matching
Type checking passed (pyright: 0 errors, 0 warnings)
Linting passed (ruff: all checks passed)
Summary
Fixed SonarQube configuration to properly exclude the tests directory when using flat layout to prevent double indexing. The fix ensures that sonar.sources and sonar.tests directories are disjoint by prepending tests/* to the exclusions list. Updated based on PR feedback to use the correct SonarQube exclusion pattern syntax (tests/* instead of ./tests).
Fixes #1090
Original prompt
This section details on the original issue you should resolve
Open Graph Description: Analyze the current SonarQube configuration code Modify get_sonar_project_properties() to automatically exclude tests/* when using flat layout (sources=./) Add regression tests for flat layout wi...
X Description: Analyze the current SonarQube configuration code Modify get_sonar_project_properties() to automatically exclude tests/* when using flat layout (sources=./) Add regression tests for flat layout wi...
Opengraph URL: https://github.com/usethis-python/usethis-python/pull/1091
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:9080ff54-a629-e54b-3a67-6ba6906aa0db |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | D8AC:1ED3:4BE205:626878:6A4D8D92 |
| html-safe-nonce | 9fbf1e4af3cae481b0fe9f65e665feb51861dea2b6cf1eeeb2d65330cdf04a31 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOEFDOjFFRDM6NEJFMjA1OjYyNjg3ODo2QTREOEQ5MiIsInZpc2l0b3JfaWQiOiIzODY0MTAwODA0MzI4NTI1MjAyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d140e3299983bc5fbea1dc3401b7cc2eaaec5a83cfc9a3977a0d56169856867d |
| hovercard-subject-tag | pull_request:2979961774 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/usethis-python/usethis-python/pull/1091/files |
| twitter:image | https://avatars.githubusercontent.com/in/1143301?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/in/1143301?s=400&v=4 |
| og:image:alt | Analyze the current SonarQube configuration code Modify get_sonar_project_properties() to automatically exclude tests/* when using flat layout (sources=./) Add regression tests for flat layout wi... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 06b8a6144231bf3a234f1c2e9993861e07ce98a905912b114aa386c2d7e84b33 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/usethis-python/usethis-python git https://github.com/usethis-python/usethis-python.git |
| octolytics-dimension-user_id | 216362695 |
| octolytics-dimension-user_login | usethis-python |
| octolytics-dimension-repository_id | 842189705 |
| octolytics-dimension-repository_nwo | usethis-python/usethis-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 842189705 |
| octolytics-dimension-repository_network_root_nwo | usethis-python/usethis-python |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 74e2a9c78f1e38588de4f25885878349d721eedf |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width