Chapter 09Lesson 05~180 minutes

Checkpoint Lab — Rules, Rule Types, Severities, Quality Profiles, and Customization

Produce a reviewable policy dossier for one reversible quality-profile experiment: predict state changes, apply one S3776 threshold override, correlate same-revision task/issue/gate evidence, analyze blast radius and prove rollback.

CheckpointEvidence dossierSame revisionImpact analysisRollback

Learning objectives

  • Record exact version/mode/rule/profile assumptions before mutation.
  • Predict multiple policy and analysis-state changes before execution.
  • Run baseline, overridden and restored analyses on one revision.
  • Produce issue/task/gate/profile evidence and impact analysis.
  • Revoke credentials and restore project/profile state without deleting history.

1. Scenario and pass condition

Evaluate whether a stricter Python cognitive-complexity threshold is appropriate for one synthetic project. The dossier must answer: what policy changed, which exact revision it affected, what result changed because of that policy, what projects were in scope, and whether rollback restored parent policy.

2. Assumptions manifest

Item Required record
Product Community Build 26.9.0.129388 baseline; record actual version
Mode MQR or Standard; never switch during the lab
Scanner SonarScanner CLI 8.1.0.6389 baseline; record actual runtime/JRE behavior
Project academy-sonarqube-p09, synthetic/private only
Profile Academy Python Guardrails, child of Python Sonar way
Rule python:S3776; installed repository/status/classification/parent threshold
Credentials profile-admin UI identity plus separate project-analysis token; no secret values in dossier
Plugins/integrations none mandatory; no CI/provider/commercial/cloud path
Platform reuse disposable local server; no direct DB/search changes

3. Write predictions before the change

  1. A: associating the child profile changes project-policy state only; source revision/scanner/indexed files remain unchanged.
  2. B: overriding S3776 threshold to 3 changes child effective rule policy and should create an S3776 issue on the fixture.
  3. C: each successful analysis has a distinct ceTaskId even with identical source revision.
  4. D: Revert to Parent Definition removes the child override without modifying Sonar way.

For each prediction, write the independent evidence that would prove or falsify it.

4. Prepare a clean baseline

cd sonar-p09
test -z "$(git status --porcelain)" || { git status --short; exit 1; }
git rev-parse HEAD | tee checkpoint-revision.txt
sonar-scanner --version | tee checkpoint-scanner-version.txt

Record instance mode, Python Sonar way BUILT-IN/default markers, S3776 rule metadata and project/profile association before doing anything else.

5. Baseline analysis

read -rsp 'Project-analysis token: ' SONAR_TOKEN; echo
export SONAR_TOKEN SONAR_HOST_URL='http://127.0.0.1:9000'
sonar-scanner -X -Dsonar.host.url="$SONAR_HOST_URL" 2>&1 | tee checkpoint-baseline-debug.log
cp .scannerwork/report-task.txt checkpoint-baseline-report-task.txt

Record the terminal CE state, S3776 issue filter result and gate status separately.

6. Apply one controlled policy change

  1. Extend Python Sonar way if the lab child does not already exist.
  2. Associate only the lab project; do not change the Python default.
  3. Record the inherited S3776 threshold and mode classification.
  4. Set only the threshold to 3 (or a current valid value below measured fixture complexity).
  5. Record actor, timestamp, reason and the override marker.
Abort: stop if the UI shows Sonar way itself, a language-default change, bulk rule changes or unrelated projects in the blast radius.

7. Same-revision overridden analysis

test "$(git rev-parse HEAD)" = "$(cat checkpoint-revision.txt)" || { echo 'Revision drift'; exit 1; }
sonar-scanner -X -Dsonar.host.url="$SONAR_HOST_URL" 2>&1 | tee checkpoint-overridden-debug.log
cp .scannerwork/report-task.txt checkpoint-overridden-report-task.txt

After CE success, record the S3776 issue message, actual complexity, allowed threshold, mode classification and gate state. Compare ceTaskId with the baseline to verify Prediction C.

8. Impact analysis

Developer signal

Useful guidance or excessive noise?

Blast radius

Only one explicitly associated project; default unchanged.

Upgrade behavior

