From ca394e4d8aaa64900af50c3b054cdabca0eed16c Mon Sep 17 00:00:00 2001 From: Byron Williams Date: Wed, 5 Aug 2026 21:05:23 -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.11,<3.15". SonarPython gates version-specific rules on ALL declared versions (PythonVersionUtils.areSourcePythonVersionsGreaterOrEqualThan is allMatch), so declaring only 3.12 made every 3.12-gated rule fire against code that must still run on 3.11. That produced 2 live false positives today: S6794 and S6796 urging PEP 695 "type X = ..." aliases, which are a SyntaxError on 3.11. Declaring the full range makes allMatch(>=3.12) false, so the rules correctly stay silent until the floor moves. Sets the new sonar-python-version input (ByronWilliamsCPA/.github#291) and bumps the uses: pin to the commit that introduces it, since the input does not exist in the previously pinned revision and passing an undefined input fails the reusable workflow at startup. Also syncs sonar-project.properties. CI overrides that key via -D, so it does not affect the pipeline, but SonarLint in the IDE reads it and would otherwise keep raising the same false positives locally that CI no longer reports. python-version stays 3.12: it feeds actions/setup-python and is the version the project builds and runs tests with, which is a separate concern from the versions the source must remain compatible with. Pre-commit: all hooks pass except pydoclint, which fails identically on untouched main (DOC105/109/110 in fuzz/*.py). This change touches no Python, so it is scoped out with SKIP=pydoclint rather than bypassed. --- .github/workflows/sonarcloud.yml | 6 +++++- sonar-project.properties | 7 +++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 2f90a1e..87be27e 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -30,9 +30,13 @@ permissions: jobs: sonarcloud: name: SonarCloud Analysis - uses: ByronWilliamsCPA/.github/.github/workflows/python-sonarcloud.yml@7d12f5486ab5c856397ebaa4acd3c99ca385227c # main + uses: ByronWilliamsCPA/.github/.github/workflows/python-sonarcloud.yml@4bd2d7c207a7fcf2dfcec8416c805d06d745c241 # main with: python-version: '3.12' + # Every version requires-python (">=3.11,<3.15") admits, not just the build version. + # SonarPython gates version-specific rules on ALL declared versions, so declaring only + # 3.12 raised PEP 695 rules (S6794/S6796) against code that must still run on 3.11. + sonar-python-version: '3.11,3.12,3.13,3.14' source-directory: 'src/rag_processor' sonar-organization: 'byronwilliamscpa' sonar-project-key: 'ByronWilliamsCPA_rag-processor' diff --git a/sonar-project.properties b/sonar-project.properties index db81598..c2bcde6 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -18,8 +18,11 @@ sonar.sources=src/ # Test directories (comma-separated) sonar.tests=tests/ -# Python version -sonar.python.version=3.12 +# Python versions the SOURCE supports, matching requires-python (">=3.11,<3.15"). +# CI overrides this via -Dsonar.python.version from the sonar-python-version workflow input, +# so this key only affects local and IDE (SonarLint) analysis. Keep the two in sync, or +# SonarLint keeps raising the 3.12+ rules that CI no longer does. +sonar.python.version=3.11,3.12,3.13,3.14 # ============================================================================= # Test Coverage Configuration