Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment on lines +26 to +29

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n --hidden --glob '!**/.git/**' \
  'sonar\.python\.version|sonarlint|sonarqube' .

Repository: ByronWilliamsCPA/python-libs

Length of output: 683


🌐 Web query:

SonarQube for IDE sonar-project.properties properties applied sonarlint sonar.python.version

💡 Result:

SonarLint for IDEs does not directly use the sonar-project.properties file to configure analysis parameters like sonar.python.version [1][2][3]. The sonar-project.properties file is designed specifically for SonarScanner CLI, which is used for full server-side analysis [1][3]. In SonarLint, the recommended way to manage configuration is through Connected Mode [4]. When you bind your IDE project to a project in SonarQube or SonarCloud, SonarLint retrieves the configuration (including quality profiles and rules) directly from the server [4][3]. This ensures that your IDE analysis remains consistent with the server-side analysis [3]. Regarding sonar.python.version specifically: - Purpose: This parameter informs the Python analyzer about the expected Python version to improve the accuracy of the analysis (e.g., standard library handling and symbol resolution) [5][6][7]. - Usage: It is intended for use in sonar-project.properties or via SonarScanner CLI during full analysis [6][8][9]. - SonarLint Behavior: SonarLint does not read this property from local configuration files [3]. If you are using Connected Mode, the server-side configuration should ideally handle the environment settings [3]. If you are not in Connected Mode, SonarLint relies on its internal default settings and does not currently support local overrides of this parameter via property files [1][2]. If you need to ensure consistency between your IDE and your CI analysis, the best practice is to ensure your project is properly bound in Connected Mode to your SonarQube/SonarCloud instance [4][3].

Citations:


🌐 Web query:

SonarLint Python 3.14 Sonar rule Python version support sonar.python.version

💡 Result:

SonarLint and the broader Sonar ecosystem (including SonarQube Server and SonarQube Cloud) provide full support for Python 3.14 [1][2][3]. The support for Python 3.14 was introduced to enable analysis of new language features, including specific rules (such as S7931, S7941, S7942, S7943, and S7945) designed to ensure best practices when using Python 3.14 capabilities [4]. Regarding configuration, you can use the sonar.python.version parameter to specify the Python version(s) your project supports [1][3][5]. This helps the analyzer provide more precise results and silence irrelevant issues [1][6]. Key details for sonar.python.version: - Purpose: It allows you to define which Python versions are compatible with your code, ensuring the analysis is tailored to the correct language features [1][3]. - Format: It accepts a comma-separated list of versions in the "X.Y" format (e.g., sonar.python.version=3.13, 3.14) [1][5][7]. - Usage: This parameter can be set in your sonar-project.properties file or provided via the CLI during analysis [1][5][6]. For IDE integration, including SonarLint, ensure your plugin is updated to the latest version to access the most recent rules and support for Python 3.14 [4].

Citations:


Remove the SonarLint sonar-project.properties claim.

sonar-project.properties is for SonarScanner runs, and SonarLint does not apply sonar.python.version from this file. Keep the CI value aligned, but remove “affects local and IDE (SonarLint) analysis” or document a supported connected-mode/IDE configuration instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@sonar-project.properties` around lines 26 - 29, Update the comment above
sonar.python.version in sonar-project.properties to remove the claim that this
setting affects local or IDE SonarLint analysis. Keep the explanation that CI
overrides the value and that the supported Python-version range must remain
aligned with requires-python.


# =============================================================================
# Test Coverage Configuration
Expand Down
Loading