From cfd9a46427ab5f60dc8b455931ed1e3ec35cc28e Mon Sep 17 00:00:00 2001 From: Byron Williams Date: Wed, 5 Aug 2026 21:09:26 -0700 Subject: [PATCH] fix(sonarcloud): declare all supported Python versions to Sonar sonar.python.version was 3.12, the single version CI builds with, while requires-python is ">=3.10,<3.15". SonarPython gates version-specific rules on ALL declared versions (PythonVersionUtils.areSourcePythonVersionsGreaterOrEqualThan is allMatch), so declaring only 3.12 satisfies every >=3.11 and >=3.12 gate and raises those rules against code that must still run on 3.10. No S6794/S6796 issue is open in SonarCloud today, so this is preventive: the misconfiguration fires the first time this codebase grows a construct one of those rules covers, and then reports something the project cannot act on without dropping 3.10. Sets the new sonar-python-version input (ByronWilliamsCPA/.github#291) and bumps the uses: pin to the commit that introduces it, since passing an input the callee does not declare fails a reusable workflow at startup. Also syncs sonar-project.properties, which CI overrides via -D but SonarLint in the IDE reads. python-version stays 3.12: it feeds actions/setup-python and is a separate concern from the versions the source must remain compatible with. Verified: actionlint rc=0; pre-commit scoped to the two changed files passes every hook that matches them. --- .github/workflows/sonarcloud.yml | 6 +++++- sonar-project.properties | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 8640eaf..8cca8db 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -32,8 +32,12 @@ permissions: jobs: sonarcloud: - uses: ByronWilliamsCPA/.github/.github/workflows/python-sonarcloud.yml@987d517d3c8e4b180f4dd15de6d9575f0df91182 # main + uses: ByronWilliamsCPA/.github/.github/workflows/python-sonarcloud.yml@4bd2d7c207a7fcf2dfcec8416c805d06d745c241 # main with: + # Every version requires-python (">=3.10,<3.15") admits, not just the build version. + # SonarPython gates version-specific rules on ALL declared versions, so declaring only + # 3.12 raises 3.11+ and 3.12+ rules against code that must still run on 3.10. + sonar-python-version: '3.10,3.11,3.12,3.13,3.14' # Repo uses hatchling; --no-build cannot install the editable root package no-build: false # Project ByronWilliamsCPA_python-libs lives in the byronwilliamscpa org diff --git a/sonar-project.properties b/sonar-project.properties index 5280e44..16edd70 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -23,8 +23,10 @@ sonar.tests=\ packages/gcs-utilities/tests/,\ packages/gemini-image/tests/ -# Python version -sonar.python.version=3.12 +# Versions the SOURCE supports, matching requires-python (">=3.10,<3.15"). CI overrides this +# via -Dsonar.python.version from the sonar-python-version input, so this key only affects +# local and IDE (SonarLint) analysis. Keep the two in sync. +sonar.python.version=3.10,3.11,3.12,3.13,3.14 # ============================================================================= # Test Coverage Configuration