Rules, Rule Types, Severities, Quality Profiles, and Customization: Diagnostics, Failure Modes, and Production Practices
Diagnose surprising issue populations and policy drift without erasing evidence: determine whether source, scanner, analyzer, profile assignment, override, instance mode, Compute Engine or gate policy changed.
Learning objectives
- Use an evidence-first sequence for rule/profile anomalies.
- Diagnose reactive deactivation and severity misuse.
- Identify default-profile blast radius and profile sprawl.
- Reconcile analyzer upgrades, new/deprecated rules and inheritance.
- Repair the smallest policy layer and rerun the same representative revision.
1. Evidence-first sequence
-
Preserve scanner logs,
report-task.txt, CE task, issue/gate state, profile exports/screens and change records. - Confirm exact product edition/version, scanner, Java runtime, analyzer/plugin versions and instance mode.
- Confirm source revision, base directory, indexed files and SCM state.
- Confirm default versus explicit profile assignment for each language.
- Inspect exact rule key/repository/status, activation, inheritance/override and parameters.
- Confirm CE terminal status before interpreting results.
- Inspect gate/new-code policy only after analysis policy is proven.
- Inspect auth/network/database/search/JVM/container layers only when evidence points there.
- Apply the least-destructive correction and rerun the same representative revision.
2. Symptom → evidence, not guess
| Symptom | Likely layer | Preserve | Wrong shortcut |
|---|---|---|---|
| Issue count drops after profile edit | activation/parameter/assignment | profile diff, rule keys, same-revision tasks | claim code improved |
| Issue count changes after upgrade | analyzer rules/defaults/deprecations/inheritance | old/new versions + profile backup | suppress all new issues |
| Many projects change at once | language default or parent profile | default marker + affected-project inventory | edit each project blindly |
| One project differs from peers | explicit association or child override | Project Settings + inheritance/override list | copy peer profile without diagnosis |
| Scanner exits 0 but gate is red | normal lifecycle/gate policy | task/CE/gate separately | call scanner failed or lower gate |
| Expected rule produces no issue | file scope, inactive rule, wrong profile/language | scope logs + rule/profile assignment | activate every rule globally |
3. Intentionally broken example: “green by removing the check”
The lab function raises S3776 under threshold 3. An operator deactivates S3776 in the child profile and points to the lower issue count as an improvement.
Same revision + S3776 active(threshold=3) → issue present
Same revision + S3776 deactivated → issue absent
The second line proves policy removal, not cleaner source.
Preserve both profile states and task IDs. Repair by restoring the rule/parent definition, then decide separately whether threshold 3 is justified. Never delete issue history to hide the experiment.
4. Failure: severity used as exploitability or developer grading
Sonar severity does not prove that a particular vulnerability is exploitable in your deployment and is not a developer score. Issue counts and severity can move because source scope, rule policy, analyzer versions and SCM attribution change. Keep security/business triage separate from rule-profile semantics.
5. Failure: uncontrolled profile sprawl
Red flags include nearly identical copies, unknown owners, stale rules, unexplained thresholds and projects pinned to obsolete profiles. Diagnose by inventorying/exporting profiles, parent relationships, overrides and project associations. Consolidate only after mapping blast radius.
6. Failure: changing a language default without ownership
A default-profile edit or replacement can affect every project without an explicit association. Production practice requires an affected-project inventory, owner, change window, representative before/after analyses, communication and rollback profile before making the change.
7. Failure: ignoring new/deprecated rules after analyzer upgrades
Analyzer upgrades can add rules, deprecate existing rules, change defaults or improve implementations. Sonar-way children can inherit parent evolution; copied/blank profiles do not automatically gain the same policy updates. Review new/deprecated rules and child overrides after every upgrade before interpreting trend changes as source-quality changes.
8. Keep failure layers separate
Wrong base directory, missing bytecode, token/network failure, report not uploaded.
Report uploaded but asynchronous processing failed.
Wrong assignment, inactive rule, override, analyzer drift.
Correct analysis creates a legitimate policy failure.
Database/search/JVM/container or edition/license failure.
Do not respond to a profile problem with direct DB/search edits, cache/log deletion, TLS disablement, admin tokens everywhere, unsupported downgrade or a new project key.
9. Production runbook
1. Freeze the representative source revision.
2. Preserve scanner/report-task/CE/issues/gate evidence.
3. Export/record old and new profile states.
4. Compare server + analyzer/plugin + mode changes.
5. Diff active rule keys, deprecated/new rules and overrides.
6. Restore only the incorrect profile/default/association change.
7. Rerun the same revision and preserve new task evidence.
8. Revisit issue/gate workflow only after analysis policy is correct.
10. Challenge: upgrade-driven issue spike
Forty projects gain maintainability issues after an analyzer upgrade. Revisions/scanners are unchanged. Half use Sonar-way children; half use old copied profiles. First compare analyzer versions and current Sonar way, then child inheritance versus copied-profile active rules/overrides. Do not mass-suppress findings before identifying the policy delta.
Knowledge check
What does issue disappearance after rule deactivation prove?
Only that the check stopped producing that finding; it does not prove source improved.
Why can an upgrade change issues on the same revision?
Analyzer rule availability, implementation, defaults or deprecated-rule handling can change.
What must precede a default-profile change?
Affected-project inventory, ownership, before/after validation and rollback plan.
Why not edit database/search state for a profile problem?
Profile state must be changed through supported application semantics; direct persistence edits risk corruption and destroy auditability.
What is the smallest verification rerun?
The same representative revision and source scope under the corrected intended profile, with a new CE task.
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.