Child inherits Sonar way; the threshold override is a local fork to review.

Gate

Record impact but never alter the gate to make the experiment pass.

Mode

Use actual MQR or Standard vocabulary without ad-hoc translation.

9. Roll back and prove parent restoration

  1. Select Revert to Parent Definition for S3776.
  2. Verify the override marker disappears and Sonar way was never modified.
  3. Keep project association constant for the restore scan.
sonar-scanner -X -Dsonar.host.url="$SONAR_HOST_URL" 2>&1 | tee checkpoint-restored-debug.log
cp .scannerwork/report-task.txt checkpoint-restored-report-task.txt

After CE success, record restored rule-specific issue state. Historical issue/activity evidence may remain; that history is valuable and should not be erased.

10. Required evidence dossier

assumptions.md — version / edition / mode / scanner / JRE / analyzer / plugin / integration assumptions
checkpoint-revision.txt — exact source identity
rule-S3776-before.md — rule key/repository/status/classification/threshold
profile-before.md — Sonar way/default/project association
checkpoint-baseline-* — scanner/report-task/CE/issues/gate
profile-change.md — child/parent, old→new threshold, actor/rationale/blast radius
checkpoint-overridden-* — scanner/report-task/CE/issues/gate
impact-analysis.md — developer noise, blast radius, upgrade, mode, gate
profile-rollback.md — revert-to-parent proof
checkpoint-restored-* — final scanner/report-task/CE/issues
credentials.md — scope/owner/lifetime/revocation metadata only
limitations.md — commercial/plugin/CI/cloud paths not executed

11. Verification checklist

  • Exactly one synthetic project and one custom profile were affected.
  • Source revision/indexed scope stayed constant.
  • Instance mode and installed rule metadata were captured before mutation.
  • Sonar way and the Python default were never modified.
  • Baseline, overridden and restored scans have distinct task evidence.
  • Issue evidence is filtered by exact rule key.
  • Gate status is separate from scanner/CE success.
  • Original failure/change evidence remains after rollback.
  • No secret/token values or proprietary source are in the dossier.

12. Guarded cleanup

  1. Revoke the project-analysis token and unset SONAR_TOKEN.
  2. Remove the explicit child association only after rollback evidence is complete.
  3. Delete the child profile only after proving no remaining project uses it and preserving its backup.
  4. Delete the disposable project/fixture only after the dossier is complete.
  5. Leave shared server, database/search, cache, default-profile and analyzer state untouched.

13. What Chapter 09 adds

You can now explain an issue as the intersection of known source scope and known rule policy: analyzer/repository, rule key/status, active profile, inheritance/override, project association, instance-mode taxonomy, same-revision analysis task and downstream gate. Chapter 10 can therefore focus on issue lifecycle—statuses, assignments, false positives and resolution—without confusing workflow decisions with profile policy.

Knowledge check

Why keep the child association during the rollback scan?

What independently proves policy rather than source caused the delta?

What proves Sonar way stayed intact?

Why filter the issue evidence by rule key?

What must never be stored in the dossier?

Next lesson

From rule policy to issue workflow

Chapter 10 starts with this verified issue population and teaches statuses, assignments, accepted findings, false positives and resolution workflow.

Official references and version notes

Version and compatibility note

Rechecked on 2026-09-07. Mandatory examples target private/local SonarQube Community Build 26.9.0.129388 and SonarScanner CLI 8.1.0.6389. Current Community Build baseline is 26.9.0.129388; current commercial SonarQube Server baseline is 2026 Release 4.1 with 2026.1.5 as the current 2026 LTA patch line. New Community Build instances use MQR Mode by default, but every lab records the actual mode and never switches it. MQR uses Blocker/High/Medium/Low/Info severities on software-quality impacts; Standard Experience uses Bug/Vulnerability/Code Smell/Security Hotspot types with Blocker/Critical/Major/Minor/Info severity. Sonar way is built-in and immutable. The hands-on experiment extends Python Sonar way and tunes python:S3776; verify installed rule metadata before changing it because analyzer behavior can evolve. No third-party plugin, commercial edition, CI provider, enterprise identity, SonarQube Cloud account, branch/PR analysis or production source is required.

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.