chore: PLTF-3502 add SonarQube analysis - #350
Draft
aivong-openhands wants to merge 1 commit into
Draft
Conversation
Runs as a step in tests.yml rather than a separate workflow: the pytest step already writes coverage.xml via --cov-report, so the report is from the analysed commit and nothing is duplicated. tests/ is top level, so sources and tests are disjoint -- SonarQube aborts if a file is reachable from both. Checkout gains fetch-depth: 0, which SonarQube needs to attribute issues to authors.
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
We're evaluating SonarQube as a code health scorecard across five repos, and this is the analysis config for this one. It runs as a step in
tests.ymlrather than a separate workflow, because the pytest step there already writescoverage.xmlvia--cov-report=xml— so coverage always comes from the commit being analysed, and no test run is duplicated.sonar.sourcesisopenhandswithtestsdeclared separately: SonarQube requires the two to be disjoint sets and aborts if a file is reachable from both. The POC is time-boxed and the instance is disposable, so this is expected to be reverted rather than kept.The scan is skipped for fork pull requests, which get no secrets and could only fail on a missing token.
Validation
coverage.xmlalready exists at the path configured —tests.ymlruns pytest with--cov=openhands/automation --cov-report=xml:coverage.xml, so no new coverage plumbing was needed.tests/is top level, not nested insideopenhands/, so the indexed-twice failure does not apply here.sonar.python.version=3.12matches.python-versionandrequires-python = ">=3.12".package.json,frontend/or JS lockfile, so no frontend coverage or dependency install is involved.This PR was drafted by an AI agent on behalf of the user.