Chapter 20Lesson 05~175 minutes

Checkpoint Lab — SonarQube for IDE Connected Mode and Developer Feedback Loops

Bind a local IDE to a disposable project, prove one synchronized-rule effect, and then prove the independent handoff to scanner, Compute Engine, Quality Gate, credential cleanup, and audit evidence.

SonarQube for IDEConnected ModeDeveloper feedbackQuality profileGovernance

Learning objectives

  • Complete an end-to-end Connected Mode checkpoint using Community Build and SonarQube for VS Code.
  • Predict and verify at least two independent local/server state changes before acting.
  • Prove a server rule/profile parameter is synchronized into local IDE feedback without changing source revision.
  • Prove the handoff from developer feedback to a fresh scanner/Compute Engine/Quality Gate result.
  • Produce an evidence packet separating IDE user credentials, scanner credentials, binding identity, Git revision, local issue state, and server result.
  • Disconnect and revoke credentials without deleting unrelated project/profile state.

1. Checkpoint scenario

A development team wants fast local feedback but does not want developers to treat editor state as a release gate. Your checkpoint is to bind VS Code to sq-ch20-ide-lab, synchronize one safe rule parameter, demonstrate a predictable local finding change at the same Git SHA, and then prove that the final governed result comes from a separate server analysis.

2. Exact assumptions and preflight

Assumption Evidence required
Community Build 26.9.0.129388 system/status
SonarQube for VS Code 5.9.1 baseline or a recorded later compatible version
IDE runtime JRE 17+ requirement; record extension/runtime log where available
Scanner SonarScanner CLI 8.1.0.6389
Project sq-ch20-ide-lab
IDE auth Disposable user token, personal to the lab developer
Scanner auth Separate project-analysis token
Commercial features None required; server-only analyzer examples remain explanatory/optional
git branch --show-current
git rev-parse HEAD
git status --short
code --version
code --list-extensions --show-versions | grep -i sonar || true
sonar-scanner --version
curl -fsS "http://localhost:9000/api/system/status"

3. Predictions before changing state

Write at least these predictions in evidence/predictions.md:

  • Prediction A: binding the workspace to sq-ch20-ide-lab will replace standalone rule ownership with server-profile-driven settings for locally supported rules.
  • Prediction B: changing the disposable server profile’s python:S3776 threshold while keeping the Git SHA unchanged will change the local issue state after binding synchronization.
  • Prediction C: the subsequent server analysis will produce a new ceTaskId and authoritative server result even though the IDE already displayed a local finding.
  • Prediction D: revoking the IDE user token will break the Connected Mode trust path but will not invalidate the separate scanner project-analysis token until that token is revoked.

4. Capture the standalone baseline

  1. Open the fixture in VS Code with SonarQube for IDE installed.
  2. Confirm there is no active binding to sq-ch20-ide-lab.
  3. Record extension version and local issue state for src/decision.py.
  4. Record the locally visible configuration of python:S3776 if supported.
  5. Save the extension Output/log excerpt without tokens.

Export a short note as evidence/ide-standalone.md. This is the control observation.

5. Create the correct connection and binding

Create a disposable SonarQube user token. In the Connected Mode panel, configure:

connection_name = sq-ch20-local
server_url = http://localhost:9000
credential_type = USER TOKEN
binding_project_key = sq-ch20-ide-lab
workspace = <exact local repository root>

Capture the binding success and project identity, but never the token value. If a shared binding configuration is exported, inspect it before committing and confirm it contains only supported project/server identity metadata, not user credentials.

6. Apply and verify one synchronized policy change

  1. Create/assign a disposable custom Python quality profile to sq-ch20-ide-lab.
  2. Record the parent/profile name and current python:S3776 threshold.
  3. Change only that threshold so the fixed fixture crosses it.
  4. Do not edit src/decision.py; prove the Git SHA is unchanged.
  5. Refresh/update the Connected Mode binding.
  6. Record the IDE log and local issue state after synchronization.
same Git SHA + same editor source + changed server rule parameter → binding refresh → changed local supported-rule result

If the rule is unavailable locally in your installed version, select another locally supported parameterized Python rule and document the substitution. Do not manufacture success by editing source or disabling another rule.

7. Prove the independent governed server handoff

Use the scanner’s separate project-analysis token and analyze the committed revision:

export SONAR_HOST_URL="http://localhost:9000"
export SONAR_PROJECT_KEY="sq-ch20-ide-lab"
read -rsp "Project-analysis token: " SONAR_TOKEN; echo
export SONAR_TOKEN

mkdir -p evidence/server-handoff
git rev-parse HEAD | tee evidence/server-handoff/revision.txt
sonar-scanner -X 2>&1 | tee evidence/server-handoff/scanner.log
cp .scannerwork/report-task.txt evidence/server-handoff/report-task.txt

