Checkpoint Lab — Static Analysis, Clean Code, Technical Debt, and Quality Governance
Complete a governed static-analysis checkpoint: write the charter, run a pinned local baseline, predict and verify state changes, preserve an evidence packet, diagnose one controlled failure, and state exactly what the result proves—and does not prove.
Learning objectives
- Produce a reviewable quality-governance charter for a disposable project.
- Run and correlate a pinned Community Build analysis from source revision through server task and gate result.
- Predict at least two source/task/policy state changes and verify them independently.
- Preserve a sanitized evidence packet that another engineer can audit without receiving a token.
- Diagnose one deliberate failure and write a limitations statement that prevents overclaiming static-analysis evidence.
1. Checkpoint scenario and success criteria
You are onboarding a small synthetic service to a code-quality program. The organization wants a release signal, but it explicitly forbids developer ranking, real customer code/data, hidden policy changes, and “green means secure” claims. Your job is to create a charter, run one baseline, preserve the evidence chain, perform a narrow remediation, diagnose one controlled failure, and hand off an auditable packet.
Success means another engineer can answer: what exact revision was analyzed, with which product/scanner baseline, under which quality standard/New Code/gate, what server task produced the result, what changed after remediation, and what limitations remain?
2. Preflight: stop if the environment is not disposable
| Check | Required state | Stop condition |
|---|---|---|
| Target | local machine / authorized lab only | shared or production SonarQube instance |
| Source | synthetic repository only | proprietary code, customer data, real secrets |
| Server | Community Build 26.9.0.129388, pinned image | unknown/unreviewed image or external server |
| Scanner | recorded current supported scanner and Java/JRE behavior | cannot identify scanner/runtime |
| Credential | fake/local project-scoped token via secret channel | admin token in Git/command/evidence |
| Cleanup | known container/project key and evidence destination | cleanup could touch unrelated resources |
3. Write the quality-governance charter
Create evidence/QUALITY_CHARTER.md with this structure:
# Chapter 01 Quality Charter
## Scope
- Project key: devops-academy-sonarqube-ch01
- Source: synthetic training repository only
- Revision rule: every result must record an immutable Git SHA
## Quality standard
- Product/mode: record Community Build version and Standard Experience or MQR Mode
- Quality profile: record effective profile per language
- New Code definition: record current value and rationale
- Quality gate: record gate name, status, and failed conditions
## Decisions and ownership
- Code findings: project maintainer
- Security hotspot review: designated reviewer
- Policy changes: quality-program owner
- Exceptions: scope + rationale + approver + expiry/review date
## Prohibited uses
- No developer ranking by issue/debt counts
- No claim that a green gate proves functional correctness or complete security
- No threshold/rule/baseline change solely to make the current run green
## Evidence retention
- Revision, versions, non-secret parameters, scanner log,
report task ID/status, project result, gate, interpretation, limitations
4. Start the pinned lab and establish source identity
Reuse the synthetic sq-ch01-quality-lab repository from
Lesson 2 or recreate it. Confirm the worktree is clean and record
the exact revision:
git status --short
git rev-parse HEAD | tee evidence/checkpoint-source-revision.txt
docker pull sonarqube:26.9.0.129388-community
docker image inspect sonarqube:26.9.0.129388-community \
--format '{{.Id}}' | tee evidence/checkpoint-server-image-id.txt
docker run -d --name sq-ch01-server \
-p 127.0.0.1:9000:9000 \
sonarqube:26.9.0.129388-community
Complete local project/token setup exactly as in Lesson 2. Do not paste the token into the charter or screenshots.
5. Create a non-secret run manifest
Record assumptions before scanning. A plain-text or JSON manifest is appropriate:
{
"run_id": "ch01-baseline-001",
"date": "2026-09-07",
"project_key": "devops-academy-sonarqube-ch01",
"source_revision": "REPLACE_WITH_GIT_SHA",
"server": "Community Build 26.9.0.129388",
"server_image": "sonarqube:26.9.0.129388-community",
"scanner": "record sonar-scanner -v output",
"mode": "record observed Standard Experience or MQR Mode",
"quality_profile": "record observed profile",
"new_code_definition": "record observed value",
"quality_gate": "record observed gate",
"secrets_in_packet": false
}
Do not invent unknown values. Replace each “record observed” field only after independent inspection.
6. Predict at least four state changes
- Source: baseline scan should correlate to the current Git SHA; remediation will create a different SHA.
- Scanner/report: each successful run should create its own scanner evidence and report-task identity.
- Server/project: each processed report should produce a new analysis result; findings/measures may change after remediation.
- Policy: profile, mode, New Code definition, and gate should stay unchanged unless you intentionally govern a policy change.
Write these predictions into
evidence/PREDICTIONS.md before execution. The
checkpoint is failed if you rewrite the prediction after seeing the
result.
7. Run the baseline and correlate every layer
sonar-scanner -v | tee evidence/checkpoint-scanner-version.txt
sonar-scanner 2>&1 | tee evidence/checkpoint-baseline-scanner.log
cp .scannerwork/report-task.txt evidence/checkpoint-baseline-report-task.txt
Using the task identity, wait for the corresponding background task to complete. Then record the project analysis/revision identity, active profile, mode, New Code definition, issue/measure summary, quality-gate name/status, and any failed conditions. Screenshots are optional; structured/text evidence is easier to review and diff. Redact internal URLs or identifiers if the packet ever leaves the lab.
8. Write “proves / does not prove” before remediation
| The baseline can support | The baseline cannot prove |
|---|---|
| The recorded revision was analyzed under the observed rules/profile and mode. | Every behavior in the program is functionally correct. |
| The current analyzers reported the recorded findings in the configured scope. | No security vulnerability exists anywhere. |
| The recorded gate evaluated the recorded measures/conditions. | The project is automatically safe to deploy in every environment. |
| Technical-debt/remediation values follow SonarQube’s current estimation model. | The team will spend exactly that many real labor hours. |
9. Make one source remediation without changing policy
Fix one clearly justified issue or code-review defect in
src/pricing.js. Do not touch gate thresholds, active
rules, mode, or New Code baseline. Commit and record the new
revision:
git add src/pricing.js
git commit -m "ch01-checkpoint: remediate baseline defect"
git rev-parse HEAD | tee evidence/checkpoint-remediated-revision.txt
sonar-scanner 2>&1 | tee evidence/checkpoint-remediated-scanner.log
cp .scannerwork/report-task.txt evidence/checkpoint-remediated-report-task.txt
After processing, verify your predictions: the revision and task changed; relevant finding/measure state may change; the policy objects should remain stable. If they do not, investigate rather than editing the evidence note to match your expectation.
10. Failure drill: break one layer, preserve it, repair only that layer
Choose one reversible failure:
-
temporarily remove
SONAR_TOKENfrom the shell; or -
temporarily set
SONAR_HOST_URLto the unused loopback porthttp://127.0.0.1:9001.
Run one scan and save the first failure log as
evidence/checkpoint-deliberate-failure.log. Classify
the failed layer before restoring the correct secret/URL. Verify
that restoring the exact input returns the smallest equivalent
scenario to the prior behavior.
11. Assemble the evidence packet
The packet should contain enough evidence to audit the chapter while containing no credential:
evidence/
├── QUALITY_CHARTER.md
├── PREDICTIONS.md
├── LIMITATIONS.md
├── checkpoint-run-manifest.json
├── checkpoint-source-revision.txt
├── checkpoint-remediated-revision.txt
├── checkpoint-server-image-id.txt
├── checkpoint-scanner-version.txt
├── checkpoint-baseline-scanner.log
├── checkpoint-baseline-report-task.txt
├── checkpoint-remediated-scanner.log
├── checkpoint-remediated-report-task.txt
├── checkpoint-deliberate-failure.log
└── server-final.log
Before sharing it, search for the token value, authorization headers, private URLs, personal paths, and proprietary source. Evidence quality includes privacy discipline.
12. Verification checklist
- The exact baseline and remediation Git SHAs are recorded.
- The server image/tag and scanner/runtime identities are recorded.
- The token is absent from Git, properties, commands, logs, screenshots, and the packet.
- Each successful scanner run has corresponding report-task evidence.
- Each report task is correlated to a terminal server result before gate interpretation.
- Profile, mode, New Code, gate, findings/measures, owner, and exceptions are recorded.
- At least two predictions were compared with independent observations.
- The deliberate failure was diagnosed by layer and fixed with a narrow rollback.
-
LIMITATIONS.mdstates that static analysis/gate success is not proof of correctness or complete security. - No policy was weakened solely to pass the checkpoint.
13. Cleanup and rollback
docker logs sq-ch01-server > evidence/server-final.log 2>&1
unset SONAR_TOKEN SONAR_HOST_URL
docker stop sq-ch01-server
docker rm sq-ch01-server
If you delete the project in SonarQube, verify the exact training project key first. Preserve the sanitized evidence packet before deletion. Do not reuse this cleanup against a shared server or broad Docker resources.
14. Chapter 01 handoff
You now have the minimum viable operating model for governed static analysis: immutable source identity, explicit analysis inputs, asynchronous task evidence, project findings/measures, a New Code context, a gate decision, human ownership, and a limitations statement. That foundation prevents later architecture, scanner, CI, security, and administration features from becoming disconnected settings.
Knowledge check
Why write predictions before the scan?
Predictions make the lab a controlled verification exercise. Rewriting expectations after seeing results hides misunderstandings and weakens causal reasoning.
Which three successful states must not be collapsed into one?
At minimum: scanner/report upload success, server/background analysis completion, and quality-gate policy outcome. CI/provider status is another separate state.
Why must policy remain unchanged during the remediation comparison?
Holding profile, mode, New Code, and gate constant isolates source remediation as the primary changed factor, making before/after evidence interpretable.
What belongs in LIMITATIONS.md after a green gate?
State that the result covers only the analyzed revision/scope/rules/policy; it does not prove complete functional correctness, runtime safety, dependency safety, or absence of all vulnerabilities.
What makes the deliberate token/network failure safe?
It is local, reversible, bounded to the synthetic lab, preserves first-failure evidence, and is repaired by restoring the exact input rather than escalating privileges or mutating policy.
What should bridge into Chapter 02?
The realization that scanner, Web Server, Compute Engine, database/search, and product/edition boundaries are distinct components whose architecture explains the evidence chain built here.
Official references and version notes
- SonarQube downloads — release identities for Community Build and SonarQube Server.
- SonarQube Community Build documentation — current self-managed Community Build product documentation.
- Changing modes — Standard Experience versus Multi-Quality Rule (MQR) Mode semantics.
- Quality gate introduction — gate purpose and policy model.
- About new code — Clean-as-You-Code and new-code definition choices.
- Metric definitions — maintainability, remediation effort, debt ratio, and rating definitions.
- Rules — rules, issue generation, and mode-dependent classification.
- SonarScanner CLI — scanner execution guidance.
- SonarSource scanner update-center metadata — scanner release metadata used to pin the lab launcher.
- Official SonarQube Docker tags — container tag provenance for the disposable lab.
Version-sensitive statements were rechecked against current
SonarSource primary documentation on 2026-09-07. The executable
local path in this chapter pins SonarQube Community Build
26.9.0.129388 with official image
sonarqube:26.9.0.129388-community. Where a standalone
SonarScanner CLI is used, the lab records
8.1.0.6389 from SonarSource update-center
metadata. Current scanner Java/JRE auto-provisioning behavior and
exact bootstrap requirements must be rechecked at execution time.
Commercial SonarQube Server/Data Center and SonarQube Cloud
features are not required for this chapter.
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.