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.
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
- A: associating the child profile changes project-policy state only; source revision/scanner/indexed files remain unchanged.
- B: overriding S3776 threshold to 3 changes child effective rule policy and should create an S3776 issue on the fixture.
-
C: each successful analysis has a distinct
ceTaskIdeven with identical source revision. - 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
- Extend Python Sonar way if the lab child does not already exist.
- Associate only the lab project; do not change the Python default.
- Record the inherited S3776 threshold and mode classification.
- Set only the threshold to 3 (or a current valid value below measured fixture complexity).
- Record actor, timestamp, reason and the override marker.
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
Useful guidance or excessive noise?
Only one explicitly associated project; default unchanged.
Child inherits Sonar way; the threshold override is a local fork to review.
Record impact but never alter the gate to make the experiment pass.
Use actual MQR or Standard vocabulary without ad-hoc translation.
9. Roll back and prove parent restoration
- Select Revert to Parent Definition for S3776.
- Verify the override marker disappears and Sonar way was never modified.
- 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 assumptionscheckpoint-revision.txt
— exact source identityrule-S3776-before.md —
rule key/repository/status/classification/thresholdprofile-before.md
— Sonar way/default/project associationcheckpoint-baseline-*
— scanner/report-task/CE/issues/gateprofile-change.md
— child/parent, old→new threshold, actor/rationale/blast radiuscheckpoint-overridden-*
— scanner/report-task/CE/issues/gateimpact-analysis.md
— developer noise, blast radius, upgrade, mode, gateprofile-rollback.md
— revert-to-parent proofcheckpoint-restored-* —
final scanner/report-task/CE/issuescredentials.md
— scope/owner/lifetime/revocation metadata onlylimitations.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
-
Revoke the project-analysis token and unset
SONAR_TOKEN. - Remove the explicit child association only after rollback evidence is complete.
- Delete the child profile only after proving no remaining project uses it and preserving its backup.
- Delete the disposable project/fixture only after the dossier is complete.
- 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?
So only the rule override changes; removing association simultaneously would confound the test.
What independently proves policy rather than source caused the delta?
Identical revision/scope plus changed profile override and distinct CE/issue evidence.
What proves Sonar way stayed intact?
BUILT-IN parent state plus child override/revert evidence; no edit/default change to Sonar way.
Why filter the issue evidence by rule key?
Total issue counts can change for unrelated reasons; the rule key isolates this experiment.
What must never be stored in the dossier?
Actual token/credential values or proprietary source; only non-secret metadata and synthetic code evidence.
Official references and version notes
- Community Build — SonarQube rules — repositories, statuses, rule categories, custom/template rules and mode-dependent severity semantics.
- Community Build — Instance mode overview, including MQR Mode and Standard Experience.
- Community Build — Understanding quality profiles — built-in/default profiles, inheritance, overrides and project association.
- Community Build — Creating a quality profile — Extend, Copy, blank creation and import/export.
- Community Build — Editing a custom quality profile — activate/deactivate rules, customize parameters and Revert to Parent Definition.
- Community Build — Associating a quality profile with projects.
- Sonar Rules — Python S3776 — Cognitive Complexity rule used in the controlled parameter experiment.
- SonarQube releases — current Community Build and Server release identities.
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.
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0Send only Ethereum/ERC-20 compatible assets to this
address.