Pārlūkot izejas kodu

doc: meta documentation and common pattern tracking

KernelDeimos 11 mēneši atpakaļ
vecāks
revīzija
3b9a74c0cb
2 mainītis faili ar 52 papildinājumiem un 0 dzēšanām
  1. 28 0
      doc/contributors/comment_prefixes.md
  2. 24 0
      doc/devmeta/track-comments.md

+ 28 - 0
doc/contributors/comment_prefixes.md

@@ -0,0 +1,28 @@
+# Comment Prefixes
+
+Comments have prefixes using
+[Conventional: Comments](https://conventionalcomments.org/)
+as a **loose** guideline, and using this markdown file as a
+the actual guideline.
+
+This document will be updated on an _as-needed_ basis.
+
+## The rules
+
+- A comment line always looks like this:
+  - A whitespace character
+  - Optional prefix matching `/[a-z-]+\([a-z-]a+\):/`
+  - A whitespace character
+  - The comment
+- Formalized prefixes must follow the rules below
+- Any other prefix can be used. After some uses it
+  might be good to formalize it, but that's not a hard rule.
+
+## Formalized prefixes
+
+- `todo:` is interchangable with the famous `TODO:`, **except:**
+  when lowercase (`todo:`) it can include a scope: `todo(security):`.
+- `track:` is used to track common patterns.
+  - Anything written after `track:` must be registered in
+    [track-comments.md](../devmeta/track-comments.md)
+

+ 24 - 0
doc/devmeta/track-comments.md

@@ -0,0 +1,24 @@
+# Track Comments
+
+Comments beginning with `// track:`. See
+[comment_prefixes.md](../contributors/comment_prefixes.md)
+
+## Track Comment Registry
+
+- `track: type check`:
+  A condition that's used to check the type of an imput.
+- `track: bounds check`:
+  A condition that's used to check the bounds of an array
+  or other list-like entity.
+- `track: ruleset`
+  A series of conditions that early-return or `continue`
+- `track: object description in comment`
+  A comment above the creation of some object which
+  could potentially have a `description` property.
+  This is especially relevant if the object is stored
+  in some kind of registry where multiple objects
+  could be listed in the console.
+- `track: slice a prefix`
+  A common pattern where a prefix string is "sliced off"
+  of another string to obtain a significant value, such
+  as an indentifier.