@h2loop/safe-c-coding-plugin 0.3.0 → 0.3.1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h2loop/safe-c-coding-plugin",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Safe-C coding plugin for Hydron — MISRA C:2012-aligned defensive C/C++ guidelines as an always-on skill plus a safe-c-reviewer subagent",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -22,8 +22,8 @@ Short list, verified on every function you write or edit. Everything else lives
|
|
|
22
22
|
3. **No dynamic memory, recursion, VLAs, `exit`/`abort`/`longjmp`, or unbounded string functions** — use the substitutes in guidelines.md.
|
|
23
23
|
4. **No implicit narrowing and no signed/unsigned mixing** — every conversion explicit.
|
|
24
24
|
5. **Braces on every body, a `default` on every `switch`, every return value used or `(void)`-discarded.**
|
|
25
|
-
6. **Every identifier you reference is one you have actually read in a declaration.**
|
|
26
|
-
7. **Every guard you add must be able to fail.**
|
|
25
|
+
6. **Every identifier you reference is one you have actually read in a declaration.** A plausible invented name — a size/count macro that feels like it must accompany a table, a member named after the quantity it holds rather than its declared name — is a compile error, not a style blemish. Full rule: see guidelines.md § General.
|
|
26
|
+
7. **Every guard you add must be able to fail.** A guard whose tested value is fixed at compile time (a macro, enum constant, `sizeof`, `const` with a visible initialiser, a declared object's address) has one permanent answer — that's an always-true/-false controlling expression, a dead-code violation, not extra safety; check it with `#if`/a static assertion instead. This does **not** loosen items 1 and 2: a value that arrives as a parameter or is read from a global, struct, or device is precisely the varying kind and still needs its real `if` guard. Full rule: see guidelines.md § Control flow.
|
|
27
27
|
|
|
28
28
|
Where one of these clashes with the surrounding house style, follow the guideline in the code you write and note the divergence in one line.
|
|
29
29
|
|
|
@@ -72,7 +72,7 @@ Walk the lines you wrote — not the whole file — and answer each question exp
|
|
|
72
72
|
6. **Every branch construct**: braced bodies, a `default` in every `switch`, a terminating `else` where the chain must be exhaustive.
|
|
73
73
|
7. **Anything on the banned-facility list** (dynamic memory, recursion, VLAs, `exit`/`abort`/`longjmp`, unbounded string functions): replaced by its substitute, or deviated from with a written justification.
|
|
74
74
|
|
|
75
|
-
State the result of the audit
|
|
75
|
+
State the result of the audit before you finish: for every Critical or Standard finding raised — by the reviewer subagent or by your own re-read — name the finding and the specific edit that resolved it. "Audit passed" or "no issues found" with no re-read behind it is not an audit; a finding with no matching fix next to it is not an audit either.
|
|
76
76
|
|
|
77
77
|
## Preferred patterns
|
|
78
78
|
|