Skip to content

SCANPY-211 Support local scanner engine JAR#324

Open
zglicz wants to merge 3 commits into
masterfrom
codex/scanpy-211-engine-jar-path
Open

SCANPY-211 Support local scanner engine JAR#324
zglicz wants to merge 3 commits into
masterfrom
codex/scanpy-211-engine-jar-path

Conversation

@zglicz

@zglicz zglicz commented Jul 2, 2026

Copy link
Copy Markdown

Jira: https://sonarsource.atlassian.net/browse/SCANPY-211

Summary

  • Add sonar.scanner.engineJarPath configuration support through CLI and environment/property loading
  • Use the configured local scanner engine JAR instead of provisioning it from the server
  • Update CLI docs and unit coverage

Tests

  • PYTHONPATH=src uv --no-config run --no-project --with pytest==9.1.1 --with pyfakefs==6.2.0 --with responses==0.26.1 --with pytest-subtests==0.15.0 --with requests>=2.32,<3 --with jproperties>=2.1,<3 --with tomli>=2.0,<3 --with typing-extensions>=4.0 python -m pytest tests/unit tests/test_properties.py tests/test_environment_variables.py

@hashicorp-vault-sonar-prod

hashicorp-vault-sonar-prod Bot commented Jul 2, 2026

Copy link
Copy Markdown

SCANPY-211

Comment thread src/pysonar_scanner/__main__.py Outdated
@zglicz zglicz requested a review from a team July 2, 2026 11:42
@zglicz

zglicz commented Jul 2, 2026

Copy link
Copy Markdown
Author

Addressed the Gitar finding about sonar.scanner.engineJarPath: the configured local scanner engine JAR path is now validated as an existing readable file before JRE/engine provisioning, and the missing-path case is covered by unit tests. Commit: 48dd934.

@zglicz

zglicz commented Jul 2, 2026

Copy link
Copy Markdown
Author

Fixed the Windows CI failure from the Test Windows job: test_create_scanner_engine_uses_local_engine_jar_path now compares pathlib.Path values instead of asserting POSIX path separators. Commit: 3c84b9c.

@gitar-bot

gitar-bot Bot commented Jul 2, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 resolved / 1 findings

Adds configuration support for local scanner engine JAR paths, resolving the previously missing validation check for file existence.

✅ 1 resolved
Edge Case: No validation that local engine JAR path exists

📄 src/pysonar_scanner/main.py:124-128
When SONAR_SCANNER_ENGINE_JAR_PATH is set, the code wraps it directly in pathlib.Path(...) and passes it to ScannerEngine without verifying the file exists or is readable. If the user supplies a wrong or non-existent path, provisioning is skipped and the failure only surfaces later as an opaque java -jar error (e.g. "Unable to access jarfile"), which is hard to diagnose.

Consider validating the path up front and raising a clear configuration error, e.g.:

engine_jar = pathlib.Path(config[SONAR_SCANNER_ENGINE_JAR_PATH])
if not engine_jar.is_file():
    raise SonarQubeApiException(f"Configured scanner engine JAR does not exist: {engine_jar}")

This gives the user immediate, actionable feedback instead of a downstream JVM error.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqube-next

sonarqube-next Bot commented Jul 2, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants