@gspothq/cli 0.1.1 → 0.2.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/README.md +58 -11
- package/configurations/database/postgres/manifest.toml +51 -57
- package/configurations/database/postgres/rules/POSTGRES.md +14 -13
- package/configurations/framework/astro/manifest.toml +33 -35
- package/configurations/framework/astro/rules/ASTRO.md +2 -2
- package/configurations/framework/expo/manifest.toml +19 -19
- package/configurations/framework/express/manifest.toml +10 -4
- package/configurations/framework/express/rules/EXPRESS.md +9 -7
- package/configurations/framework/fastapi/manifest.toml +9 -3
- package/configurations/framework/fastapi/rules/FASTAPI.md +19 -18
- package/configurations/framework/nestjs/manifest.toml +12 -12
- package/configurations/framework/nestjs/rules/NESTJS.md +9 -9
- package/configurations/framework/nextjs/manifest.toml +39 -79
- package/configurations/framework/nextjs/rules/NEXTJS.md +9 -7
- package/configurations/framework/nextjs/tool-files/semgrep/nextjs.yml +35 -0
- package/configurations/framework/react/manifest.toml +33 -43
- package/configurations/framework/react/rules/REACT.md +14 -20
- package/configurations/framework/react-dom/manifest.toml +6 -6
- package/configurations/framework/react-native/manifest.toml +11 -11
- package/configurations/framework/react-native/rules/REACT-NATIVE.md +3 -5
- package/configurations/framework/site/manifest.toml +57 -110
- package/configurations/framework/site/rules/SITE.md +1 -1
- package/configurations/framework/svelte/manifest.toml +29 -31
- package/configurations/framework/svelte/rules/SVELTE.md +6 -6
- package/configurations/framework/vue/manifest.toml +37 -37
- package/configurations/framework/vue/rules/VUE.md +6 -6
- package/configurations/general/commits/manifest.toml +20 -84
- package/configurations/general/commits/rules/GIT.md +24 -13
- package/configurations/general/coverage/manifest.toml +1 -1
- package/configurations/general/dependencies/manifest.toml +47 -107
- package/configurations/general/dependencies/rules/DEPENDENCIES.md +13 -7
- package/configurations/general/docs/manifest.toml +28 -43
- package/configurations/general/docs/rules/DOCS.md +16 -9
- package/configurations/general/duplication/manifest.toml +12 -14
- package/configurations/general/engineering/manifest.toml +6 -2
- package/configurations/general/engineering/rules/agent/PLANNING.md +9 -6
- package/configurations/general/engineering/rules/agent/SUPPRESSIONS.md +20 -11
- package/configurations/general/engineering/rules/agent/TASKS.md +6 -2
- package/configurations/general/engineering/rules/agent/WORKING.md +34 -29
- package/configurations/general/engineering/rules/code/ACCESSIBILITY.md +9 -7
- package/configurations/general/engineering/rules/code/CLI.md +12 -9
- package/configurations/general/engineering/rules/code/COMMENTS.md +11 -1
- package/configurations/general/engineering/rules/code/CONFIGURATION.md +2 -0
- package/configurations/general/engineering/rules/code/ERRORS.md +5 -3
- package/configurations/general/engineering/rules/code/HTTP.md +9 -10
- package/configurations/general/engineering/rules/code/LOGGING.md +10 -9
- package/configurations/general/engineering/rules/code/TESTING.md +18 -11
- package/configurations/general/files/manifest.toml +45 -73
- package/configurations/general/files/rules/YAML.md +20 -10
- package/configurations/general/format/manifest.toml +53 -106
- package/configurations/general/gspot/manifest.toml +19 -39
- package/configurations/general/gspot/rules/GENERATED.md +14 -4
- package/configurations/general/licenses/manifest.toml +12 -14
- package/configurations/general/naming/defaults.json +14 -13
- package/configurations/general/naming/manifest.toml +17 -17
- package/configurations/general/naming/rules/NAMING.md +87 -67
- package/configurations/general/prose/manifest.toml +166 -25
- package/configurations/general/prose/rules/WRITING.md +6 -2
- package/configurations/general/repository/manifest.toml +12 -12
- package/configurations/general/secrets/manifest.toml +52 -73
- package/configurations/general/secrets/rules/SECRETS.md +3 -1
- package/configurations/general/security/manifest.toml +29 -52
- package/configurations/general/security/rules/SECURITY.md +8 -6
- package/configurations/general/spelling/manifest.toml +15 -25
- package/configurations/general/structure/manifest.toml +31 -31
- package/configurations/infrastructure/ansible/manifest.toml +15 -15
- package/configurations/infrastructure/docker/manifest.toml +55 -67
- package/configurations/infrastructure/docker/rules/DOCKER.md +15 -13
- package/configurations/infrastructure/github-actions/manifest.toml +21 -41
- package/configurations/infrastructure/github-actions/rules/GITHUB-ACTIONS.md +16 -12
- package/configurations/infrastructure/github-actions/tool-files/zizmor.yml +5 -0
- package/configurations/infrastructure/nginx/manifest.toml +20 -20
- package/configurations/infrastructure/nginx/rules/NGINX.md +5 -4
- package/configurations/infrastructure/openapi/manifest.toml +20 -20
- package/configurations/infrastructure/openapi/rules/OPENAPI.md +3 -1
- package/configurations/infrastructure/xcode/manifest.toml +55 -75
- package/configurations/infrastructure/xcode/rules/XCODE.md +5 -3
- package/configurations/language/bash/manifest.toml +89 -170
- package/configurations/language/bash/rules/BASH.md +79 -17
- package/configurations/language/bash/rules/LANGUAGE.md +30 -26
- package/configurations/language/bash/rules/OPERATIONS.md +10 -8
- package/configurations/language/bash/rules/SAFETY.md +39 -35
- package/configurations/language/css/manifest.toml +22 -61
- package/configurations/language/css/rules/CSS.md +21 -2
- package/configurations/language/css/rules/TAILWIND.md +7 -5
- package/configurations/language/html/manifest.toml +16 -35
- package/configurations/language/html/rules/HTML.md +23 -5
- package/configurations/language/javascript/eslint-runtime-names.json +66 -61
- package/configurations/language/javascript/eslint-runtime.mjs +118 -0
- package/configurations/language/javascript/manifest.toml +135 -207
- package/configurations/language/javascript/rules/BUN.md +2 -2
- package/configurations/language/javascript/rules/COMPONENTS.md +4 -4
- package/configurations/language/javascript/rules/DENO.md +1 -1
- package/configurations/language/javascript/rules/JAVASCRIPT.md +30 -17
- package/configurations/language/javascript/rules/NODE.md +2 -2
- package/configurations/language/javascript/rules/PLAYWRIGHT.md +10 -9
- package/configurations/language/markdown/manifest.toml +20 -51
- package/configurations/language/python/manifest.toml +231 -342
- package/configurations/language/python/rules/DESIGN.md +40 -33
- package/configurations/language/python/rules/FLOW.md +8 -6
- package/configurations/language/python/rules/PACKAGING.md +14 -7
- package/configurations/language/python/rules/PYTHON.md +83 -33
- package/configurations/language/python/rules/TYPING.md +25 -23
- package/configurations/language/sql/manifest.toml +19 -37
- package/configurations/language/sql/rules/SQL.md +90 -2
- package/configurations/language/swift/manifest.toml +67 -78
- package/configurations/language/swift/rules/SWIFT.md +138 -40
- package/configurations/language/swift/rules/SWIFTUI.md +11 -9
- package/configurations/language/swift/rules/UIKIT.md +21 -19
- package/configurations/language/typescript/manifest.toml +34 -34
- package/configurations/language/typescript/rules/TYPESCRIPT.md +62 -10
- package/configurations/library/drizzle/manifest.toml +25 -38
- package/configurations/library/drizzle/rules/DRIZZLE.md +4 -2
- package/configurations/library/react-hook-form/manifest.toml +4 -4
- package/configurations/library/react-hook-form/rules/REACT-HOOK-FORM.md +15 -13
- package/configurations/library/tanstack-query/manifest.toml +6 -6
- package/configurations/library/tanstack-query/rules/TANSTACK-QUERY.md +5 -3
- package/configurations/library/testing-library/manifest.toml +6 -6
- package/configurations/library/translations/manifest.toml +22 -22
- package/configurations/library/translations/rules/NEXT-INTL.md +6 -8
- package/configurations/library/translations/rules/TRANSLATIONS.md +22 -23
- package/configurations/library/trpc/manifest.toml +3 -3
- package/configurations/library/trpc/rules/TRPC.md +8 -6
- package/configurations/library/zod/manifest.toml +6 -6
- package/configurations/library/zod/rules/ZOD.md +4 -2
- package/configurations/library/zustand/manifest.toml +4 -4
- package/configurations/library/zustand/rules/ZUSTAND.md +16 -14
- package/configurations/platform/cloudflare/manifest.toml +28 -47
- package/configurations/platform/cloudflare/rules/CLOUDFLARE.md +11 -6
- package/configurations/platform/supabase/manifest.toml +48 -61
- package/configurations/platform/supabase/rules/SUPABASE.md +27 -28
- package/configurations/testing/jest/manifest.toml +21 -22
- package/configurations/testing/pytest/manifest.toml +28 -28
- package/configurations/testing/swift-tests/manifest.toml +18 -29
- package/configurations/testing/swift-tests/rules/SWIFT-TESTS.md +7 -5
- package/configurations/testing/vitest/manifest.toml +32 -32
- package/configurations/testing/vitest/rules/VITEST.md +3 -1
- package/dist/gspot.js +22297 -24707
- package/dist/{linkinator-program.js → linkinator-process.js} +5 -7
- package/dist/{purgecss-program.js → purgecss-process.js} +12 -12
- package/package.json +7 -9
- package/configurations/infrastructure/github-actions/zizmor.yml +0 -3
- package/configurations/language/bash/rules/NAMING.md +0 -62
- package/configurations/language/css/rules/NAMING.md +0 -17
- package/configurations/language/html/rules/NAMING.md +0 -16
- package/configurations/language/javascript/rules/NAMING.md +0 -31
- package/configurations/language/markdown/markdownlint-cli2.mjs +0 -19
- package/configurations/language/python/rules/NAMING.md +0 -53
- package/configurations/language/sql/rules/NAMING.md +0 -90
- package/configurations/language/swift/rules/NAMING.md +0 -88
- package/configurations/language/typescript/rules/NAMING.md +0 -73
- package/configurations/library/swift-snapshot-testing/manifest.toml +0 -32
- package/dist/THIRD-PARTY-NOTICES.md +0 -25
- package/dist/eslint-rule-levels.json +0 -10
- package/dist/tool-versions.json +0 -3
- package/gspot.schema.json +0 -45991
- /package/{dist/LICENSE.md → LICENSE.md} +0 -0
- /package/configurations/framework/express/{semgrep → tool-files/semgrep}/express.yml +0 -0
- /package/configurations/framework/fastapi/{semgrep → tool-files/semgrep}/fastapi.yml +0 -0
- /package/configurations/general/dependencies/{syncpack.json → tool-files/syncpack.json} +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/LICENSES.md +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/ampm.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/conscious-language.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/contractions.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/currency.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/dashes.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/date-ordinals.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/dates.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/file-paths.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/future.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/hedging.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/history.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/idioms.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/interface-verbs.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/jargon.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/leading-conjunctions.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/link-text.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/locations.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/marketing.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/merge-conflict-markers.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/militaristic-language.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/modals.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/numbered-units.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/obvious-fields.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/ordinal-adverbs.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/percentage-numbers.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/placeholders.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/product-centric-writing.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/punctuated-headings.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/self-reference.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/session-identifiers.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/since.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/straight-quotes.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/suspended-hyphens.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/symbols.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/time-ranges.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/url-prepositions.yml +0 -0
- /package/configurations/general/prose/{vale → tool-files/vale}/styles/gspot/version-range.yml +0 -0
- /package/configurations/general/secrets/{gitleaks.toml → tool-files/gitleaks.toml} +0 -0
- /package/configurations/infrastructure/docker/{trivyignore → tool-files/trivyignore} +0 -0
- /package/configurations/language/bash/{semgrep → tool-files/semgrep}/bash.yml +0 -0
- /package/configurations/language/javascript/{semgrep → tool-files/semgrep}/javascript.yml +0 -0
- /package/configurations/language/swift/{semgrep → tool-files/semgrep}/swift.yml +0 -0
- /package/configurations/platform/cloudflare/{semgrep → tool-files/semgrep}/cloudflare.yml +0 -0
- /package/configurations/platform/supabase/{semgrep → tool-files/semgrep}/supabase.yml +0 -0
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
# Documentation
|
|
2
2
|
|
|
3
|
+
Read this rule when you write or change documentation.
|
|
4
|
+
|
|
3
5
|
## Before you write
|
|
4
6
|
|
|
5
7
|
Read the implementation and existing pages. Identify the reader, their task, starting state,
|
|
6
|
-
permissions, and risks. Describe supported behavior.
|
|
8
|
+
permissions, and risks. Describe supported behavior. Before the install steps, state limitations that rule out use.
|
|
7
9
|
|
|
8
10
|
Keep durable product information in its documentation. Link to its reference instead of copying
|
|
9
11
|
procedures or configuration tables. When behavior changes, update the reference and examples.
|
|
@@ -32,9 +34,9 @@ An example teaches one idea and uses the supported API. Include imports, setup,
|
|
|
32
34
|
readers need. Label an incomplete fragment and say what it omits. Keep volatile output out of
|
|
33
35
|
examples unless the public API defines its exact text.
|
|
34
36
|
|
|
35
|
-
State the starting
|
|
36
|
-
output from commands, or comment
|
|
37
|
-
when the
|
|
37
|
+
State the starting folder and prerequisites before commands. Explain placeholders. Separate
|
|
38
|
+
output from commands, or comment it out where a copied block must run. State the expected result
|
|
39
|
+
when the command output does not make success clear. Give each system alternative a complete procedure.
|
|
38
40
|
|
|
39
41
|
A destructive step names its scope, irreversible effects, backup, and recovery before the action.
|
|
40
42
|
Keep permissions, verification, and recovery beside the steps that need them. Use secure defaults
|
|
@@ -44,6 +46,11 @@ Keep authentication, retries, and advanced variants outside minimal examples unl
|
|
|
44
46
|
Start troubleshooting with the observable symptom and common causes. Diagnose before a reset or
|
|
45
47
|
other destructive recovery. Preserve exact public errors and remove private data from examples.
|
|
46
48
|
|
|
49
|
+
Do not write the current release number in prose or examples. Write `<version>` and say once where to find the
|
|
50
|
+
number, or generate the text from the dependency file.
|
|
51
|
+
|
|
52
|
+
A test runs or parses each command and each settings file that a page shows.
|
|
53
|
+
|
|
47
54
|
## Reference pages
|
|
48
55
|
|
|
49
56
|
Use the names and values of the API the page documents. Explain public behavior without requiring
|
|
@@ -58,7 +65,7 @@ Describe releases by their effect on readers and required actions.
|
|
|
58
65
|
|
|
59
66
|
A known issue states its trigger,
|
|
60
67
|
risk, and verified workaround. A deprecation names support, replacement, and migration. A retirement
|
|
61
|
-
names the unavailable functions. Security disclosures follow the project
|
|
68
|
+
names the unavailable functions. Security disclosures follow the project policy.
|
|
62
69
|
|
|
63
70
|
## Images and video
|
|
64
71
|
|
|
@@ -73,14 +80,14 @@ A video needs captions and a transcript for information absent from the page. Ke
|
|
|
73
80
|
procedure in text. Do not embed trackers or commit video outside the project's asset workflow.
|
|
74
81
|
Follow the accessibility rules for alt text and color.
|
|
75
82
|
|
|
76
|
-
Keep diagrams small and
|
|
77
|
-
|
|
78
|
-
|
|
83
|
+
Keep diagrams small and draw equal concepts
|
|
84
|
+
with the same shape. Prefer editable diagrams and descriptive file names. List keyboard shortcuts and
|
|
85
|
+
per-system steps in a fixed order.
|
|
79
86
|
|
|
80
87
|
## Links
|
|
81
88
|
|
|
82
89
|
Use maintained primary sources for external APIs and relative paths for repository content.
|
|
83
90
|
Link text identifies the destination. A public procedure states any account or permission needed
|
|
84
91
|
to open a required page.
|
|
85
|
-
See [Diátaxis](https://diataxis.fr/), [Google
|
|
92
|
+
See [Diátaxis](https://diataxis.fr/), [Google documentation guidance](https://developers.google.com/style),
|
|
86
93
|
and [W3C image guidance](https://www.w3.org/WAI/tutorials/images/).
|
|
@@ -1,32 +1,30 @@
|
|
|
1
1
|
[configuration]
|
|
2
|
-
title = "Duplication"
|
|
3
2
|
always_selected = true
|
|
4
|
-
description = "
|
|
3
|
+
description = "Reports copied code across every language a configuration claims."
|
|
4
|
+
title = "Duplication"
|
|
5
5
|
|
|
6
6
|
[files]
|
|
7
7
|
languages = true
|
|
8
8
|
|
|
9
9
|
[[tool]]
|
|
10
|
+
mise = "npm:jscpd"
|
|
10
11
|
name = "jscpd"
|
|
11
|
-
version = "5.2.0"
|
|
12
12
|
npm = "jscpd"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
file = ".jscpd.json"
|
|
16
|
-
shared = false
|
|
13
|
+
replace = [".jscpd.json"]
|
|
14
|
+
version = "5.2.0"
|
|
17
15
|
|
|
18
16
|
[[tool_file]]
|
|
19
17
|
target = ".gspot/config/jscpd.json"
|
|
20
18
|
tool = "jscpd"
|
|
21
19
|
|
|
22
20
|
[[check]]
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
example = "Two files with the same long block of code report that block. Move it into one function, and call it from both places."
|
|
22
|
+
files = { languages = true }
|
|
23
|
+
help = "Move the shared block into one function both callers use."
|
|
25
24
|
level = "all"
|
|
26
|
-
|
|
25
|
+
name = "jscpd"
|
|
27
26
|
runs = "scope"
|
|
28
|
-
|
|
27
|
+
stage = "push"
|
|
28
|
+
summary = "Reports every block of code copied between files, naming both places."
|
|
29
29
|
tool = "jscpd"
|
|
30
|
-
|
|
31
|
-
why = "A copied block is fixed in one place and stays broken in the other."
|
|
32
|
-
help = "Move the shared block into one function both callers use, or raise limits.duplication.percent with a reason."
|
|
30
|
+
why = "A fix in one place leaves the copied block broken in the other."
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
allowed_words = ["Bun", "Node", "npm", "pnpm", "mise", "CI", "macOS", "Linux", "Windows", "CSRF", "ASD"]
|
|
2
|
+
|
|
2
3
|
[configuration]
|
|
3
|
-
title = "Engineering guidance"
|
|
4
4
|
always_selected = true
|
|
5
|
-
description = "Rules
|
|
5
|
+
description = "Rules for working and writing code. The `[rules]` setting turns them on or off."
|
|
6
|
+
title = "Engineering guidance"
|
|
6
7
|
|
|
7
8
|
[rules]
|
|
8
9
|
"ACCESSIBILITY.md" = { filenames = ["*.html", "*.tsx", "*.jsx", "*.vue", "*.svelte", "*.astro", "*.swift"] }
|
|
10
|
+
|
|
11
|
+
"HTTP.md" = { dependencies = ["express", "fastify", "hono", "koa", "@nestjs/core", "next", "@sveltejs/kit", "fastapi", "flask", "django", "starlette", "aiohttp", "vapor"] }
|
|
12
|
+
"LOGGING.md" = { dependencies = ["pino", "winston", "bunyan", "structlog", "loguru", "express", "fastify", "hono", "koa", "@nestjs/core", "fastapi", "flask", "django", "vapor"] }
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
# Planning
|
|
2
2
|
|
|
3
|
+
Read this rule before you write a plan.
|
|
4
|
+
|
|
3
5
|
## Complete change content
|
|
4
6
|
|
|
5
7
|
A plan holds the complete content of every change it proposes, so another agent can carry it
|
|
6
8
|
out without inventing anything.
|
|
7
9
|
|
|
8
|
-
- Show the exact diff of
|
|
10
|
+
- Show the exact diff of each code, configuration, documentation, schema, and text change, and
|
|
9
11
|
the full contents of every new file. Do not summarize a change the diff can show.
|
|
10
|
-
- Name every command that creates, moves, renames, regenerates, or deletes a file
|
|
12
|
+
- Name every command that creates, moves, renames, regenerates, or deletes a file. List each
|
|
11
13
|
generated file the change rewrites.
|
|
12
|
-
- For an image or another binary file, give the source
|
|
14
|
+
- For an image or another binary file, give the source and output paths, the operation, and
|
|
13
15
|
the command that reproduces it.
|
|
14
16
|
- Leave no placeholder such as `update accordingly`, `adjust imports`, or `fix any errors`.
|
|
15
17
|
|
|
@@ -31,12 +33,13 @@ Good:
|
|
|
31
33
|
## Order and detail
|
|
32
34
|
|
|
33
35
|
One step holds one change. Order the steps so each one builds on finished work. Change
|
|
34
|
-
a shared interface before its callers
|
|
35
|
-
|
|
36
|
+
a shared interface before its callers. Move a module before the imports that point at it.
|
|
37
|
+
Put generated output after the source that produces it, and cleanup after the last caller.
|
|
36
38
|
|
|
37
39
|
Say why the steps run in that order, and name the constraints and assumptions that affect them.
|
|
38
40
|
Mention an edge case only when it belongs to the requested work.
|
|
39
41
|
|
|
40
42
|
## Verification steps
|
|
41
43
|
|
|
42
|
-
|
|
44
|
+
End the plan with the commands that prove the change works, and what each one prints when it passes. Run
|
|
45
|
+
only the checks that cover the change, as WORKING.md says.
|
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
# Suppressions
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Read this rule before you add a suppression comment or run `gspot ignore`.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
why the rule does not apply here, not the content of the rule.
|
|
7
|
-
- Scope a suppression to the narrowest thing that works: one rule, one line, one symbol. A
|
|
8
|
-
file-wide suppression needs a reason that applies to the whole file.
|
|
9
|
-
- Suppress only when the rule misjudges this line. When the code breaks the rule, fix the code.
|
|
10
|
-
- Delete a suppression with no remaining cause. Never add filler statements to pass a check.
|
|
5
|
+
A suppression turns a lint rule off for one place, and it carries a reason.
|
|
11
6
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
- Write the reason on the same line or directly above, in the form `reason: <sentence>.`. The reason says why the
|
|
8
|
+
lint rule misjudges this place.
|
|
9
|
+
- A reason states a fact that a reader can check in the repository today. Never cite a plan, a table, a
|
|
10
|
+
conversation, or a decision that the repository does not hold.
|
|
11
|
+
- Scope a suppression to the narrowest thing that works: one lint rule, one line, one symbol. A file-wide
|
|
12
|
+
suppression needs a reason that holds for every line.
|
|
13
|
+
- Suppress only when the lint rule misjudges this line. When the code breaks the lint rule, fix it.
|
|
14
|
+
- Never suppress a size or complexity limit, such as `complexity`, `max-lines`, or `max-statements`. Split the code
|
|
15
|
+
by its steps, or ask the user to raise the limit in `gspot.toml`.
|
|
16
|
+
- Do not widen a setting, such as an import boundary or an architecture module, so that a finding passes. Move the
|
|
17
|
+
code instead.
|
|
18
|
+
- Do not select a configuration only to stop a detection notice. Remove the configuration from that scope instead.
|
|
19
|
+
- Delete a suppression when its cause does not apply. Never add filler statements to pass a check.
|
|
15
20
|
|
|
16
|
-
|
|
21
|
+
The forms differ by language. This rule covers each form: the ESLint, SwiftLint, and ShellCheck disable comments, the
|
|
22
|
+
Ruff `noqa`, and the type-checker ignore. gspot rejects Semgrep and Vale directives.
|
|
23
|
+
|
|
24
|
+
To accept a finding without changing the code, ask the user first. Then run `gspot ignore <check>` with a reason.
|
|
25
|
+
Every other rule that mentions `[[ignore]]` follows this one.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Task Runner
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Read this rule when you change `mise` tasks, `package.json` scripts, a `Makefile`, or another task runner.
|
|
4
4
|
|
|
5
5
|
## Task behavior
|
|
6
6
|
|
|
@@ -16,4 +16,8 @@ Rules for `mise` tasks, `package.json` scripts, `Makefile` targets, or the proje
|
|
|
16
16
|
- Name tasks in kebab-case with a colon namespace, such as `check:fix` or `deploy:staging`.
|
|
17
17
|
- Use the runner's declarative commands and dependency ordering. Keep substantial parsing,
|
|
18
18
|
branching, and process control in the code that implements that behavior.
|
|
19
|
-
- Give each task a concise description in the runner's
|
|
19
|
+
- Give each task a concise description in the runner's list.
|
|
20
|
+
- Do not compute an argument by running code inside the task definition, such as a template `exec()` that
|
|
21
|
+
evaluates a source file. Put the value where the tool reads it, or in the task script.
|
|
22
|
+
- Write a command line once. When tasks differ in one part, write a single task that takes that part as an argument.
|
|
23
|
+
- A task script runs commands. It does not import the internals of a workspace package.
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
# Working in a Repository
|
|
2
2
|
|
|
3
|
+
Read this rule before you change anything in the repository.
|
|
4
|
+
|
|
3
5
|
## Running processes
|
|
4
6
|
|
|
5
7
|
Check for a running instance before you start a dev server, a build watcher, an emulator, or a
|
|
6
|
-
database. Look at the port, the process list and the runner's output. Reuse what runs. Start a
|
|
8
|
+
database. Look at the port, the process list, and the runner's output. Reuse what runs. Start a
|
|
7
9
|
second instance only for a test that needs isolation, or when the user asks in this
|
|
8
10
|
conversation. A framework that moves to the next free port hides the duplicate: two servers then
|
|
9
11
|
serve different code. Stop what you started when the task ends.
|
|
@@ -14,61 +16,65 @@ Read the relevant code before touching it. Understand the public interfaces, dat
|
|
|
14
16
|
and how the modules work together. Then think through your approach:
|
|
15
17
|
|
|
16
18
|
- Which change solves the problem correctly with the fewest steps?
|
|
17
|
-
- Which failures can occur? What happens with bad input, missing data, concurrent access, network
|
|
19
|
+
- Which failures can occur? What happens with bad input, missing data, concurrent access, or network errors?
|
|
18
20
|
- Does this change affect other parts of the system? Trace the call chain.
|
|
19
21
|
|
|
20
22
|
When you rename or move a file, update every reference: imports, documentation, configuration, and scripts.
|
|
21
23
|
|
|
22
|
-
Before
|
|
23
|
-
the behavior. When you add a file, tell the user why that
|
|
24
|
+
Before you add a module, folder, or helper, identify the code that implements
|
|
25
|
+
the behavior. When you add a file, tell the user why that code needs it.
|
|
24
26
|
|
|
25
27
|
## Scope discipline
|
|
26
28
|
|
|
27
29
|
- Complete the requested task. Do not expand scope.
|
|
28
|
-
- If you discover something unrelated that needs fixing, mention it to the user.
|
|
30
|
+
- If you discover something unrelated that needs fixing, mention it to the user. Leave it unless the fix takes one small edit in a file you already change.
|
|
29
31
|
- Do not add features, refactor surrounding code, or make unrequested improvements.
|
|
30
32
|
|
|
31
33
|
## Verification and tests
|
|
32
34
|
|
|
33
|
-
A check reports what it finds as a finding, and `gspot explain <check>` describes the check.
|
|
34
|
-
|
|
35
35
|
Do not run verification broader than the change. Run no full test suite, build, scan, or Docker
|
|
36
36
|
check unless the user asks for it or the checks of the repository include it.
|
|
37
37
|
|
|
38
|
-
Write tests when the user asks or a check requires them.
|
|
39
|
-
|
|
38
|
+
Write tests when the user asks or a check requires them. Fix each test that your change
|
|
39
|
+
breaks. Language and framework instructions say how to write a test, not when.
|
|
40
|
+
|
|
41
|
+
## Rules and checks
|
|
42
|
+
|
|
43
|
+
Run `gspot explain <check>` to see what a check looks for and how to fix its findings. When a rule and a check
|
|
44
|
+
conflict, follow the check, and name both to the user.
|
|
40
45
|
|
|
41
46
|
## No defensive logic
|
|
42
47
|
|
|
43
48
|
Do not add guards, fallbacks, retries, defaults, or wrappers for states the public interface rules
|
|
44
|
-
out. Handle known failure modes where
|
|
45
|
-
permissions, and external services. Trust an internal invariant once the public interface establishes it. When an invariant lacks a clear promise, trace the code and
|
|
49
|
+
out. Handle known failure modes where they can occur: user input, network calls, persistence,
|
|
50
|
+
permissions, and external services. Trust an internal invariant once the public interface establishes it. When an invariant lacks a clear promise, trace the code and define the behavior instead of adding speculative protection.
|
|
46
51
|
|
|
47
52
|
## Abstractions
|
|
48
53
|
|
|
49
54
|
<!-- level: all -->
|
|
50
55
|
|
|
51
|
-
Keep one implementation
|
|
52
|
-
when
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
-
|
|
57
|
-
|
|
58
|
-
-
|
|
59
|
-
|
|
60
|
-
-
|
|
61
|
-
|
|
62
|
-
-
|
|
63
|
-
|
|
64
|
-
-
|
|
65
|
-
|
|
56
|
+
Keep one implementation of each concept, and one copy of each table of values, in the module that uses it.
|
|
57
|
+
Extract shared code only when two or more callers need the same behavior now.
|
|
58
|
+
|
|
59
|
+
- Delete a function whose body only calls another or returns a single expression. Call the other function
|
|
60
|
+
directly. Keep a callback that an API needs.
|
|
61
|
+
- Keep a helper with one caller when it names a step and holds real logic. Do not split code into helpers only
|
|
62
|
+
to pass a size or complexity limit. Split it by the steps it performs.
|
|
63
|
+
- An abstraction that gains flags, modes, or caller-specific branches needs a different design. Do not combine
|
|
64
|
+
loosely related behaviors in a function behind a parameter that picks one.
|
|
65
|
+
- A function takes at most four parameters, and no positional boolean. Pass other values as named fields: an
|
|
66
|
+
options object, keyword-only parameters, or argument labels.
|
|
67
|
+
- To remove a wrong abstraction, inline it into each caller, delete the unused branches there, and extract only
|
|
68
|
+
the common behavior that remains.
|
|
69
|
+
- Pass data, not a callback, unless it replaces several flags across real callers.
|
|
70
|
+
- Prefer plain functions, values, and explicit data flow to classes, factories, strategies, and inheritance. Push state
|
|
71
|
+
and I/O outward, and keep the core close to pure.
|
|
66
72
|
|
|
67
73
|
## No backward compatibility
|
|
68
74
|
|
|
69
75
|
<!-- level: all -->
|
|
70
76
|
|
|
71
|
-
Never introduce compatibility layers, wrapper functions, re-exports for renamed symbols, deprecated-but-kept code, or
|
|
77
|
+
Never introduce compatibility layers, wrapper functions, re-exports for renamed symbols, deprecated-but-kept code, or other backward-compatible scaffolding. A published API follows the deprecation policy its project declares instead.
|
|
72
78
|
|
|
73
79
|
When you replace or rename something:
|
|
74
80
|
|
|
@@ -79,5 +85,4 @@ When you replace or rename something:
|
|
|
79
85
|
|
|
80
86
|
<!-- level: all -->
|
|
81
87
|
|
|
82
|
-
Group constants, types, and schemas by the behavior they belong to.
|
|
83
|
-
tree in tests.
|
|
88
|
+
Group constants, types, and schemas by the behavior they belong to.
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
# Accessibility
|
|
2
2
|
|
|
3
|
+
Read this rule when you change a user interface.
|
|
4
|
+
|
|
3
5
|
## Structure
|
|
4
6
|
|
|
5
|
-
- Use semantic elements and roles: headings in order, landmarks, lists
|
|
6
|
-
|
|
7
|
+
- Use semantic elements and roles: headings in order, landmarks, lists, tables for data, and
|
|
8
|
+
standard controls such as `button`, `a`, `input`, and `select` before custom ones.
|
|
7
9
|
- Every page has one `h1` and a document language.
|
|
8
10
|
- Reading order matches visual order.
|
|
9
11
|
|
|
10
12
|
## Names and descriptions
|
|
11
13
|
|
|
12
|
-
- Every interactive control has an accessible name. An icon-only control gets a label attribute
|
|
13
|
-
form field
|
|
14
|
+
- Every interactive control has an accessible name. An icon-only control gets a label attribute. A
|
|
15
|
+
form field shows a visible label. An image gets `alt` that states its purpose, or empty `alt` when
|
|
14
16
|
decorative.
|
|
15
17
|
- Link each error and hint to its field with `aria-describedby` on the web or `accessibilityHint` on iOS.
|
|
16
18
|
Announce an error when it appears.
|
|
@@ -18,10 +20,10 @@
|
|
|
18
20
|
|
|
19
21
|
## Keyboard and focus
|
|
20
22
|
|
|
21
|
-
- Let keyboard users reach
|
|
23
|
+
- Let keyboard users reach every target a pointer can, in a sensible order.
|
|
22
24
|
- Show focus. Do not remove the focus indicator without replacing it.
|
|
23
|
-
- Move focus deliberately: into a dialog
|
|
24
|
-
|
|
25
|
+
- Move focus deliberately: into a dialog on open, back to its trigger on close, to the first error
|
|
26
|
+
after a failed submission, and to new content on route change.
|
|
25
27
|
- No keyboard traps. Escape closes a dialog, menu, or popover and returns focus to its trigger.
|
|
26
28
|
|
|
27
29
|
## Motion, size, and contrast
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Command-Line Programs
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Read this rule when you change a command-line program that the project ships.
|
|
4
4
|
|
|
5
5
|
## Streams and exit status
|
|
6
6
|
|
|
@@ -8,26 +8,29 @@ These rules apply to command-line programs the project ships for people or autom
|
|
|
8
8
|
- Preserve established exit codes. New commands use `0` on success, `1` on failure, and `2`
|
|
9
9
|
on usage error unless their protocol defines other behavior. List each exit code in `--help`.
|
|
10
10
|
- Keep machine-readable `--json` output complete, stable, and free of progress text.
|
|
11
|
-
- Omit color and
|
|
11
|
+
- Omit color and control sequences unless stdout connects to a terminal and `NO_COLOR` has no value.
|
|
12
12
|
|
|
13
13
|
## Interface
|
|
14
14
|
|
|
15
15
|
- `--help` prints usage, every flag with its default, and one example. `--version` prints the
|
|
16
16
|
version and exits.
|
|
17
17
|
- Every value a prompt asks for also has a flag. If the process has no terminal, fail. Name the missing flag.
|
|
18
|
-
- A destructive command
|
|
18
|
+
- A destructive command prompts for confirmation on a terminal and requires `--yes` otherwise.
|
|
19
|
+
- Help and explain text says what the user can do. It shows no regular expression, internal identifier, source path
|
|
20
|
+
of the program, or value that the user cannot change.
|
|
21
|
+
- Every command, flag, and setting that help text names exists. A test checks each name.
|
|
19
22
|
|
|
20
23
|
## Behavior
|
|
21
24
|
|
|
22
25
|
- Validate every argument before doing any work. Fail with an actionable message that names the
|
|
23
26
|
argument.
|
|
24
27
|
- Idempotent where the operation allows it: running twice produces the same state.
|
|
25
|
-
- Long operations report progress on stderr and
|
|
26
|
-
clean up, exit with
|
|
27
|
-
- Resolve a relative path against the
|
|
28
|
-
|
|
29
|
-
- Create temporary files with
|
|
30
|
-
|
|
28
|
+
- Long operations report progress on stderr and handle interruption: catch the termination signal,
|
|
29
|
+
clean up, and exit with its status.
|
|
30
|
+
- Resolve a relative path against the folder the user ran the command in, or an explicit
|
|
31
|
+
argument. Never resolve it against the script's own folder.
|
|
32
|
+
- Create temporary files with a secure call such as `mktemp` or `tempfile.mkstemp`, and delete
|
|
33
|
+
them on exit.
|
|
31
34
|
|
|
32
35
|
## Flag naming
|
|
33
36
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Comments
|
|
2
2
|
|
|
3
|
+
Read this rule when you write or change a comment.
|
|
4
|
+
|
|
3
5
|
## What a comment says
|
|
4
6
|
|
|
5
7
|
<!-- level: all -->
|
|
@@ -15,7 +17,9 @@ A doc comment says what a function does, what its parameters mean, and what it r
|
|
|
15
17
|
|
|
16
18
|
<!-- level: all -->
|
|
17
19
|
|
|
18
|
-
Write the doc comment that the language check
|
|
20
|
+
Write the doc comment that the language check requires. Say what the signature does not. Never write a comment that only repeats a name or a
|
|
21
|
+
type. Name an object parameter for its role, such as `options`, never `root0`. Add other comments only when a
|
|
22
|
+
function:
|
|
19
23
|
|
|
20
24
|
- handles a failure that its public interface does not explain
|
|
21
25
|
- has concurrency, cancellation, or isolation requirements
|
|
@@ -30,6 +34,12 @@ When you change a function, update its doc comment: summary, parameters, return
|
|
|
30
34
|
Rewrite or delete a comment that describes behavior the code lacks, or the reason for a decision
|
|
31
35
|
you undo.
|
|
32
36
|
|
|
37
|
+
- When you move or delete a declaration, do the same to its comment. A doc comment sits directly above its
|
|
38
|
+
declaration, with no blank line between them.
|
|
39
|
+
- Use a file header only when it helps the reader. When present, the header describes the whole file in a single sentence. Update it
|
|
40
|
+
when the file's job changes.
|
|
41
|
+
- Do not write work status in a comment. For example, do not describe a paused job or a temporary choice.
|
|
42
|
+
|
|
33
43
|
## Deferred work
|
|
34
44
|
|
|
35
45
|
<!-- level: all -->
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# Errors
|
|
2
2
|
|
|
3
|
+
Read this rule when you write code that raises, catches, or reports an error.
|
|
4
|
+
|
|
3
5
|
## Error taxonomy
|
|
4
6
|
|
|
5
7
|
- Return a typed result or throw a typed error for an expected operational failure. Invalid input, missing resources, denied permission, and provider timeouts need results the caller can act on.
|
|
6
8
|
- Throw a programmer error for a broken invariant or impossible state. Log its stack and show a generic failure. Never catch it to keep going.
|
|
7
|
-
- A startup failure
|
|
9
|
+
- A startup failure stops the process before it accepts work.
|
|
8
10
|
- On shutdown, set readiness to false, stop accepting work, drain in-flight work for a bounded
|
|
9
11
|
time, close resources, and exit.
|
|
10
12
|
- A fatal runtime error stops new work, reports the failure, and exits. Last-resort handlers never
|
|
@@ -14,7 +16,7 @@
|
|
|
14
16
|
|
|
15
17
|
- Catch the narrowest type. Never a bare catch-all unless the block re-raises or deliberately isolates an operation and records the failure.
|
|
16
18
|
- Keep the try block around the one operation that can fail.
|
|
17
|
-
- Preserve the cause when wrapping: `new Error(message, { cause })`, `raise ... from error`, `Error` conformance with an underlying error.
|
|
19
|
+
- Preserve the cause when wrapping: `new Error(message, { cause })`, `raise ... from error`, or `Error` conformance with an underlying error.
|
|
18
20
|
- Do not swallow failures. Handle, record, or re-raise each caught error.
|
|
19
21
|
- Run required cleanup in `finally` or the language's equivalent.
|
|
20
22
|
|
|
@@ -29,7 +31,7 @@ private data out of every output.
|
|
|
29
31
|
- Internal identifiers such as row IDs, user IDs, or session tokens.
|
|
30
32
|
- Stack traces or file paths.
|
|
31
33
|
- Raw upstream, provider, or database errors.
|
|
32
|
-
- Implementation details such as trigger
|
|
34
|
+
- Implementation details such as trigger and policy names, or internal state like "deleted" flags.
|
|
33
35
|
|
|
34
36
|
**Always:**
|
|
35
37
|
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
# HTTP
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
logging rules.
|
|
3
|
+
Read this rule when you change an HTTP service.
|
|
5
4
|
|
|
6
5
|
## Requests
|
|
7
6
|
|
|
8
7
|
- Validate input once where the request enters the service, with a schema. Handlers read the
|
|
9
8
|
validated value, never the raw request.
|
|
10
|
-
- Reject unsupported content types on endpoints that take a body.
|
|
11
|
-
and keep the proxy
|
|
9
|
+
- Reject unsupported content types on endpoints that take a body. Cap the body size per route,
|
|
10
|
+
and keep the proxy limit equal to the application parser limit.
|
|
12
11
|
- Handlers adapt transport to domain calls. They define no validation policy, database access,
|
|
13
12
|
provider mechanics, caching, or business decision.
|
|
14
13
|
- Middleware validates, authenticates, rate-limits, and attaches context, and makes no feature
|
|
@@ -18,23 +17,23 @@ logging rules.
|
|
|
18
17
|
|
|
19
18
|
- One handler formats error responses. Feature code throws and never builds an HTTP error body.
|
|
20
19
|
- Give clients generic, stable messages. Detail stays in server diagnostics.
|
|
21
|
-
- The service documents one success
|
|
20
|
+
- The service documents one shape for success and one for errors, and keeps both stable.
|
|
22
21
|
- Use precise status codes: 201 for creation, 204 with no body, 4xx for caller errors, and 5xx
|
|
23
22
|
only for failures the caller cannot fix.
|
|
24
|
-
- The endpoint or module maps provider and database shapes
|
|
25
|
-
|
|
23
|
+
- The endpoint or module maps provider and database shapes to responses. Responses name fields
|
|
24
|
+
for the API, not for storage, unless the public interface explicitly exposes the provider format.
|
|
26
25
|
- Escape HTML for its rendering context, and never pre-escape JSON field values.
|
|
27
26
|
|
|
28
27
|
## Sessions and transport
|
|
29
28
|
|
|
30
|
-
- Terminate TLS at the proxy, and trust forwarding headers only from
|
|
29
|
+
- Terminate TLS at the proxy, and trust forwarding headers only from it.
|
|
31
30
|
- When the service issues tokens, a revocation reaches every instance.
|
|
32
31
|
|
|
33
32
|
## Wire names
|
|
34
33
|
|
|
35
34
|
<!-- level: all -->
|
|
36
35
|
|
|
37
|
-
- Keep existing protocol header names
|
|
36
|
+
- Keep existing protocol header names. A new header carries no `X-` prefix, as
|
|
38
37
|
[Request for Comments (RFC) 6648](https://www.rfc-editor.org/rfc/rfc6648) recommends.
|
|
39
38
|
|
|
40
39
|
## Operations
|
|
@@ -43,4 +42,4 @@ logging rules.
|
|
|
43
42
|
- Broad rate limits sit at the edge, application limits in middleware, and route limits beside
|
|
44
43
|
the route.
|
|
45
44
|
- Either the proxy or the application compresses responses, not both. Under heavy traffic, the
|
|
46
|
-
reverse proxy
|
|
45
|
+
reverse proxy does it.
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
# Logging
|
|
2
2
|
|
|
3
|
+
Read this rule when you add or change logging.
|
|
4
|
+
|
|
3
5
|
## One logger
|
|
4
6
|
|
|
5
7
|
<!-- level: all -->
|
|
6
8
|
|
|
7
9
|
- One logging module per process, configured at the entrypoint: level, format, redaction, transports.
|
|
8
|
-
- Feature code
|
|
10
|
+
- Feature code gets a logger from that module. It never instantiates, configures, or adds transports.
|
|
9
11
|
- A service logs to stdout. Configure other transports at the logger.
|
|
10
12
|
|
|
11
13
|
## Levels
|
|
@@ -24,10 +26,10 @@
|
|
|
24
26
|
- Write a stable, human-readable message string that describes the event. Values go in structured fields, never interpolated into the message.
|
|
25
27
|
- Preserve declared event names and field keys. Before you rename one, tell the user because
|
|
26
28
|
dashboards and alerts may read it.
|
|
27
|
-
- Include the request trace when
|
|
28
|
-
- Use stable names for request
|
|
29
|
-
- Put an error object in the field the logger serializes errors from, so
|
|
30
|
-
- Summarize: counts, IDs, statuses, provider names, durations. No large, deeply nested, or expensive-to-compute fields.
|
|
29
|
+
- Include the request trace when one exists.
|
|
30
|
+
- Use stable names for request, correlation, provider request, operation, resource, and safe user IDs. Propagate them to provider calls when supported.
|
|
31
|
+
- Put an error object in the field the logger serializes errors from, so it keeps the stack and cause.
|
|
32
|
+
- Summarize: counts, IDs, statuses, provider names, and durations. No large, deeply nested, or expensive-to-compute fields.
|
|
31
33
|
- Do not compute expensive log arguments when the logger disables the level.
|
|
32
34
|
|
|
33
35
|
### Field naming
|
|
@@ -38,9 +40,8 @@ Use `lower_snake_case` for new event names and field keys unless an existing log
|
|
|
38
40
|
|
|
39
41
|
## Sensitive values
|
|
40
42
|
|
|
41
|
-
Follow the secrets rules
|
|
42
|
-
|
|
43
|
-
- Personal data, raw user content, full request or response bodies, provider payloads, database rows.
|
|
43
|
+
Follow the secrets rules. Never log secrets, personal data, raw user content, full request or response bodies,
|
|
44
|
+
provider payloads, or database rows.
|
|
44
45
|
|
|
45
46
|
Redaction lives in the logging module. When a new sensitive key can reach logs, update the redaction list; do not filter at one call site.
|
|
46
47
|
|
|
@@ -49,7 +50,7 @@ Redaction lives in the logging module. When a new sensitive key can reach logs,
|
|
|
49
50
|
logger.info({ headers: req.headers }, 'Incoming request');
|
|
50
51
|
|
|
51
52
|
// Good.
|
|
52
|
-
logger.info({ path: req.path, method: req.method, requestId }, 'Incoming request');
|
|
53
|
+
logger.info({ path: req.path, method: req.method, request_id: requestId }, 'Incoming request');
|
|
53
54
|
```
|
|
54
55
|
|
|
55
56
|
A logging test asserts the fields and redaction, not that the logger ran.
|