CE_TASK_ID="$(sed -n 's/^ceTaskId=//p' .scannerwork/report-task.txt)"
printf '%s\n' "$CE_TASK_ID" | tee evidence/server-handoff/ceTaskId.txt

curl -fsS -H "Authorization: Bearer $SONAR_TOKEN" \
  "$SONAR_HOST_URL/api/ce/task?id=$CE_TASK_ID" \
  | tee evidence/server-handoff/ce-task.json

After Compute Engine reaches a terminal successful state, capture the server issue result and Quality Gate. Your checkpoint is incomplete if it ends at “the IDE showed a squiggle.”

8. Diagnose one deliberate credential fault

Temporarily attempt to configure Connected Mode with the project-analysis token rather than the user token. Preserve the redacted failure/error. Then restore the user token.

Do not expose tokens. Record only token type/owner and the error response. Never put either token into screenshots, shell output, source files, or evidence JSON.

This deliberate failure proves that authentication is purpose-specific: scanner success with a project-analysis token does not imply Connected Mode can authenticate with it.

9. Verification checklist

  • ☐ Extension/IDE/server/scanner versions recorded.
  • ☐ Exact Git branch/SHA and working-tree state recorded before and after synchronization.
  • ☐ Standalone local issue/rule state preserved.
  • ☐ Connection URL and bound project key independently verified.
  • ☐ IDE credential identified as a user token; CI/scanner credential identified separately.
  • ☐ Server quality profile and exact synchronized rule/parameter recorded.
  • ☐ Same-SHA local issue change verified after synchronization.
  • ☐ Fresh scanner run produced a new ceTaskId.
  • ☐ Compute Engine terminal state and server Quality Gate recorded independently.
  • ☐ Wrong-token-type failure preserved and repaired without weakening security.

10. Required evidence packet

Minimum packet
  • assumptions.md — server/IDE/scanner/JRE/edition assumptions and limitations.
  • revision.txt plus working-tree state.
  • ide-standalone.md — extension version and local rule/issue state.
  • binding.md — server URL, connection name, project key, credential type/owner (never token value).
  • profile-before-after.md — profile, rule key, parameter before/after, owner/rationale.
  • ide-connected.md — synchronization log/result and local issue state.
  • server-handoff/report-task.txt, ceTaskId.txt, Compute Engine status, issue/gate evidence.
  • credential-fault.md — redacted wrong-token-type failure and repair.
  • limitations.md — IDE-clean ≠ gate pass; server-only analyzer and PR-sync limits.

11. Cleanup and rollback

  1. Preserve/export the packet before mutation.
  2. Remove the IDE project binding and disposable connection.
  3. Revoke the IDE user token and verify it no longer authenticates.
  4. Revoke the scanner project-analysis token and verify cleanup.
  5. Restore/delete only the disposable custom profile/project created for this lab.
  6. Do not alter unrelated global profiles, user accounts, CI secrets, databases, or server settings.

12. What this adds to the production operating model

Chapter 20 adds a fast, user-owned developer feedback loop to the governed platform without weakening the central analysis contract. Project identity and quality-profile policy can be synchronized into supported local analysis, while credentials remain separate by purpose and release decisions remain tied to server/CI evidence.

Chapter 21 moves from developer feedback into Users, Groups, Permissions, Tokens, Authentication, and Authorization, where the identity/permission model behind these user and analysis tokens becomes the primary subject.

Knowledge check

What proves the synchronized rule effect rather than a code change?

Why does the checkpoint require a fresh server scan after IDE verification?

What does the deliberate wrong-token failure teach?

If a server-only issue appears after CI but not locally, is the checkpoint inconsistent?

What must cleanup never remove?

What is the bridge to Chapter 21?

Next lesson — Next chapter

Users, Groups, Permissions, Tokens, Authentication, and Authorization

Chapter 21 deepens the identity and authorization model behind user tokens, analysis tokens, groups, and permissions.

Official references and version notes

Version and compatibility note

Rechecked 2026-09-08. Mandatory examples target SonarQube Community Build 26.9.0.129388, SonarScanner CLI 8.1.0.6389, and SonarQube for VS Code 5.9.1 (published 2026-08-31). VS Code Connected Mode currently requires a user token; project/global analysis tokens do not function correctly for binding. Connected Mode applies the bound server quality profile/settings to supported local analysis, but architecture/injection and some advanced bug rules can remain server-only. Current VS Code Connected Mode has branch awareness but does not synchronize pull-request analysis. SonarQube for IDE compatibility follows active server/LTA support policy; recheck the IDE/server compatibility matrix, extension release, token rules, and locally supported analyzers before reproducing on a later release.

Keep the academy open

Support free, practical DevOps education.

Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.

Ethereum / ERC-20
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0Send only Ethereum/ERC-20 compatible assets to this address.