@deftai/directive-content 0.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/deft/SKILL.md +6 -0
- package/.agents/skills/deft-directive-article-review/SKILL.md +11 -0
- package/.agents/skills/deft-directive-build/SKILL.md +10 -0
- package/.agents/skills/deft-directive-cost/SKILL.md +12 -0
- package/.agents/skills/deft-directive-debug/SKILL.md +13 -0
- package/.agents/skills/deft-directive-gh-arch/SKILL.md +11 -0
- package/.agents/skills/deft-directive-gh-slice/SKILL.md +10 -0
- package/.agents/skills/deft-directive-glossary/SKILL.md +10 -0
- package/.agents/skills/deft-directive-interview/SKILL.md +9 -0
- package/.agents/skills/deft-directive-pre-pr/SKILL.md +9 -0
- package/.agents/skills/deft-directive-refinement/SKILL.md +10 -0
- package/.agents/skills/deft-directive-release/SKILL.md +12 -0
- package/.agents/skills/deft-directive-review-cycle/SKILL.md +10 -0
- package/.agents/skills/deft-directive-setup/SKILL.md +10 -0
- package/.agents/skills/deft-directive-swarm/SKILL.md +10 -0
- package/.agents/skills/deft-directive-sync/SKILL.md +9 -0
- package/.agents/skills/deft-directive-triage/SKILL.md +9 -0
- package/.agents/skills/deft-directive-write-skill/SKILL.md +9 -0
- package/LICENSE.md +22 -0
- package/QUICK-START.md +167 -0
- package/UPGRADING.md +517 -0
- package/coding/build-output.md +28 -0
- package/coding/coding.md +235 -0
- package/coding/debugging.md +110 -0
- package/coding/holzmann.md +96 -0
- package/coding/hygiene.md +127 -0
- package/coding/security.md +158 -0
- package/coding/testing.md +162 -0
- package/coding/toolchain.md +44 -0
- package/commands.md +300 -0
- package/context/context.md +57 -0
- package/context/deterministic-split.md +67 -0
- package/context/examples.md +26 -0
- package/context/fractal-summaries.md +69 -0
- package/context/long-horizon.md +46 -0
- package/context/spec-deltas.md +177 -0
- package/context/tool-design.md +34 -0
- package/context/working-memory.md +62 -0
- package/contracts/boundary-maps.md +65 -0
- package/contracts/deterministic-questions.md +59 -0
- package/contracts/hierarchy.md +77 -0
- package/conventions/content-manifest.json +399 -0
- package/conventions/machine-generated-banner.md +130 -0
- package/conventions/references.md +120 -0
- package/conventions/rule-ownership.json +382 -0
- package/conventions/task-caching.md +43 -0
- package/conventions/vbrief-filenames.md +70 -0
- package/deployments/README.md +37 -0
- package/deployments/agentuity/README.md +138 -0
- package/deployments/agentuity/via-cli.md +380 -0
- package/deployments/agentuity/via-cloud.md +425 -0
- package/deployments/agentuity/via-github-actions.md +664 -0
- package/deployments/agentuity/via-gravity-network.md +606 -0
- package/deployments/agentuity/via-vpc.md +607 -0
- package/deployments/aws/README.md +38 -0
- package/deployments/aws/via-app-runner.md +612 -0
- package/deployments/aws/via-ecs-fargate.md +561 -0
- package/deployments/aws/via-elastic-beanstalk.md +628 -0
- package/deployments/aws/via-lambda.md +649 -0
- package/deployments/azure/README.md +37 -0
- package/deployments/azure/via-aks.md +390 -0
- package/deployments/azure/via-app-service.md +564 -0
- package/deployments/azure/via-container-apps.md +599 -0
- package/deployments/azure/via-functions.md +552 -0
- package/deployments/cloud-gov/README.md +63 -0
- package/deployments/cloud-gov/agents/compliance-docs.md +154 -0
- package/deployments/cloud-gov/agents.md +39 -0
- package/deployments/cloud-gov/cicd.md +64 -0
- package/deployments/cloud-gov/deployment.md +150 -0
- package/deployments/cloud-gov/logging.md +43 -0
- package/deployments/cloud-gov/manifest.md +121 -0
- package/deployments/cloud-gov/overview.md +58 -0
- package/deployments/cloud-gov/security.md +46 -0
- package/deployments/cloud-gov/services.md +72 -0
- package/deployments/cloud-gov/upstream/README.md +18 -0
- package/deployments/cloudflare/README.md +33 -0
- package/deployments/cloudflare/via-dashboard.md +83 -0
- package/deployments/cloudflare/via-git.md +90 -0
- package/deployments/cloudflare/via-github-actions.md +185 -0
- package/deployments/cloudflare/via-terraform.md +157 -0
- package/deployments/cloudflare/via-wrangler.md +165 -0
- package/deployments/fly-io/README.md +37 -0
- package/deployments/fly-io/via-dockerfile.md +648 -0
- package/deployments/fly-io/via-flyctl.md +653 -0
- package/deployments/fly-io/via-github-actions.md +695 -0
- package/deployments/fly-io/via-multi-region.md +598 -0
- package/deployments/google/README.md +34 -0
- package/deployments/google/via-app-engine.md +42 -0
- package/deployments/google/via-cloud-functions.md +23 -0
- package/deployments/google/via-cloud-run.md +330 -0
- package/deployments/google/via-gke.md +23 -0
- package/deployments/netlify/README.md +99 -0
- package/deployments/netlify/via-cli.md +17 -0
- package/deployments/netlify/via-functions.md +19 -0
- package/deployments/netlify/via-git.md +25 -0
- package/deployments/vercel/README.md +90 -0
- package/deployments/vercel/via-api.md +16 -0
- package/deployments/vercel/via-cli.md +17 -0
- package/deployments/vercel/via-git.md +24 -0
- package/docs/BROWNFIELD.md +179 -0
- package/docs/getting-started.md +137 -0
- package/docs/good-agents-md.md +137 -0
- package/events/README.md +89 -0
- package/events/event-record.schema.json +26 -0
- package/events/registry.json +166 -0
- package/events/registry.schema.json +71 -0
- package/glossary.md +145 -0
- package/incidents/README.md +81 -0
- package/incidents/_template.md +38 -0
- package/interfaces/cli.md +104 -0
- package/interfaces/rest.md +212 -0
- package/interfaces/tui.md +242 -0
- package/interfaces/web.md +123 -0
- package/languages/6502-DASM.md +132 -0
- package/languages/c.md +235 -0
- package/languages/commands.md +23 -0
- package/languages/cpp.md +132 -0
- package/languages/csharp.md +259 -0
- package/languages/dart.md +183 -0
- package/languages/delphi.md +218 -0
- package/languages/elixir.md +208 -0
- package/languages/go.md +78 -0
- package/languages/java.md +278 -0
- package/languages/javascript.md +163 -0
- package/languages/julia.md +175 -0
- package/languages/kotlin.md +193 -0
- package/languages/markdown.md +168 -0
- package/languages/mermaid.md +146 -0
- package/languages/officejs.md +392 -0
- package/languages/python.md +209 -0
- package/languages/r.md +163 -0
- package/languages/rust.md +216 -0
- package/languages/sql.md +216 -0
- package/languages/swift.md +153 -0
- package/languages/typescript.md +132 -0
- package/languages/vba.md +279 -0
- package/languages/vhdl.md +180 -0
- package/languages/visual-basic.md +151 -0
- package/languages/zig.md +196 -0
- package/meta/SOUL.md +27 -0
- package/meta/code-field.md +44 -0
- package/meta/morals.md +40 -0
- package/meta/philosophy.md +39 -0
- package/meta/project.md +49 -0
- package/meta/ralph.md +223 -0
- package/meta/security.md +80 -0
- package/meta/versioning.md +326 -0
- package/package.json +22 -0
- package/packs/lessons/lessons-pack-0.1.json +553 -0
- package/packs/patterns/patterns-pack-0.1.json +57 -0
- package/packs/rules/rules-pack-0.1.json +4767 -0
- package/packs/skills/skills-pack-0.1.json +262 -0
- package/packs/strategies/strategies-pack-0.1.json +167 -0
- package/packs/swarm-spec/swarm-spec-pack-0.1.json +17 -0
- package/patterns/executor-layer-credentials.md +227 -0
- package/patterns/llm-app.md +156 -0
- package/patterns/multi-agent.md +278 -0
- package/patterns/prompt-assembly-layer-ordering.md +154 -0
- package/patterns/role-as-overlay.md +179 -0
- package/platforms/2600.md +137 -0
- package/platforms/unity.md +329 -0
- package/references/composer-skill-porting.md +152 -0
- package/references/cost-models.md +163 -0
- package/references/ip-risk.md +246 -0
- package/references/plain-english-ux.md +275 -0
- package/resilience/context-pruning.md +67 -0
- package/resilience/continue-here.md +62 -0
- package/scm/changelog.md +276 -0
- package/scm/git.md +139 -0
- package/scm/github.md +265 -0
- package/secrets/.gitkeep +0 -0
- package/skills/deft-build/SKILL.md +20 -0
- package/skills/deft-directive-article-review/SKILL.md +156 -0
- package/skills/deft-directive-build/SKILL.md +302 -0
- package/skills/deft-directive-cost/SKILL.md +201 -0
- package/skills/deft-directive-debug/SKILL.md +140 -0
- package/skills/deft-directive-decompose/SKILL.md +96 -0
- package/skills/deft-directive-gh-arch/SKILL.md +160 -0
- package/skills/deft-directive-gh-slice/SKILL.md +199 -0
- package/skills/deft-directive-glossary/SKILL.md +118 -0
- package/skills/deft-directive-interview/SKILL.md +528 -0
- package/skills/deft-directive-pre-pr/SKILL.md +131 -0
- package/skills/deft-directive-probe/SKILL.md +127 -0
- package/skills/deft-directive-refinement/SKILL.md +403 -0
- package/skills/deft-directive-release/SKILL.md +266 -0
- package/skills/deft-directive-review-cycle/SKILL.md +401 -0
- package/skills/deft-directive-setup/SKILL.md +717 -0
- package/skills/deft-directive-swarm/SKILL.md +989 -0
- package/skills/deft-directive-sync/SKILL.md +288 -0
- package/skills/deft-directive-triage/SKILL.md +137 -0
- package/skills/deft-directive-write-skill/SKILL.md +169 -0
- package/skills/deft-interview/SKILL.md +16 -0
- package/skills/deft-pre-pr/SKILL.md +16 -0
- package/skills/deft-review-cycle/SKILL.md +16 -0
- package/skills/deft-roadmap-refresh/SKILL.md +16 -0
- package/skills/deft-setup/SKILL.md +20 -0
- package/skills/deft-swarm/SKILL.md +16 -0
- package/skills/deft-sync/SKILL.md +16 -0
- package/strategies/README.md +83 -0
- package/strategies/artifact-guards.md +85 -0
- package/strategies/bdd.md +115 -0
- package/strategies/brownfield.md +7 -0
- package/strategies/discuss.md +129 -0
- package/strategies/emit-hints.md +69 -0
- package/strategies/enterprise.md +193 -0
- package/strategies/interview.md +551 -0
- package/strategies/map.md +179 -0
- package/strategies/probe.md +151 -0
- package/strategies/rapid.md +155 -0
- package/strategies/research.md +155 -0
- package/strategies/roadmap.md +9 -0
- package/strategies/speckit.md +437 -0
- package/strategies/v0-20-contract.md +134 -0
- package/strategies/yolo.md +169 -0
- package/swarm/swarm.md +300 -0
- package/templates/COST-ESTIMATE.md +114 -0
- package/templates/PULL_REQUEST_TEMPLATE.md +35 -0
- package/templates/agent-prompt-preamble.md +409 -0
- package/templates/agents-entry.md +211 -0
- package/templates/agents-entry.placeholders.md +75 -0
- package/templates/embed.go +20 -0
- package/templates/embed_test.go +36 -0
- package/templates/make-spec-example.md +9 -0
- package/templates/make-spec.md +246 -0
- package/templates/project.md.template +52 -0
- package/templates/specification.md +1 -0
- package/templates/swarm-greptile-poller-prompt.md +556 -0
- package/templates/user.md.template +31 -0
- package/tools/RWLDL.md +80 -0
- package/tools/greptile.md +141 -0
- package/tools/installer.md +23 -0
- package/tools/taskfile-migration.md +32 -0
- package/tools/taskfile.md +185 -0
- package/tools/telemetry.md +285 -0
- package/vbrief/schemas/cache-meta.schema.json +137 -0
- package/vbrief/schemas/candidates.schema.json +130 -0
- package/vbrief/schemas/codebase-map.schema.json +213 -0
- package/vbrief/schemas/lessons-pack.schema.json +134 -0
- package/vbrief/schemas/patterns-pack.schema.json +84 -0
- package/vbrief/schemas/rules-pack.schema.json +105 -0
- package/vbrief/schemas/skills-pack.schema.json +94 -0
- package/vbrief/schemas/slices.schema.json +87 -0
- package/vbrief/schemas/strategies-pack.schema.json +89 -0
- package/vbrief/schemas/swarm-spec-pack.schema.json +84 -0
- package/vbrief/schemas/vbrief-core.schema.json +1022 -0
- package/vbrief/vbrief.md +684 -0
- package/verification/integration.md +76 -0
- package/verification/plan-checking.md +85 -0
- package/verification/uat.md +60 -0
- package/verification/verification.md +117 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# 6502 + DASM Standards
|
|
2
|
+
|
|
3
|
+
Legend (from RFC2119): !=MUST, ~=SHOULD, ≉=SHOULD NOT, ⊗=MUST NOT, ?=MAY.
|
|
4
|
+
|
|
5
|
+
**⚠️ See also**: [main.md](../../main.md) | [PROJECT.md](../../PROJECT.md)
|
|
6
|
+
|
|
7
|
+
## Scope
|
|
8
|
+
- This guide covers:
|
|
9
|
+
1. Fundamental 6502 assembly best practices (architecture-agnostic)
|
|
10
|
+
2. DASM-specific authoring and build practices
|
|
11
|
+
|
|
12
|
+
## Standards
|
|
13
|
+
|
|
14
|
+
### 1) Fundamental 6502 best practices
|
|
15
|
+
|
|
16
|
+
#### Correctness and control flow
|
|
17
|
+
- ! Initialize execution state explicitly at startup (stack, flags relevant to your platform, and vectors/entry flow).
|
|
18
|
+
- ! Keep branch-distance limits in mind: relative branches are signed 8-bit offsets (−128..+127 from next PC).
|
|
19
|
+
- ~ Use clear, linear control flow with short local branches and explicit fallthrough comments.
|
|
20
|
+
- ~ Prefer `JMP` for tail calls instead of `JSR` + `RTS` chains when behavior is equivalent.
|
|
21
|
+
- ⊗ Assume all indirect control transfers are interchangeable; account for instruction-specific behavior and timing.
|
|
22
|
+
|
|
23
|
+
#### Addressing and data layout
|
|
24
|
+
- ! Use zero-page intentionally for hot paths and pointer temporaries.
|
|
25
|
+
- ~ Reserve absolute addressing for stable/global data and code readability.
|
|
26
|
+
- ~ Split pointer tables into low/high byte tables when speed/size wins matter.
|
|
27
|
+
- ! Keep tables and pointer math page-aware to avoid accidental cycle penalties.
|
|
28
|
+
|
|
29
|
+
#### Flags and arithmetic discipline
|
|
30
|
+
- ! Treat status flags (`N,V,B,D,I,Z,C`) as part of function contract when routines are reused.
|
|
31
|
+
- ~ Document which flags a routine clobbers or preserves.
|
|
32
|
+
- ~ Use `ADC`/`SBC` with explicit carry-state intent (avoid hidden flag dependencies).
|
|
33
|
+
- ≉ Use decimal mode (`D`) unless your target/runtime explicitly requires and supports that behavior in-context.
|
|
34
|
+
|
|
35
|
+
#### Timing and performance
|
|
36
|
+
- ! Budget cycles in timing-critical sections (raster/audio/bitbanging/IRQ windows).
|
|
37
|
+
- ~ Prefer predictable-cycle constructs when determinism matters (avoid hidden page-crossing penalties).
|
|
38
|
+
- ~ Distinguish optimization goals per routine: speed, size, determinism, or RAM footprint.
|
|
39
|
+
- ≉ Micro-optimize everywhere; optimize measured hotspots first.
|
|
40
|
+
|
|
41
|
+
#### Reentrancy, stack, and interrupts
|
|
42
|
+
- ! Keep IRQ/NMI-visible shared state minimal and explicit.
|
|
43
|
+
- ~ Prefer reentrant patterns for utility routines used from multiple contexts.
|
|
44
|
+
- ~ Use stack depth conservatively; document worst-case nesting.
|
|
45
|
+
- ⊗ Use scratch RAM assumptions that break under nested interrupts or reused dispatch paths.
|
|
46
|
+
|
|
47
|
+
### 2) DASM-specific best practices
|
|
48
|
+
|
|
49
|
+
#### File structure and processor declaration
|
|
50
|
+
- ! Put `PROCESSOR` at the top-level entry file, first logical directive.
|
|
51
|
+
- ! Declare `PROCESSOR` exactly once per assembly.
|
|
52
|
+
- ~ Use one master file that `INCLUDE`s modules in deterministic order.
|
|
53
|
+
- ~ Group code/data by `SEG` with explicit intent (ROM code/data vs uninitialized RAM/BSS-style allocation).
|
|
54
|
+
|
|
55
|
+
#### Expression and syntax discipline
|
|
56
|
+
- ! Use DASM expression syntax consistently (`[]` for parenthesized expressions).
|
|
57
|
+
- ~ Enable strict syntax checking during CI/release builds (`-S`).
|
|
58
|
+
- ~ Prefer explicitness in expressions/macros over terse clever forms.
|
|
59
|
+
|
|
60
|
+
#### Labels, locality, and subroutines
|
|
61
|
+
- ! Use `SUBROUTINE` boundaries to scope and safely reuse local labels (dot-prefixed labels).
|
|
62
|
+
- ~ Keep local-label naming simple and repeatable inside each subroutine.
|
|
63
|
+
- ~ Use globally unique labels for externally referenced entry points and shared data.
|
|
64
|
+
|
|
65
|
+
#### Segments, origins, and binary output
|
|
66
|
+
- ! Choose output format intentionally:
|
|
67
|
+
- `-f1`: origin header + ascending initialized output
|
|
68
|
+
- `-f2` (RAS): hunked random-access segments (supports non-ascending/reverse-indexed origin workflows)
|
|
69
|
+
- `-f3`: raw data only (no header), with format-1 ordering constraints
|
|
70
|
+
- ! Keep initialized segment ordering compatible with selected output format.
|
|
71
|
+
- ~ Use uninitialized segments for RAM maps/size accounting without generating bytes.
|
|
72
|
+
- ~ Make fill behavior explicit when advancing origins / reserving space (avoid accidental default-fill reliance).
|
|
73
|
+
|
|
74
|
+
#### Includes, assets, and portability
|
|
75
|
+
- ! Use `INCDIR`/`INCLUDE`/`INCBIN` with stable relative project layout.
|
|
76
|
+
- ~ Use `INCBIN` skip-offset intentionally when ingesting assets with headers.
|
|
77
|
+
- ~ Keep platform/path assumptions out of assembly source where possible.
|
|
78
|
+
|
|
79
|
+
#### Build and diagnostics
|
|
80
|
+
- ! Fail builds on assembler errors; treat warnings as actionable.
|
|
81
|
+
- ~ Use symbol/list outputs (`-s`, `-l`/`-L`) for reproducible debugging and review.
|
|
82
|
+
- ~ Pin pass limits (`-p`/`-P`) in automation to detect pathological unresolved-symbol loops.
|
|
83
|
+
- ? Use `-v` levels >0 in local debugging; keep CI logs concise unless troubleshooting.
|
|
84
|
+
|
|
85
|
+
## Commands
|
|
86
|
+
|
|
87
|
+
See [commands.md](./commands.md).
|
|
88
|
+
|
|
89
|
+
## Patterns
|
|
90
|
+
|
|
91
|
+
### Routine contract header (recommended)
|
|
92
|
+
```asm
|
|
93
|
+
; Name: memcpy_zp_ptr
|
|
94
|
+
; In: src ptr in zp $00/$01, dst ptr in zp $02/$03, len in X
|
|
95
|
+
; Out: copied bytes
|
|
96
|
+
; Clobbers: A, X, flags N/Z/C
|
|
97
|
+
; Preserves: Y
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Master-file layout (DASM)
|
|
101
|
+
```asm
|
|
102
|
+
PROCESSOR 6502
|
|
103
|
+
|
|
104
|
+
INCDIR "src"
|
|
105
|
+
INCLUDE "constants.inc"
|
|
106
|
+
INCLUDE "zeropage.inc"
|
|
107
|
+
|
|
108
|
+
SEG CODE
|
|
109
|
+
ORG $8000
|
|
110
|
+
Reset: ; ...
|
|
111
|
+
|
|
112
|
+
SEG VECTORS
|
|
113
|
+
ORG $FFFA
|
|
114
|
+
.word NmiHandler, Reset, IrqHandler
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Compliance Checklist
|
|
118
|
+
- ! Startup/entry code explicitly defines runtime assumptions.
|
|
119
|
+
- ! Branch-range and page-crossing behavior considered in hot code.
|
|
120
|
+
- ! Routine flag/register clobbers are documented.
|
|
121
|
+
- ! `PROCESSOR` is declared once and first in DASM master source.
|
|
122
|
+
- ! Segment/output format policy is explicit and consistent with linker/loader expectations.
|
|
123
|
+
- ! Strict syntax mode and deterministic build options are used in automation.
|
|
124
|
+
|
|
125
|
+
## Sources
|
|
126
|
+
- MOS Technology, *MCS6500 Microcomputer Family Programming Manual* (1976): https://bitsavers.org/components/mosTechnology/6500-50A_MCS6500pgmManJan76.pdf
|
|
127
|
+
- DASM README (project + docs pointers): https://raw.githubusercontent.com/dasm-assembler/dasm/master/README
|
|
128
|
+
- DASM user text documentation (`docs/dasm.txt`): https://raw.githubusercontent.com/dasm-assembler/dasm/master/docs/dasm.txt
|
|
129
|
+
- NESdev: 6502 optimization patterns: https://www.nesdev.org/wiki/6502_assembly_optimisations
|
|
130
|
+
- NESdev: cycle-counting guidance: https://www.nesdev.org/wiki/Cycle_counting
|
|
131
|
+
- Obelisk/NESdev timing reference landing (linked from cycle docs): http://www.obelisk.me.uk/6502/
|
|
132
|
+
- Masswerk 6502 instruction-set reference: https://www.masswerk.at/6502/6502_instruction_set.html
|
package/languages/c.md
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
# C Standards
|
|
2
|
+
|
|
3
|
+
Legend (from RFC2119): !=MUST, ~=SHOULD, ≉=SHOULD NOT, ⊗=MUST NOT, ?=MAY.
|
|
4
|
+
|
|
5
|
+
**⚠️ See also**: [main.md](../../main.md) | [PROJECT.md](../../PROJECT.md) | [telemetry.md](../tools/telemetry.md)
|
|
6
|
+
|
|
7
|
+
**Stack**: C17/C23, CMake 3.25+, clang/GCC; Testing: Unity/cmocka; Analysis: clang-tidy, cppcheck, AddressSanitizer
|
|
8
|
+
|
|
9
|
+
## Standards
|
|
10
|
+
|
|
11
|
+
### Documentation
|
|
12
|
+
- ! Doxygen comments for all public APIs (functions, types, macros)
|
|
13
|
+
- ! File header: purpose, author, date, license
|
|
14
|
+
- ! Document preconditions, postconditions, return values, and error conditions
|
|
15
|
+
- ~ Use `/** */` Doxygen style; `//` for inline comments
|
|
16
|
+
|
|
17
|
+
### Testing
|
|
18
|
+
See [testing.md](../coding/testing.md).
|
|
19
|
+
|
|
20
|
+
- ! Use Unity (embedded/general) or cmocka (mocking) for unit tests
|
|
21
|
+
- ? Use Check or CUnit as alternatives
|
|
22
|
+
- Files: `test_*.c` or `*_test.c`
|
|
23
|
+
|
|
24
|
+
### Coverage
|
|
25
|
+
- ! ≥85% coverage
|
|
26
|
+
- ! Count src/\*
|
|
27
|
+
- ! Exclude entry points, generated code, vendor/third-party
|
|
28
|
+
|
|
29
|
+
### Style
|
|
30
|
+
- ! Use clang-format (project `.clang-format` required)
|
|
31
|
+
- ! Use clang-tidy for static analysis
|
|
32
|
+
- ~ Use cppcheck as supplementary static analysis
|
|
33
|
+
- ! Consistent brace style (K&R or Allman — pick one, enforce via clang-format)
|
|
34
|
+
- ! Column limit: 100 characters
|
|
35
|
+
|
|
36
|
+
### Naming Conventions
|
|
37
|
+
- ! `snake_case` for functions, variables, and file names
|
|
38
|
+
- ! `UPPER_SNAKE_CASE` for macros and constants
|
|
39
|
+
- ! `snake_case_t` suffix for `typedef` types: `typedef struct pixel pixel_t;`
|
|
40
|
+
- ! Prefix public API symbols with module/library name: `mylib_init()`, `mylib_destroy()`
|
|
41
|
+
- ~ Prefix static (file-scope) functions with `_` or keep unprefixed but `static`
|
|
42
|
+
- ⊗ Pollute global namespace with short, generic names
|
|
43
|
+
|
|
44
|
+
### Types & Integers
|
|
45
|
+
- ! Use `<stdint.h>` fixed-width types (`uint8_t`, `int32_t`, `size_t`) for portable code
|
|
46
|
+
- ! Use `size_t` for sizes, lengths, and array indices
|
|
47
|
+
- ! Use `bool` from `<stdbool.h>` (not `int` for boolean logic)
|
|
48
|
+
- ! Use `enum` for related constants; ⊗ `#define` chains for enumerable values
|
|
49
|
+
- ~ Use `const` aggressively for read-only data and pointer targets
|
|
50
|
+
- ⊗ Rely on implicit `int` (removed in C99+)
|
|
51
|
+
- ⊗ Assume `char` is signed or unsigned — use `unsigned char` or `uint8_t` for byte data
|
|
52
|
+
|
|
53
|
+
### Memory Management
|
|
54
|
+
- ! Every `malloc`/`calloc`/`realloc` has a corresponding `free` on all code paths
|
|
55
|
+
- ! Check return value of `malloc`/`calloc`/`realloc` for `NULL`
|
|
56
|
+
- ! Set pointers to `NULL` after `free` to prevent use-after-free
|
|
57
|
+
- ! Use `calloc` over `malloc` + `memset` for zero-initialized allocations
|
|
58
|
+
- ! Prefer stack allocation for small, fixed-size data
|
|
59
|
+
- ⊗ Use `realloc` on `NULL` without checking the return value
|
|
60
|
+
- ⊗ Cast the return value of `malloc` (unnecessary in C, hides missing `#include`)
|
|
61
|
+
- ~ Use a consistent allocation/deallocation pattern (init/destroy, open/close)
|
|
62
|
+
- ~ Use `memset_explicit()` (C23) to clear sensitive data before freeing
|
|
63
|
+
- ? Use arena/pool allocators for performance-critical paths
|
|
64
|
+
|
|
65
|
+
### Strings & Buffers
|
|
66
|
+
- ! Always bounds-check string operations; ⊗ `strcpy`, `strcat`, `sprintf`, `gets`
|
|
67
|
+
- ! Use `snprintf` over `sprintf`; `strncpy`/`strlcpy` over `strcpy`
|
|
68
|
+
- ! Null-terminate all strings explicitly when building manually
|
|
69
|
+
- ! Pass buffer size alongside buffer pointer in all function signatures
|
|
70
|
+
- ⊗ Use `gets()` — removed in C11
|
|
71
|
+
- ~ Use `strnlen` to safely determine string length on untrusted input
|
|
72
|
+
|
|
73
|
+
### Error Handling
|
|
74
|
+
- ! Check return values of all standard library and system calls
|
|
75
|
+
- ! Use a consistent error pattern: return codes (0 = success, negative = error) or errno
|
|
76
|
+
- ! Set `errno = 0` before calls that use it; check `errno` only after failure indication
|
|
77
|
+
- ! Document error codes for every public function
|
|
78
|
+
- ~ Use `goto cleanup` pattern for multi-resource cleanup (not deeply nested `if`s)
|
|
79
|
+
- ⊗ Silently ignore return values of I/O, allocation, or system calls
|
|
80
|
+
|
|
81
|
+
### Preprocessor
|
|
82
|
+
- ! Use include guards (`#ifndef`/`#define`/`#endif`) or `#pragma once` in all headers
|
|
83
|
+
- ! Wrap multi-statement macros in `do { ... } while(0)`
|
|
84
|
+
- ! Parenthesize all macro parameters: `#define MAX(a,b) ((a) > (b) ? (a) : (b))`
|
|
85
|
+
- ~ Prefer `static inline` functions over function-like macros when possible
|
|
86
|
+
- ⊗ Define macros that rely on implicit variable names from the calling context
|
|
87
|
+
- ⊗ Use `#define` to redefine standard library functions or keywords
|
|
88
|
+
|
|
89
|
+
### Concurrency
|
|
90
|
+
- ! Use `<threads.h>` (C11) or POSIX `<pthread.h>` for threading
|
|
91
|
+
- ! Protect shared data with mutexes; document locking order
|
|
92
|
+
- ! Use `_Atomic` types or `<stdatomic.h>` for lock-free shared variables
|
|
93
|
+
- ⊗ Use `volatile` as a synchronization mechanism (it is not one)
|
|
94
|
+
- ~ Prefer message-passing or work-queue patterns over shared mutable state
|
|
95
|
+
- ~ Use Thread Sanitizer (`-fsanitize=thread`) to detect races in CI
|
|
96
|
+
|
|
97
|
+
### Undefined Behavior
|
|
98
|
+
- ⊗ Rely on undefined behavior (signed overflow, null deref, out-of-bounds, etc.)
|
|
99
|
+
- ! Enable `-Wall -Wextra -Wpedantic -Werror` in CI builds
|
|
100
|
+
- ! Enable sanitizers in debug/CI: `-fsanitize=address,undefined`
|
|
101
|
+
- ~ Enable `-Wconversion -Wshadow -Wformat=2` for stricter checks
|
|
102
|
+
- ~ Use `_Static_assert` (C11) / `static_assert` (C23) for compile-time invariants
|
|
103
|
+
|
|
104
|
+
### Safety & Security
|
|
105
|
+
- ! Follow [SEI CERT C Coding Standard](https://wiki.sei.cmu.edu/confluence/display/c) for security-sensitive code
|
|
106
|
+
- ! Validate all external input (user, file, network)
|
|
107
|
+
- ⊗ Hardcode secrets, keys, or credentials in source
|
|
108
|
+
- ⊗ Use `system()` with user-supplied input
|
|
109
|
+
- ~ Use ASLR, stack canaries, and `-fstack-protector-strong` in production builds
|
|
110
|
+
- ? Follow MISRA C for safety-critical/embedded projects
|
|
111
|
+
|
|
112
|
+
### Telemetry
|
|
113
|
+
- See [telemetry.md](../tools/telemetry.md)
|
|
114
|
+
- ~ Structured logging to stderr/syslog for production
|
|
115
|
+
- ? Sentry Native SDK for crash reporting
|
|
116
|
+
- ? OpenTelemetry C for distributed tracing
|
|
117
|
+
|
|
118
|
+
## Commands
|
|
119
|
+
|
|
120
|
+
See [commands.md](./commands.md).
|
|
121
|
+
|
|
122
|
+
## Patterns
|
|
123
|
+
|
|
124
|
+
### Goto Cleanup
|
|
125
|
+
```c
|
|
126
|
+
int process_file(const char *path) {
|
|
127
|
+
int result = -1;
|
|
128
|
+
FILE *fp = NULL;
|
|
129
|
+
char *buf = NULL;
|
|
130
|
+
fp = fopen(path, "r"); if (!fp) goto cleanup;
|
|
131
|
+
buf = malloc(BUF_SIZE); if (!buf) goto cleanup;
|
|
132
|
+
if (fread(buf, 1, BUF_SIZE, fp) == 0) goto cleanup;
|
|
133
|
+
result = do_work(buf);
|
|
134
|
+
cleanup:
|
|
135
|
+
free(buf); // free(NULL) is safe
|
|
136
|
+
if (fp) fclose(fp);
|
|
137
|
+
return result;
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Opaque Types
|
|
142
|
+
```c
|
|
143
|
+
// mylib.h
|
|
144
|
+
typedef struct mylib_ctx mylib_ctx_t;
|
|
145
|
+
mylib_ctx_t *mylib_create(const char *config);
|
|
146
|
+
int mylib_process(mylib_ctx_t *ctx, const void *data, size_t len);
|
|
147
|
+
void mylib_destroy(mylib_ctx_t *ctx);
|
|
148
|
+
// mylib.c
|
|
149
|
+
struct mylib_ctx { int fd; size_t count; char name[64]; };
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Testing (Unity + cmocka)
|
|
153
|
+
```c
|
|
154
|
+
// Unity
|
|
155
|
+
#include "unity.h"
|
|
156
|
+
#include "calculator.h"
|
|
157
|
+
void setUp(void) {} void tearDown(void) {}
|
|
158
|
+
void test_add(void) { TEST_ASSERT_EQUAL_INT(5, calc_add(2, 3)); }
|
|
159
|
+
void test_overflow(void) { TEST_ASSERT_EQUAL_INT(CALC_ERR_OVERFLOW, calc_add(INT_MAX, 1)); }
|
|
160
|
+
int main(void) { UNITY_BEGIN(); RUN_TEST(test_add); RUN_TEST(test_overflow); return UNITY_END(); }
|
|
161
|
+
|
|
162
|
+
// cmocka (--wrap linker flag for mocking)
|
|
163
|
+
#include <cmocka.h>
|
|
164
|
+
int __wrap_socket_send(int fd, const void *buf, size_t len) {
|
|
165
|
+
check_expected(fd); check_expected(len); return mock_type(int);
|
|
166
|
+
}
|
|
167
|
+
static void test_send_retries(void **state) {
|
|
168
|
+
(void)state;
|
|
169
|
+
expect_value(__wrap_socket_send, fd, 42); expect_value(__wrap_socket_send, len, 10);
|
|
170
|
+
will_return(__wrap_socket_send, -1);
|
|
171
|
+
expect_value(__wrap_socket_send, fd, 42); expect_value(__wrap_socket_send, len, 10);
|
|
172
|
+
will_return(__wrap_socket_send, 10);
|
|
173
|
+
assert_int_equal(0, network_send_with_retry(42, "0123456789", 10));
|
|
174
|
+
}
|
|
175
|
+
int main(void) {
|
|
176
|
+
const struct CMUnitTest t[] = { cmocka_unit_test(test_send_retries) };
|
|
177
|
+
return cmocka_run_group_tests(t, NULL, NULL);
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Macros & Static Assertions
|
|
182
|
+
```c
|
|
183
|
+
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
|
|
184
|
+
#define LOG_ERROR(fmt, ...) do { fprintf(stderr, "[ERROR] %s:%d: " fmt "\n", __FILE__, __LINE__, ##__VA_ARGS__); } while (0)
|
|
185
|
+
static_assert(sizeof(int) >= 4); // C23
|
|
186
|
+
_Static_assert(sizeof(uint32_t) == 4, "uint32_t must be 4 bytes"); // C11
|
|
187
|
+
_Static_assert(offsetof(struct packet, checksum) == 12, "checksum at offset 12");
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Build Configuration
|
|
191
|
+
|
|
192
|
+
**CMake** (3.25+): C17/C23 standard, extensions off, `-Wall -Wextra -Wpedantic -Werror -Wconversion -Wshadow -Wformat=2`; add sanitizers (`-fsanitize=address,undefined`) in Debug; optional `--coverage` flag.
|
|
193
|
+
|
|
194
|
+
**`.clang-format`**: `BasedOnStyle: LLVM`, `IndentWidth: 4`, `ColumnLimit: 100`, `BreakBeforeBraces: Linux`, `PointerAlignment: Right`, `SortIncludes: CaseInsensitive`
|
|
195
|
+
|
|
196
|
+
**`.clang-tidy`**: Enable `clang-diagnostic-*`, `clang-analyzer-*`, `cert-*`, `bugprone-*`, `performance-*`, `readability-*`, `misc-*`; `WarningsAsErrors: '*'`
|
|
197
|
+
|
|
198
|
+
## Anti-Patterns
|
|
199
|
+
|
|
200
|
+
Items marked ⊗ in Standards above are not repeated here.
|
|
201
|
+
|
|
202
|
+
- ≉ **Deep nesting**: Use functions or `goto cleanup`
|
|
203
|
+
- ≉ **Tagless typedef struct**: Include struct tag for forward declarations
|
|
204
|
+
- ≉ **Mixing signed/unsigned**: Explicit casts + `-Wconversion`
|
|
205
|
+
- ≉ **Global mutable state**: Pass state via struct pointers
|
|
206
|
+
|
|
207
|
+
## Hygiene
|
|
208
|
+
|
|
209
|
+
**Types:**
|
|
210
|
+
- ⊗ Implicit `int` return type or implicit function declarations — illegal in C99+; always declare explicitly
|
|
211
|
+
- ⊗ `void*` casts without an inline comment explaining why a generic pointer is necessary
|
|
212
|
+
- ⊗ `int` used as a boolean — use `bool` (`<stdbool.h>`, C99+) for clarity
|
|
213
|
+
|
|
214
|
+
**Error handling:**
|
|
215
|
+
- ⊗ Ignoring return values of `malloc`, `fread`, `fwrite`, `fclose`, or any function that signals failure via return value
|
|
216
|
+
- ⊗ Empty error branches — all error paths must log, clean up, or propagate
|
|
217
|
+
- ~ Use `-Wunused-result` and `__attribute__((warn_unused_result))` to enforce checked return values at the compiler level
|
|
218
|
+
|
|
219
|
+
**Dead code:**
|
|
220
|
+
- ~ Run `cppcheck --enable=unusedFunction,unusedVariable` to detect dead functions and variables
|
|
221
|
+
- ~ `-Wunused-function` and `-Wunused-variable` compiler flags catch file-local dead code
|
|
222
|
+
- ⊗ `#pragma GCC diagnostic ignored "-Wunused-function"` to suppress rather than remove dead code
|
|
223
|
+
|
|
224
|
+
## Compliance Checklist
|
|
225
|
+
|
|
226
|
+
- ! Doxygen comments for all public APIs
|
|
227
|
+
- ! See [testing.md](../coding/testing.md) for testing requirements
|
|
228
|
+
- ! Use clang-format and clang-tidy
|
|
229
|
+
- ! `-Wall -Wextra -Wpedantic -Werror` in CI
|
|
230
|
+
- ! Sanitizers enabled in debug/CI builds
|
|
231
|
+
- ! All allocations checked; all resources freed
|
|
232
|
+
- ! Bounds-checked string/buffer operations; ⊗ `strcpy`/`sprintf`/`gets`
|
|
233
|
+
- ! Follow SEI CERT C for security-sensitive code
|
|
234
|
+
- ⊗ Undefined behavior (signed overflow, null deref, out-of-bounds)
|
|
235
|
+
- ! Run `task check` before commit
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Standard Task Commands
|
|
2
|
+
|
|
3
|
+
Legend (from RFC2119): !=MUST, ~=SHOULD, ≉=SHOULD NOT, ⊗=MUST NOT, ?=MAY.
|
|
4
|
+
|
|
5
|
+
All language standards files use the task commands below. Language-specific files list only deviations or additions.
|
|
6
|
+
|
|
7
|
+
## Default Commands
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
task build # Build
|
|
11
|
+
task test # Run all tests (unit, integration)
|
|
12
|
+
task test:coverage # Run tests with coverage report
|
|
13
|
+
task fmt # Format
|
|
14
|
+
task lint # Lint / static analysis
|
|
15
|
+
task quality # All quality checks
|
|
16
|
+
task check # Pre-commit (! run: fmt+lint+build+test)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Naming Conventions
|
|
20
|
+
|
|
21
|
+
- ! Single-language projects use generic names: `build`, `fmt`, `lint`, `test`
|
|
22
|
+
- ! Multi-language projects use namespaced names: `go:fmt`, `py:lint`, `rs:build`
|
|
23
|
+
- See [taskfile.md](../tools/taskfile.md#naming-conventions) for full details
|
package/languages/cpp.md
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# C++ Standards
|
|
2
|
+
|
|
3
|
+
Legend (from RFC2119): !=MUST, ~=SHOULD, ≉=SHOULD NOT, ⊗=MUST NOT, ?=MAY.
|
|
4
|
+
|
|
5
|
+
**⚠️ See also**: [main.md](../../main.md) | [PROJECT.md](../../PROJECT.md) | [telemetry.md](../tools/telemetry.md)
|
|
6
|
+
|
|
7
|
+
**Stack**: C++20/23, CMake 3.25+, Catch2/GoogleTest, GSL (Guidelines Support Library); CLI: CLI11; TUI: FTXUI; Async: Asio/libcoro
|
|
8
|
+
|
|
9
|
+
## Standards
|
|
10
|
+
|
|
11
|
+
### Documentation
|
|
12
|
+
- ! Doxygen comments for all public APIs (classes, functions, namespaces)
|
|
13
|
+
|
|
14
|
+
### Testing
|
|
15
|
+
See [testing.md](../coding/testing.md).
|
|
16
|
+
|
|
17
|
+
- ! Use Catch2 or GoogleTest (+ GoogleMock for mocking)
|
|
18
|
+
- Files: `test_*.cpp` or `*_test.cpp`
|
|
19
|
+
|
|
20
|
+
### Coverage
|
|
21
|
+
- ! ≥85% coverage
|
|
22
|
+
- ! Count src/\*
|
|
23
|
+
- ! Exclude main, examples, generated code
|
|
24
|
+
|
|
25
|
+
### Style
|
|
26
|
+
- ! Use clang-format (Google/LLVM/Mozilla style)
|
|
27
|
+
- ! Use clang-tidy for linting
|
|
28
|
+
|
|
29
|
+
### Types
|
|
30
|
+
- ~ Use strong typing (enums, type aliases)
|
|
31
|
+
- ~ Prefer `std::optional`/`std::variant`/`std::expected` for expected errors
|
|
32
|
+
|
|
33
|
+
### Telemetry
|
|
34
|
+
- See [telemetry.md](../tools/telemetry.md)
|
|
35
|
+
- ~ Structured logging (spdlog) for production
|
|
36
|
+
- ~ Sentry.io for error tracking
|
|
37
|
+
- ? OpenTelemetry C++ for distributed tracing
|
|
38
|
+
|
|
39
|
+
### Safety
|
|
40
|
+
- ! Avoid buffer overflows
|
|
41
|
+
- ~ Use GSL (`gsl::span`, `gsl::not_null`, `gsl::owner`)
|
|
42
|
+
- ⊗ Use raw arrays or naked pointers for ownership
|
|
43
|
+
|
|
44
|
+
### Interfaces
|
|
45
|
+
- ! Design clear, minimal interfaces
|
|
46
|
+
- ~ Use abstract base classes or concepts for polymorphism
|
|
47
|
+
|
|
48
|
+
## Commands
|
|
49
|
+
|
|
50
|
+
See [commands.md](./commands.md).
|
|
51
|
+
|
|
52
|
+
## Patterns
|
|
53
|
+
|
|
54
|
+
### Testing
|
|
55
|
+
- **Catch2**: `TEST_CASE("desc", "[tag]") { SECTION("case") { REQUIRE(result == expected); } }`
|
|
56
|
+
- **GoogleTest**: `TEST(Suite, Name) { EXPECT_EQ(actual, expected); ASSERT_TRUE(cond); }`
|
|
57
|
+
- **GoogleMock**: `MOCK_METHOD(RetType, MethodName, (Args...), (override));` + `EXPECT_CALL(...)`
|
|
58
|
+
|
|
59
|
+
### Core Patterns
|
|
60
|
+
- **RAII**: ! Use smart pointers (`std::unique_ptr`, `std::shared_ptr`); ⊗ raw `new`/`delete`
|
|
61
|
+
- **Error Handling**: ~ Use `std::expected<T,E>` for expected errors (file not found, parse failure); ~ exceptions with RAII for bugs/resource exhaustion
|
|
62
|
+
- **Containers**: ! Use `std::vector`, `std::array`, `std::span`; ⊗ C arrays
|
|
63
|
+
- **String Views**: ~ Use `std::string_view` for read-only params
|
|
64
|
+
- **Bounds Safety**: ! Use `.at()` for checked access or range-based loops; ~ use `gsl::span` for array views
|
|
65
|
+
- **Const Correctness**: ! Mark methods `const` when they don't modify state; ~ use `const&` for input params
|
|
66
|
+
- **Namespaces**: ! Organize code in namespaces; ⊗ `using namespace` in headers
|
|
67
|
+
- **Modern Loops**: ~ Use `for (const auto& item : container)` instead of manual indexing
|
|
68
|
+
- **Initialization**: ~ Use brace-init `{}` over `()` to avoid narrowing/most-vexing-parse
|
|
69
|
+
- **Templates**: ~ Use concepts (C++20) to constrain template parameters
|
|
70
|
+
- **Rule of Zero/Five**: ~ Let compiler generate special members OR define all 5
|
|
71
|
+
|
|
72
|
+
## Build Configuration
|
|
73
|
+
|
|
74
|
+
**CMake essentials**:
|
|
75
|
+
- ! C++20/23, CMake 3.25+
|
|
76
|
+
- ! Warnings: `-Wall -Wextra -Wpedantic -Werror`
|
|
77
|
+
- ! Coverage: `--coverage` flag when `ENABLE_COVERAGE=ON`
|
|
78
|
+
- ! Dependencies: `find_package(Microsoft.GSL)`, `find_package(Catch2 3)` or `GTest`
|
|
79
|
+
|
|
80
|
+
**clang-format**: BasedOnStyle: Google/LLVM/Mozilla, ColumnLimit: 100, PointerAlignment: Left
|
|
81
|
+
|
|
82
|
+
**clang-tidy**: Enable clang-diagnostic, clang-analyzer, cppcoreguidelines, modernize, performance, readability; WarningsAsErrors: "*"
|
|
83
|
+
|
|
84
|
+
## GSL (Guidelines Support Library)
|
|
85
|
+
|
|
86
|
+
~ Use GSL for bounds and null safety:
|
|
87
|
+
|
|
88
|
+
- **gsl::span<T>**: Array view with bounds checking (instead of pointer+size)
|
|
89
|
+
- **gsl::not_null<T*>**: Non-nullable pointer guarantee (no null checks needed)
|
|
90
|
+
- **gsl::owner<T*>**: Ownership annotation (prefer smart pointers)
|
|
91
|
+
|
|
92
|
+
**Installation**: `find_package(Microsoft.GSL CONFIG REQUIRED)` in CMake
|
|
93
|
+
|
|
94
|
+
## Interface Design
|
|
95
|
+
|
|
96
|
+
~ Follow C++ Core Guidelines:
|
|
97
|
+
|
|
98
|
+
- **I.1**: Make interfaces explicit (clear preconditions/postconditions)
|
|
99
|
+
- **I.2**: Avoid non-const global variables (use const or pass as params)
|
|
100
|
+
- **I.4**: Use strong typing (`enum class Status`, `struct UserId`, not raw ints)
|
|
101
|
+
- **I.11**: Never transfer ownership by raw pointer (use `std::unique_ptr<T>`)
|
|
102
|
+
- **I.13**: Don't pass arrays as single pointers (use `gsl::span<T>`)
|
|
103
|
+
|
|
104
|
+
**Polymorphism**: ~ Abstract base classes OR concepts (C++20)
|
|
105
|
+
|
|
106
|
+
## Hygiene
|
|
107
|
+
|
|
108
|
+
**Types:**
|
|
109
|
+
- ⊗ `void*` where a typed pointer, `std::variant`, or template parameter is feasible
|
|
110
|
+
- ⊗ C-style casts `(T)x` — use `static_cast`, `reinterpret_cast`, or `dynamic_cast` explicitly
|
|
111
|
+
- ~ Mark functions `[[nodiscard]]` when callers must not ignore the return value
|
|
112
|
+
|
|
113
|
+
**Error handling:**
|
|
114
|
+
- ⊗ Empty `catch(...)` or `catch(std::exception&) {}` that swallow exceptions silently
|
|
115
|
+
- ⊗ Discarding `[[nodiscard]]` return values without explicit `(void)` cast and inline comment
|
|
116
|
+
- ⊗ Using exceptions for control flow in tight loops — use `std::expected` (C++23) or error codes
|
|
117
|
+
|
|
118
|
+
**Dead code:**
|
|
119
|
+
- ~ Run `cppcheck --enable=unusedFunction` to detect unreferenced functions
|
|
120
|
+
- ~ clang-tidy `misc-unused-*` and `readability-function-cognitive-complexity` checks surface dead helpers
|
|
121
|
+
- ⊗ `// NOLINT` or `#pragma warning(disable:...)` without an inline explanation
|
|
122
|
+
|
|
123
|
+
## Compliance Checklist
|
|
124
|
+
|
|
125
|
+
- ! Include Doxygen comments for all public APIs
|
|
126
|
+
- ! See [testing.md](../coding/testing.md) for testing requirements
|
|
127
|
+
- ! Use clang-format and clang-tidy
|
|
128
|
+
- ! Follow C++ Core Guidelines for interfaces, resource management, and safety
|
|
129
|
+
- ~ Use GSL types (`gsl::span`, `gsl::not_null`) for bounds/null safety
|
|
130
|
+
- ! Distinguish expected errors (`std::expected`) from exceptional errors (exceptions)
|
|
131
|
+
- ⊗ Use raw arrays, naked `new`/`delete`, or unchecked array access
|
|
132
|
+
- ! Run `task check` before commit
|