@radicaltools/cli 0.2.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.
Files changed (57) hide show
  1. package/README.md +353 -33
  2. package/dist/hub-catalogue/concern/concern-api-collections.radical +1136 -0
  3. package/dist/hub-catalogue/concern/concern-api-errors.radical +1180 -0
  4. package/dist/hub-catalogue/concern/concern-api-evolution.radical +1174 -0
  5. package/dist/hub-catalogue/concern/concern-api-idempotency.radical +1218 -0
  6. package/dist/hub-catalogue/concern/concern-api-resource-design.radical +1102 -0
  7. package/dist/hub-catalogue/concern/concern-api-style-guide.radical +1210 -0
  8. package/dist/hub-catalogue/concern/concern-architecture-style.radical +1268 -0
  9. package/dist/hub-catalogue/concern/concern-audit-trail.radical +1096 -0
  10. package/dist/hub-catalogue/concern/concern-authentication.radical +895 -0
  11. package/dist/hub-catalogue/concern/concern-authorization.radical +1686 -0
  12. package/dist/hub-catalogue/concern/concern-availability.radical +1028 -0
  13. package/dist/hub-catalogue/concern/concern-backend-stack.radical +1037 -0
  14. package/dist/hub-catalogue/concern/concern-backup-recovery.radical +1560 -0
  15. package/dist/hub-catalogue/concern/concern-caching.radical +1294 -0
  16. package/dist/hub-catalogue/concern/concern-capacity.radical +915 -0
  17. package/dist/hub-catalogue/concern/concern-code-documentation.radical +1397 -0
  18. package/dist/hub-catalogue/concern/concern-code-quality-gate.radical +1409 -0
  19. package/dist/hub-catalogue/concern/concern-code-review-branching.radical +1416 -0
  20. package/dist/hub-catalogue/concern/concern-code-style.radical +1058 -0
  21. package/dist/hub-catalogue/concern/concern-communication-style.radical +1508 -0
  22. package/dist/hub-catalogue/concern/concern-data-classification.radical +970 -0
  23. package/dist/hub-catalogue/concern/concern-data-consistency.radical +1112 -0
  24. package/dist/hub-catalogue/concern/concern-data-store.radical +1282 -0
  25. package/dist/hub-catalogue/concern/concern-decomposition.radical +1318 -0
  26. package/dist/hub-catalogue/concern/concern-definition-of-done.radical +1214 -0
  27. package/dist/hub-catalogue/concern/concern-delivery-metrics.radical +966 -0
  28. package/dist/hub-catalogue/concern/concern-dependency-hygiene.radical +1345 -0
  29. package/dist/hub-catalogue/concern/concern-deployment.radical +1203 -0
  30. package/dist/hub-catalogue/concern/concern-encryption.radical +1318 -0
  31. package/dist/hub-catalogue/concern/concern-error-handling-logging.radical +1197 -0
  32. package/dist/hub-catalogue/concern/concern-eu-dora.radical +1321 -0
  33. package/dist/hub-catalogue/concern/concern-frontend-stack.radical +1647 -0
  34. package/dist/hub-catalogue/concern/concern-incident-management.radical +1204 -0
  35. package/dist/hub-catalogue/concern/concern-infrastructure.radical +2183 -0
  36. package/dist/hub-catalogue/concern/concern-integration-resilience.radical +1116 -0
  37. package/dist/hub-catalogue/concern/concern-messaging.radical +973 -0
  38. package/dist/hub-catalogue/concern/concern-module-boundaries.radical +867 -0
  39. package/dist/hub-catalogue/concern/concern-observability.radical +997 -0
  40. package/dist/hub-catalogue/concern/concern-operational-readiness.radical +1249 -0
  41. package/dist/hub-catalogue/concern/concern-personal-data.radical +1949 -0
  42. package/dist/hub-catalogue/concern/concern-quality-priorities.radical +1091 -0
  43. package/dist/hub-catalogue/concern/concern-rate-limiting.radical +1445 -0
  44. package/dist/hub-catalogue/concern/concern-release-versioning.radical +1358 -0
  45. package/dist/hub-catalogue/concern/concern-retention.radical +1399 -0
  46. package/dist/hub-catalogue/concern/concern-secrets.radical +1284 -0
  47. package/dist/hub-catalogue/concern/concern-secure-coding.radical +1379 -0
  48. package/dist/hub-catalogue/concern/concern-secure-development.radical +1245 -0
  49. package/dist/hub-catalogue/concern/concern-security-detection.radical +1153 -0
  50. package/dist/hub-catalogue/concern/concern-supply-chain.radical +1386 -0
  51. package/dist/hub-catalogue/concern/concern-technical-debt.radical +1450 -0
  52. package/dist/hub-catalogue/concern/concern-technology-lifecycle.radical +1145 -0
  53. package/dist/hub-catalogue/concern/concern-tenant-isolation.radical +1440 -0
  54. package/dist/hub-catalogue/concern/concern-test-strategy.radical +1212 -0
  55. package/dist/hub-catalogue/concern/concern-threat-modelling.radical +1143 -0
  56. package/dist/index.js +12712 -7144
  57. package/package.json +5 -3
@@ -0,0 +1,1409 @@
1
+ {
2
+ "hub": {
3
+ "id": "concern-code-quality-gate",
4
+ "category": "concern",
5
+ "name": "Code quality gate",
6
+ "description": "What a change must pass before it is merged, beyond the tests: which static analysis is enforced, how strict the types are, whether size and complexity are limited, how new findings are treated against the old ones, and what happens to duplicated code.",
7
+ "tags": [
8
+ "maintainability",
9
+ "static analysis",
10
+ "linting",
11
+ "quality gate",
12
+ "complexity",
13
+ "technical debt",
14
+ "type safety"
15
+ ],
16
+ "requiredMetamodel": "c4-ddd-governance-builtin",
17
+ "concern": {
18
+ "id": "code-quality-gate",
19
+ "trigger": "LIST NODES WHERE (type = \"container\" OR type = \"webapp\") AND external != true",
20
+ "why": "code lives in these elements, so what a change must pass before it is merged, beyond the tests, has to be decided; one decision usually covers a whole repository and is bound to every element built from it.",
21
+ "group": "sdlc"
22
+ },
23
+ "sources": [
24
+ {
25
+ "title": "SonarSource: Clean as You Code",
26
+ "url": "https://docs.sonarsource.com/sonarqube-server/latest/core-concepts/clean-as-you-code/introduction/"
27
+ },
28
+ {
29
+ "title": "Google Engineering Practices: The Code Reviewer's Guide",
30
+ "url": "https://google.github.io/eng-practices/review/reviewer/"
31
+ },
32
+ {
33
+ "title": "Google Engineering Practices: Small CLs",
34
+ "url": "https://google.github.io/eng-practices/review/developer/small-cls.html"
35
+ },
36
+ {
37
+ "title": "Martin Fowler: Continuous Integration",
38
+ "url": "https://martinfowler.com/articles/continuousIntegration.html"
39
+ },
40
+ {
41
+ "title": "Watson, McCabe: Structured Testing, NIST Special Publication 500-235 (cyclomatic complexity)",
42
+ "url": "https://www.mccabe.com/pdf/mccabe-nist235r.pdf"
43
+ },
44
+ {
45
+ "title": "ISO/IEC 25010, Maintainability: modularity, analysability, modifiability",
46
+ "url": "https://iso25000.com/index.php/en/iso-25000-standards/iso-25010"
47
+ },
48
+ {
49
+ "title": "ESLint: Configuration Files (flat config)",
50
+ "url": "https://eslint.org/docs/latest/use/configure/configuration-files"
51
+ },
52
+ {
53
+ "title": "Ruff: An extremely fast Python linter and code formatter",
54
+ "url": "https://docs.astral.sh/ruff/"
55
+ },
56
+ {
57
+ "title": "Forsgren, Humble, Kim: Accelerate",
58
+ "url": "https://itrevolution.com/product/accelerate/"
59
+ },
60
+ {
61
+ "title": "jscpd: copy/paste detector",
62
+ "url": "https://github.com/kucherenko/jscpd"
63
+ }
64
+ ],
65
+ "templateParams": [
66
+ {
67
+ "key": "STATIC",
68
+ "title": "Static analysis",
69
+ "label": "Which static analysis is enforced before a merge?",
70
+ "hint": "This decides who finds the obvious mistakes: a linter in the build, a platform with a gate on new code, or nobody but the reviewer. It also decides what the rest of the gate can hang on: with only a formatter there are no findings to treat.",
71
+ "defaultValue": "linter",
72
+ "options": [
73
+ {
74
+ "value": "linter",
75
+ "label": "a linter and a formatter in CI",
76
+ "description": "A linter (ESLint or Biome, ruff, golangci-lint, detekt) with a recommended rule set and a formatter (Prettier or Biome, ruff format or Black, gofmt) run on every pull request and fail it on an error; the same versions run locally on commit. Pick it as the default for any codebase with more than one contributor."
77
+ },
78
+ {
79
+ "value": "sonar",
80
+ "label": "a code-analysis platform with a gate on new code",
81
+ "description": "SonarQube or SonarCloud analyses every pull request and its quality gate (\"Clean as You Code\") fails the build when new code brings a bug, a vulnerability, a security hotspot left unreviewed or a maintainability rating below A; the linter and formatter still run locally and in CI for fast feedback. Pick it when several teams or many repositories need one standard with a dashboard, or when a regulator or customer asks for evidence."
82
+ },
83
+ {
84
+ "value": "format-only",
85
+ "label": "only a formatter",
86
+ "description": "A formatter is enforced in CI and on commit; no lint rule set and no analysis platform, so the findings question below does not apply (there are none to treat until a linter arrives). Pick it for prototypes, scripts and tools under 5,000 lines with one or two owners, where review covers what a linter would; the decision records when to revisit it."
87
+ }
88
+ ]
89
+ },
90
+ {
91
+ "key": "TYPES",
92
+ "title": "Types",
93
+ "label": "How strict are the types?",
94
+ "hint": "A type checker is the cheapest reviewer there is, but turning it to strict on an old codebase produces thousands of errors at once. Dynamic languages have the same choice with mypy, Sorbet or Psalm.",
95
+ "defaultValue": "strict",
96
+ "options": [
97
+ {
98
+ "value": "strict",
99
+ "label": "strict everywhere",
100
+ "description": "The strictest mode of the checker is on for the whole element: TypeScript strict with noImplicitAny and noUncheckedIndexedAccess, mypy --strict, C# nullable enabled with warnings as errors, Kotlin explicit API. Pick it for a new codebase or one that is already close to it."
101
+ },
102
+ {
103
+ "value": "ratchet",
104
+ "label": "raised file by file with a baseline",
105
+ "description": "Strict mode is on for new files and for a growing list of old ones; files not yet strict are listed in a baseline that may only shrink (typescript-strict-plugin, mypy per-module overrides, a #nullable enable per file). Pick it for an existing codebase where strict everywhere would be a months-long stop."
106
+ },
107
+ {
108
+ "value": "loose",
109
+ "label": "types only at module boundaries",
110
+ "description": "Dynamic typing inside modules, with type annotations required and checked only on the parameters and return values of exported or public functions, by one lint rule that runs even where only a formatter is enforced. Pick it for scripts, notebooks and glue code, or a language without a mature checker."
111
+ }
112
+ ]
113
+ },
114
+ {
115
+ "key": "COMPLEXITY",
116
+ "title": "Complexity",
117
+ "label": "Are size and complexity limited?",
118
+ "hint": "A function with a cyclomatic complexity over 10 needs more than 10 test paths and is where defects cluster; a limit enforced in the build keeps it from being written, a number shown in review only keeps it visible.",
119
+ "defaultValue": "limits",
120
+ "options": [
121
+ {
122
+ "value": "limits",
123
+ "label": "enforced limits",
124
+ "description": "Cyclomatic complexity per function (10 by default), function length (50 lines), file length (400 lines) and nesting (4 levels) fail the check and block the merge; old code over the limit is baselined per the findings rule. Pick it for code that will be maintained for years by people other than its authors."
125
+ },
126
+ {
127
+ "value": "advisory",
128
+ "label": "measured and shown, not blocking",
129
+ "description": "The same measures are computed on every pull request and posted as review annotations on the changed functions, but do not block. Pick it for the first months on a codebase where most functions are already over the limit, with the intent to turn the limits on later."
130
+ },
131
+ {
132
+ "value": "none",
133
+ "label": "no limits",
134
+ "description": "Size and complexity are left to review. Pick it only for small, short-lived code with one owner."
135
+ }
136
+ ]
137
+ },
138
+ {
139
+ "key": "DEBT",
140
+ "title": "Findings",
141
+ "label": "How are new findings treated against the old ones?",
142
+ "hint": "Only when static analysis is a linter or a platform: with only a formatter there are no findings. On an existing codebase the first run of a linter reports thousands of findings; what the gate does with the old ones decides whether the new rules are kept or switched off within a week.",
143
+ "defaultValue": "zero-new",
144
+ "options": [
145
+ {
146
+ "value": "zero-new",
147
+ "label": "no new findings",
148
+ "description": "A change may bring no new finding in the lines it adds or changes; findings in untouched old code are baselined and reported but do not block. Pick it as the default for any codebase with history: the code gets cleaner where it is being changed, which is where it matters."
149
+ },
150
+ {
151
+ "value": "ratchet",
152
+ "label": "a count that may only go down",
153
+ "description": "The total number of findings is kept in a committed baseline; a pull request that raises it fails, and one that lowers it lowers the baseline. Pick it when the tooling cannot tell new lines from old (a custom check, a language without a Sonar or reviewdog integration), or when the team wants the debt visibly shrinking."
154
+ },
155
+ {
156
+ "value": "fix-all",
157
+ "label": "every finding fixed before merge",
158
+ "description": "No baseline: the whole element has zero findings on the main branch, and a change with one cannot merge. Pick it for a new codebase, or after a one-time clean-up; it is the only option that keeps the rule set from drifting into a list of exceptions."
159
+ }
160
+ ]
161
+ },
162
+ {
163
+ "key": "DUPLICATION",
164
+ "title": "Duplication",
165
+ "label": "What happens to duplicated code?",
166
+ "hint": "Copied code is the most common way a fix is applied in one place and missed in the others; the question is whether the gate stops it or only shows it.",
167
+ "defaultValue": "report",
168
+ "options": [
169
+ {
170
+ "value": "block",
171
+ "label": "blocked above a threshold",
172
+ "description": "Duplicated lines in the element above a threshold (3% by default, measured by jscpd over the whole source tree, or by the Sonar condition on new code) fail the pull request. Pick it when the element has a history of copy-paste fixes, or when it holds business rules that must exist once."
173
+ },
174
+ {
175
+ "value": "report",
176
+ "label": "reported in the pull request",
177
+ "description": "Duplication is measured on every pull request and the clones are posted as a comment, and the reviewer decides. Pick it as the default: some duplication is better than a wrong abstraction, and the reviewer can tell the two apart."
178
+ }
179
+ ]
180
+ },
181
+ {
182
+ "key": "LINT_MINUTES",
183
+ "label": "Within how many minutes must the static checks of a pull request finish?",
184
+ "defaultValue": "5",
185
+ "type": "number"
186
+ },
187
+ {
188
+ "key": "MAX_COMPLEXITY",
189
+ "label": "What is the highest cyclomatic complexity allowed per function?",
190
+ "defaultValue": "10",
191
+ "type": "number"
192
+ },
193
+ {
194
+ "key": "MAX_FUNCTION_LINES",
195
+ "label": "How many lines may a function have at most?",
196
+ "defaultValue": "50",
197
+ "type": "number"
198
+ },
199
+ {
200
+ "key": "MAX_FILE_LINES",
201
+ "label": "How many lines may a file have at most?",
202
+ "defaultValue": "400",
203
+ "type": "number"
204
+ },
205
+ {
206
+ "key": "DUPLICATION_PCT",
207
+ "label": "What share of duplicated lines is allowed (%)?",
208
+ "defaultValue": "3",
209
+ "type": "number"
210
+ }
211
+ ]
212
+ },
213
+ "nodes": [
214
+ {
215
+ "id": "need",
216
+ "type": "need",
217
+ "label": "Code stays readable as it changes",
218
+ "x": 0,
219
+ "y": 0,
220
+ "kind": "brief",
221
+ "source": "Hub concern pack: Code quality gate",
222
+ "description": "The element is changed by several people and will be maintained by people who did not write it. Every change must leave the code at least as readable, typed and small as it found it, and the obvious mistakes (an unused variable, a wrong null check, a 300-line function, a copied block) must be found by a machine in minutes, so that review time goes to design and correctness. A rule that is not enforced is not a rule; one that blocks on code nobody is touching gets switched off."
223
+ },
224
+ {
225
+ "id": "req-gate-on-pr",
226
+ "type": "requirement",
227
+ "label": "Static checks on every change",
228
+ "x": 260,
229
+ "y": 0,
230
+ "ears_type": "event-driven",
231
+ "trigger": "a pull request is opened or updated",
232
+ "action": "run the static checks of this decision within {{LINT_MINUTES}} minutes as a required status check, and block the merge on any error",
233
+ "rationale": "A check that runs after the merge, or that people can skip, does not change what is merged; one that takes longer than a few minutes is not waited for (Fowler, Continuous Integration: every commit builds on an integration machine, keep the build fast)."
234
+ },
235
+ {
236
+ "id": "req-formatted",
237
+ "type": "requirement",
238
+ "label": "Code is formatted by the formatter",
239
+ "x": 260,
240
+ "y": 130,
241
+ "ears_type": "ubiquitous",
242
+ "action": "keep every source file exactly as the formatter prints it, with the formatter run on staged files at commit and its check run in CI, so that 0 lines of a pull request differ from the formatter's output",
243
+ "rationale": "Formatting is the cheapest thing to automate and the most expensive thing to argue about in review; a formatter with no options ends the argument (Google, The Code Reviewer's Guide: style guide is the absolute authority, formatting comments are not needed)."
244
+ },
245
+ {
246
+ "id": "req-lint-rules",
247
+ "type": "requirement",
248
+ "label": "Lint rules enforced as errors",
249
+ "x": 260,
250
+ "y": 260,
251
+ "ears_type": "ubiquitous",
252
+ "action": "run the linter with its recommended rule set plus the type-aware rules of the stack, every rule at error severity, with an unused disable comment itself an error and any disable comment allowed only with a description naming the reason",
253
+ "rationale": "A rule at warning severity is noise within a month; a disable comment without a reason is a rule removed in silence (ESLint docs: linter-options.reportUnusedDisableDirectives; ISO 25010 analysability).",
254
+ "hubWhen": {
255
+ "STATIC": [
256
+ "linter"
257
+ ]
258
+ }
259
+ },
260
+ {
261
+ "id": "req-sonar-gate",
262
+ "type": "requirement",
263
+ "label": "Quality gate on new code",
264
+ "x": 260,
265
+ "y": 390,
266
+ "ears_type": "event-driven",
267
+ "trigger": "a pull request is analysed",
268
+ "action": "fail the pipeline unless the quality gate on new code holds: 0 new bugs, 0 new vulnerabilities, 100% of new security hotspots reviewed, maintainability rating A on new code, with new code defined against the main branch",
269
+ "rationale": "A gate on new code is one every pull request can pass, so it stays on; a gate on the whole codebase is failed from day one and ignored (SonarSource, Clean as You Code).",
270
+ "hubWhen": {
271
+ "STATIC": [
272
+ "sonar"
273
+ ]
274
+ }
275
+ },
276
+ {
277
+ "id": "req-format-only-revisit",
278
+ "type": "requirement",
279
+ "label": "Formatter only, until the element grows",
280
+ "x": 260,
281
+ "y": 520,
282
+ "ears_type": "event-driven",
283
+ "trigger": "the element passes 5,000 source lines or gains a third regular contributor",
284
+ "action": "revisit this decision and introduce a linter with a recommended rule set through a new decision within one month",
285
+ "rationale": "The case for no lint rules is a small codebase that review can hold in its head; past that size the obvious mistakes slip through, and the decision says so before it happens (Google, Small CLs; ISO 25010 analysability).",
286
+ "hubWhen": {
287
+ "STATIC": [
288
+ "format-only"
289
+ ]
290
+ }
291
+ },
292
+ {
293
+ "id": "req-strict-types",
294
+ "type": "requirement",
295
+ "label": "Strict types everywhere",
296
+ "x": 260,
297
+ "y": 650,
298
+ "ears_type": "ubiquitous",
299
+ "action": "type-check the whole element in the checker's strict mode (TypeScript strict with noImplicitAny and noUncheckedIndexedAccess, mypy --strict, nullable enabled with warnings as errors) on every pull request, with 0 type errors and 0 suppression comments (@ts-ignore, @ts-expect-error, type: ignore, #pragma warning disable) without an issue id",
300
+ "rationale": "Strict typing moves a class of defects from production to the editor at no runtime cost, and a suppression without a reason is a type error nobody will revisit (ISO 25010 analysability; Accelerate: shift left on quality).",
301
+ "hubWhen": {
302
+ "TYPES": [
303
+ "strict"
304
+ ]
305
+ }
306
+ },
307
+ {
308
+ "id": "req-type-ratchet",
309
+ "type": "requirement",
310
+ "label": "Strictness only goes up",
311
+ "x": 260,
312
+ "y": 780,
313
+ "ears_type": "unwanted-behaviour",
314
+ "unwanted_condition": "a pull request adds a file to the non-strict baseline, or a file in the baseline passes strict checking and is not removed from it",
315
+ "action": "fail the check, and require new files to be strict from their first commit",
316
+ "rationale": "Raising strictness file by file is the only way through an old codebase without stopping delivery, and it works only if the list of exceptions can never grow (Accelerate: work in small batches; SonarSource, Clean as You Code applied to types).",
317
+ "hubWhen": {
318
+ "TYPES": [
319
+ "ratchet"
320
+ ]
321
+ }
322
+ },
323
+ {
324
+ "id": "req-boundary-types",
325
+ "type": "requirement",
326
+ "label": "Types at module boundaries",
327
+ "x": 260,
328
+ "y": 910,
329
+ "ears_type": "ubiquitous",
330
+ "action": "declare the types of the parameters and return values of every exported or public function, check them on every pull request, and leave the rest of the code untyped",
331
+ "rationale": "Types pay most where a caller cannot see the implementation; inside a module the reader has the code (ISO 25010 modularity, analysability).",
332
+ "hubWhen": {
333
+ "TYPES": [
334
+ "loose"
335
+ ]
336
+ }
337
+ },
338
+ {
339
+ "id": "req-complexity-limits",
340
+ "type": "requirement",
341
+ "label": "Size and complexity limited",
342
+ "x": 260,
343
+ "y": 1040,
344
+ "ears_type": "unwanted-behaviour",
345
+ "unwanted_condition": "a changed function has a cyclomatic complexity above {{MAX_COMPLEXITY}} or more than {{MAX_FUNCTION_LINES}} lines, nests deeper than 4 levels, or a changed file has more than {{MAX_FILE_LINES}} lines",
346
+ "action": "report it as an error and block the merge, with functions over the limit before this decision baselined per the findings rule",
347
+ "rationale": "Cyclomatic complexity above 10 means more than 10 independent paths to test and is where defects cluster; function and file length limit what a reader has to hold at once (McCabe, NIST 500-235, the limit of 10; ISO 25010 modularity).",
348
+ "hubWhen": {
349
+ "COMPLEXITY": [
350
+ "limits"
351
+ ]
352
+ }
353
+ },
354
+ {
355
+ "id": "req-complexity-shown",
356
+ "type": "requirement",
357
+ "label": "Complexity shown in review",
358
+ "x": 260,
359
+ "y": 1170,
360
+ "ears_type": "event-driven",
361
+ "trigger": "a pull request is opened or updated",
362
+ "action": "compute cyclomatic complexity and length for every changed function and annotate in the pull request each one above {{MAX_COMPLEXITY}} or {{MAX_FUNCTION_LINES}} lines, without blocking the merge",
363
+ "rationale": "What is shown in review gets discussed; a number nobody sees is a limit nobody keeps (McCabe, NIST 500-235; Google, The Code Reviewer's Guide: complexity).",
364
+ "hubWhen": {
365
+ "COMPLEXITY": [
366
+ "advisory"
367
+ ]
368
+ }
369
+ },
370
+ {
371
+ "id": "req-zero-new",
372
+ "type": "requirement",
373
+ "label": "No new findings in changed lines",
374
+ "x": 260,
375
+ "y": 1300,
376
+ "ears_type": "unwanted-behaviour",
377
+ "unwanted_condition": "a finding of any enabled rule lies on a line the pull request added or changed",
378
+ "action": "fail the check, while findings on untouched lines are reported in the pull request but do not block",
379
+ "rationale": "Fixing the code where it is being changed is where clean-up pays; blocking on old code nobody is touching gets the rules switched off (SonarSource, Clean as You Code: focus on new code).",
380
+ "hubWhen": {
381
+ "DEBT": [
382
+ "zero-new"
383
+ ],
384
+ "STATIC": [
385
+ "linter",
386
+ "sonar"
387
+ ]
388
+ }
389
+ },
390
+ {
391
+ "id": "req-ratchet",
392
+ "type": "requirement",
393
+ "label": "Findings only go down",
394
+ "x": 260,
395
+ "y": 1430,
396
+ "ears_type": "unwanted-behaviour",
397
+ "unwanted_condition": "the number of linter findings after a change is higher than the committed baseline",
398
+ "action": "fail the check; when the number is lower, lower the baseline in the same pull request",
399
+ "rationale": "A count that can only fall makes the debt visible and shrinking, and needs no tool that tells new lines from old (Accelerate: visibility of work; Fowler, Continuous Integration: fix broken builds immediately).",
400
+ "hubWhen": {
401
+ "DEBT": [
402
+ "ratchet"
403
+ ],
404
+ "STATIC": [
405
+ "linter",
406
+ "sonar"
407
+ ]
408
+ }
409
+ },
410
+ {
411
+ "id": "req-fix-all",
412
+ "type": "requirement",
413
+ "label": "Zero findings, no baseline",
414
+ "x": 260,
415
+ "y": 1560,
416
+ "ears_type": "ubiquitous",
417
+ "action": "keep 0 linter findings on the main branch, with no findings baseline file in the repository, and fail any pull request with a finding",
418
+ "rationale": "Zero is the only count that needs no explanation and cannot drift; it is affordable on a new or freshly cleaned codebase and costly afterwards (Fowler, Continuous Integration; Google, Small CLs).",
419
+ "hubWhen": {
420
+ "DEBT": [
421
+ "fix-all"
422
+ ],
423
+ "STATIC": [
424
+ "linter",
425
+ "sonar"
426
+ ]
427
+ }
428
+ },
429
+ {
430
+ "id": "req-duplication",
431
+ "type": "requirement",
432
+ "label": "Duplication blocked",
433
+ "x": 260,
434
+ "y": 1690,
435
+ "ears_type": "unwanted-behaviour",
436
+ "unwanted_condition": "the duplicated lines of the element (blocks of 10 or more lines found twice) exceed {{DUPLICATION_PCT}}% of its source lines after a pull request",
437
+ "action": "fail the check, naming both copies of every clone",
438
+ "rationale": "A fix applied to one copy and missed in the other is the most common way duplicated code fails; the gate names the second copy while it is still cheap to remove (ISO 25010 modifiability; SonarSource, duplicated lines on new code).",
439
+ "hubWhen": {
440
+ "DUPLICATION": [
441
+ "block"
442
+ ]
443
+ }
444
+ },
445
+ {
446
+ "id": "req-duplication-reported",
447
+ "type": "requirement",
448
+ "label": "Duplication reported",
449
+ "x": 260,
450
+ "y": 1820,
451
+ "ears_type": "event-driven",
452
+ "trigger": "a pull request is opened or updated",
453
+ "action": "measure the duplicated lines of the element and post every clone with both locations as a comment on the pull request, without blocking the merge",
454
+ "rationale": "The reviewer can tell a wrong abstraction from a copy-paste fix only when the copies are in front of them; a report nobody sees decides nothing (Google, The Code Reviewer's Guide; ISO 25010 modifiability).",
455
+ "hubWhen": {
456
+ "DUPLICATION": [
457
+ "report"
458
+ ]
459
+ }
460
+ },
461
+ {
462
+ "id": "sc-gate-on-pr",
463
+ "type": "scenario",
464
+ "label": "Finding blocks the merge",
465
+ "x": 520,
466
+ "y": 0,
467
+ "given": "a pull request whose change brings an error in a static check",
468
+ "when": "it is pushed",
469
+ "then": "the check reports the error within {{LINT_MINUTES}} minutes, and the branch rules list the check as required so the pull request cannot be merged"
470
+ },
471
+ {
472
+ "id": "sc-formatted",
473
+ "type": "scenario",
474
+ "label": "Unformatted change refused",
475
+ "x": 520,
476
+ "y": 130,
477
+ "given": "a pull request with a file the formatter would change",
478
+ "when": "the CI check runs",
479
+ "then": "it fails naming the file, and the same file is reformatted by the pre-commit hook on the next commit"
480
+ },
481
+ {
482
+ "id": "sc-lint-rules",
483
+ "type": "scenario",
484
+ "label": "Warnings are errors",
485
+ "x": 520,
486
+ "y": 260,
487
+ "given": "the linter configuration",
488
+ "when": "a rule fires in a changed file, a disable comment covers nothing, and another disable comment has no description",
489
+ "then": "all three fail the check, and no rule is configured at warning severity",
490
+ "hubWhen": {
491
+ "STATIC": [
492
+ "linter"
493
+ ]
494
+ }
495
+ },
496
+ {
497
+ "id": "sc-sonar-gate",
498
+ "type": "scenario",
499
+ "label": "New bug fails the gate",
500
+ "x": 520,
501
+ "y": 390,
502
+ "given": "a pull request adding a function with a bug the analyser detects",
503
+ "when": "the analysis runs",
504
+ "then": "the quality gate fails on new code, the pipeline waits for it and fails, and the merge is blocked",
505
+ "hubWhen": {
506
+ "STATIC": [
507
+ "sonar"
508
+ ]
509
+ }
510
+ },
511
+ {
512
+ "id": "sc-format-only-revisit",
513
+ "type": "scenario",
514
+ "label": "Growth triggers a linter",
515
+ "x": 520,
516
+ "y": 520,
517
+ "given": "an element with only a formatter enforced",
518
+ "when": "a monthly count shows 5,000 source lines or three regular contributors",
519
+ "then": "an issue to introduce a linter is opened with this decision linked, and the monthly job stays red until a new decision supersedes this one",
520
+ "hubWhen": {
521
+ "STATIC": [
522
+ "format-only"
523
+ ]
524
+ }
525
+ },
526
+ {
527
+ "id": "sc-strict-types",
528
+ "type": "scenario",
529
+ "label": "Implicit any refused",
530
+ "x": 520,
531
+ "y": 650,
532
+ "given": "a pull request adding a parameter without a type",
533
+ "when": "the type check runs",
534
+ "then": "it fails with noImplicitAny, and adding @ts-ignore without an issue id fails the suppression check as well",
535
+ "hubWhen": {
536
+ "TYPES": [
537
+ "strict"
538
+ ]
539
+ }
540
+ },
541
+ {
542
+ "id": "sc-type-ratchet",
543
+ "type": "scenario",
544
+ "label": "Baseline cannot grow",
545
+ "x": 520,
546
+ "y": 780,
547
+ "given": "a baseline listing the non-strict files",
548
+ "when": "a pull request marks a new file non-strict, and another makes a listed file pass strict checking",
549
+ "then": "the first fails the check, and the second fails until the file is unmarked and removed from the baseline",
550
+ "hubWhen": {
551
+ "TYPES": [
552
+ "ratchet"
553
+ ]
554
+ }
555
+ },
556
+ {
557
+ "id": "sc-boundary-types",
558
+ "type": "scenario",
559
+ "label": "Untyped export refused",
560
+ "x": 520,
561
+ "y": 910,
562
+ "given": "a pull request exporting a function without parameter types",
563
+ "when": "the check runs",
564
+ "then": "it fails on the export, while an untyped local helper in the same file passes",
565
+ "hubWhen": {
566
+ "TYPES": [
567
+ "loose"
568
+ ]
569
+ }
570
+ },
571
+ {
572
+ "id": "sc-complexity-limits",
573
+ "type": "scenario",
574
+ "label": "Complex function refused",
575
+ "x": 520,
576
+ "y": 1040,
577
+ "given": "a pull request adding a function with cyclomatic complexity {{MAX_COMPLEXITY}} plus 1",
578
+ "when": "the complexity check runs",
579
+ "then": "it fails naming the function and its complexity, and the merge is blocked",
580
+ "hubWhen": {
581
+ "COMPLEXITY": [
582
+ "limits"
583
+ ]
584
+ }
585
+ },
586
+ {
587
+ "id": "sc-complexity-shown",
588
+ "type": "scenario",
589
+ "label": "Complex function annotated",
590
+ "x": 520,
591
+ "y": 1170,
592
+ "given": "a pull request changing a function with complexity {{MAX_COMPLEXITY}} plus 5",
593
+ "when": "the check runs",
594
+ "then": "the function is annotated with its complexity in the pull request and the check passes",
595
+ "hubWhen": {
596
+ "COMPLEXITY": [
597
+ "advisory"
598
+ ]
599
+ }
600
+ },
601
+ {
602
+ "id": "sc-zero-new",
603
+ "type": "scenario",
604
+ "label": "Old finding does not block",
605
+ "x": 520,
606
+ "y": 1300,
607
+ "given": "a file with an old finding and a pull request that changes another line of it cleanly",
608
+ "when": "the check runs",
609
+ "then": "it passes and the old finding is shown; a second pull request adding a finding on a changed line fails",
610
+ "hubWhen": {
611
+ "DEBT": [
612
+ "zero-new"
613
+ ],
614
+ "STATIC": [
615
+ "linter",
616
+ "sonar"
617
+ ]
618
+ }
619
+ },
620
+ {
621
+ "id": "sc-ratchet",
622
+ "type": "scenario",
623
+ "label": "Count above baseline refused",
624
+ "x": 520,
625
+ "y": 1430,
626
+ "given": "a committed baseline of 120 findings",
627
+ "when": "a pull request leaves 121, and another leaves 110 without touching the baseline",
628
+ "then": "the first fails on the count, the second fails until the baseline is set to 110",
629
+ "hubWhen": {
630
+ "DEBT": [
631
+ "ratchet"
632
+ ],
633
+ "STATIC": [
634
+ "linter",
635
+ "sonar"
636
+ ]
637
+ }
638
+ },
639
+ {
640
+ "id": "sc-fix-all",
641
+ "type": "scenario",
642
+ "label": "Any finding refused",
643
+ "x": 520,
644
+ "y": 1560,
645
+ "given": "the main branch with 0 findings",
646
+ "when": "a pull request adds one finding anywhere",
647
+ "then": "the check fails and the repository holds no findings baseline file",
648
+ "hubWhen": {
649
+ "DEBT": [
650
+ "fix-all"
651
+ ],
652
+ "STATIC": [
653
+ "linter",
654
+ "sonar"
655
+ ]
656
+ }
657
+ },
658
+ {
659
+ "id": "sc-duplication",
660
+ "type": "scenario",
661
+ "label": "Copied block refused",
662
+ "x": 520,
663
+ "y": 1690,
664
+ "given": "an element at the threshold and a pull request that pastes a 12-line block already present in another file",
665
+ "when": "the check runs",
666
+ "then": "it fails naming both locations, and the merge is blocked",
667
+ "hubWhen": {
668
+ "DUPLICATION": [
669
+ "block"
670
+ ]
671
+ }
672
+ },
673
+ {
674
+ "id": "sc-duplication-reported",
675
+ "type": "scenario",
676
+ "label": "Clones posted on the pull request",
677
+ "x": 520,
678
+ "y": 1820,
679
+ "given": "a pull request that pastes a 12-line block already present in another file",
680
+ "when": "the duplication step runs",
681
+ "then": "a comment on the pull request lists the clone with both locations, and the check passes",
682
+ "hubWhen": {
683
+ "DUPLICATION": [
684
+ "report"
685
+ ]
686
+ }
687
+ },
688
+ {
689
+ "id": "adr-linter",
690
+ "type": "adr",
691
+ "label": "A linter and a formatter gate every change",
692
+ "x": 780,
693
+ "y": 0,
694
+ "concern": "code-quality-gate",
695
+ "status": "accepted",
696
+ "date": "",
697
+ "context": "Code lives in this element and is changed by several people, soon by people who did not write it; what a change must pass before it is merged, beyond its tests, decides whether the code stays readable or decays one pull request at a time. The forces: review time is the scarcest resource and arguing about formatting and obvious mistakes wastes it, while a machine finds those in seconds; a rule that is not enforced is a wish, and a rule that blocks on old code nobody is touching teaches people to switch it off; strict types and complexity limits catch defects early but cost effort on code that was written without them; a baseline that is never lowered becomes permanent; and every check added to the pull request makes the feedback slower, so the whole gate has to finish in minutes. Tests, coverage and mutation score are decided by the Test strategy concern, not here. The snippets assume one repository layout: source in src/, tests in test/, the workflow files under .github/workflows/, and GitHub as the platform (on GitLab the same jobs run in a required pipeline with allow_failure false and the merge-request setting \"pipelines must succeed\").",
698
+ "decision": "Every pull request runs the stack's linter, and the format check of the formatter the Code style and conventions pack decides, as required checks within {{LINT_MINUTES}} minutes: ESLint (flat config, eslint:recommended plus typescript-eslint recommended-type-checked) or Biome's linter on TypeScript, ruff check on Python, golangci-lint on Go, detekt on Kotlin. Every rule is an error; unused disable comments are errors; a disable comment needs a description naming the reason. The same versions run on staged files at commit through husky and lint-staged (or pre-commit on Python). Types: {{TYPES}}. Size and complexity: {{COMPLEXITY}}. New findings: {{DEBT}}. Duplicated code: {{DUPLICATION}}. Tests and coverage follow the Test strategy decision.",
699
+ "consequences": "• Obvious mistakes and formatting never reach review; reviewers read for design and correctness.\n• Feedback in seconds locally and in minutes in CI, with no service to run.\n• Rule sets drift unless someone owns them; the recommended set is upgraded with the tool, and each upgrade is a pull request of its own.\n• No history or dashboard across repositories; a team that wants one needs the platform variant.\n• Type-aware ESLint rules need the TypeScript program and are the slowest part; keeping under {{LINT_MINUTES}} minutes needs a cache (eslint --cache) on a large element.",
700
+ "alternatives": "1. A code-analysis platform (SonarQube) with a gate on new code: cross-repository view and evidence, but a service to run or pay for and a slower loop.\n2. Only a formatter: nothing to maintain, but every mistake a linter finds is left to the reviewer.\n3. Lint rules at warning severity: easier to adopt, but warnings are ignored within a month and the rule set becomes noise.",
701
+ "hubWhen": {
702
+ "STATIC": [
703
+ "linter"
704
+ ]
705
+ }
706
+ },
707
+ {
708
+ "id": "adr-sonar",
709
+ "type": "adr",
710
+ "label": "A code-analysis platform gates new code",
711
+ "x": 780,
712
+ "y": 130,
713
+ "concern": "code-quality-gate",
714
+ "status": "accepted",
715
+ "date": "",
716
+ "context": "Code lives in this element and is changed by several people, soon by people who did not write it; what a change must pass before it is merged, beyond its tests, decides whether the code stays readable or decays one pull request at a time. The forces: review time is the scarcest resource and arguing about formatting and obvious mistakes wastes it, while a machine finds those in seconds; a rule that is not enforced is a wish, and a rule that blocks on old code nobody is touching teaches people to switch it off; strict types and complexity limits catch defects early but cost effort on code that was written without them; a baseline that is never lowered becomes permanent; and every check added to the pull request makes the feedback slower, so the whole gate has to finish in minutes. Tests, coverage and mutation score are decided by the Test strategy concern, not here. The snippets assume one repository layout: source in src/, tests in test/, the workflow files under .github/workflows/, and GitHub as the platform (on GitLab the same jobs run in a required pipeline with allow_failure false and the merge-request setting \"pipelines must succeed\").",
717
+ "decision": "Every pull request is analysed by SonarQube Server (or SonarCloud) and the pipeline waits for its quality gate (sonar.qualitygate.wait=true); the gate holds conditions on new code only, with new code defined against the main branch: 0 new bugs, 0 new vulnerabilities, 100% of new security hotspots reviewed, maintainability rating A, and the duplication condition where duplication is blocked. The stack's linter (ESLint or Biome, ruff check, golangci-lint) and the formatter the Code style and conventions pack decides still run locally on commit and as a first CI step, because the platform's round trip is too slow to be the only feedback; the findings rule below applies to the linter's findings, and the gate on new code carries it for the platform's. The whole check finishes within {{LINT_MINUTES}} minutes. Types: {{TYPES}}. Size and complexity: {{COMPLEXITY}}. New findings: {{DEBT}}. Duplicated code: {{DUPLICATION}}. Tests and coverage follow the Test strategy decision; coverage conditions live in the same gate.",
718
+ "consequences": "• One standard and one dashboard across repositories and teams, with history, and a report to show an auditor or a customer.\n• The gate on new code can be passed by every pull request from the first day, so it stays on.\n• A service to run and upgrade (or a subscription per line of code), and one more thing between a push and a green check.\n• Two rule sets to keep aligned: what Sonar flags and what the local linter flags; a finding seen only in the platform is found late.\n• Developers need the SonarLint plugin connected to the server to see the same rules in the editor.",
719
+ "alternatives": "1. A linter and a formatter in CI only: faster and free, but no cross-repository view and no evidence trail.\n2. GitHub code scanning with CodeQL: strong on security findings, weak on maintainability; a complement, not a replacement.\n3. A gate on the whole codebase instead of new code: it is failed from day one on any existing code and switched off within a week.",
720
+ "hubWhen": {
721
+ "STATIC": [
722
+ "sonar"
723
+ ]
724
+ }
725
+ },
726
+ {
727
+ "id": "adr-format-only",
728
+ "type": "adr",
729
+ "label": "Only a formatter is enforced",
730
+ "x": 780,
731
+ "y": 260,
732
+ "concern": "code-quality-gate",
733
+ "status": "accepted",
734
+ "date": "",
735
+ "context": "Code lives in this element and is changed by several people, soon by people who did not write it; what a change must pass before it is merged, beyond its tests, decides whether the code stays readable or decays one pull request at a time. The forces: review time is the scarcest resource and arguing about formatting and obvious mistakes wastes it, while a machine finds those in seconds; a rule that is not enforced is a wish, and a rule that blocks on old code nobody is touching teaches people to switch it off; strict types and complexity limits catch defects early but cost effort on code that was written without them; a baseline that is never lowered becomes permanent; and every check added to the pull request makes the feedback slower, so the whole gate has to finish in minutes. Tests, coverage and mutation score are decided by the Test strategy concern, not here. The snippets assume one repository layout: source in src/, tests in test/, the workflow files under .github/workflows/, and GitHub as the platform (on GitLab the same jobs run in a required pipeline with allow_failure false and the merge-request setting \"pipelines must succeed\"). Here the element is small enough for review to hold: a prototype, a set of scripts or an internal tool with one or two owners.",
736
+ "decision": "Only the formatter the Code style and conventions pack decides is enforced, run on staged files at commit and checked in CI within {{LINT_MINUTES}} minutes. No lint rule set and no analysis platform; what a linter would find is left to the author and the reviewer, and the only single rules that run are the ones the types and complexity decisions below name. Types: {{TYPES}}. Size and complexity: {{COMPLEXITY}} (without a linter, lizard carries the limits). There are no linter findings to treat, so the findings rule chosen ({{DEBT}}) takes effect when a linter is introduced. Duplicated code: {{DUPLICATION}}. The decision is revisited, and a linter introduced through a new decision, when the element passes 5,000 source lines or gains a third regular contributor; a monthly count checks both. Tests follow the Test strategy decision.",
737
+ "consequences": "• Nothing to configure or maintain beyond the formatter, and a pull request check that takes seconds.\n• Unused variables, unreachable code, wrong equality and the other mistakes a linter finds for free reach review and sometimes production.\n• The element is cheap to start and must be cheap to leave: the revisit trigger is written down so growth does not pass unnoticed.\n• Anything in this decision that depends on a linter (enforced complexity limits, boundary types) is carried by a standalone tool or a single rule instead and costs more to set up than it would with one.",
738
+ "alternatives": "1. A linter and a formatter in CI: an hour to set up with a recommended rule set, and the right choice as soon as a third person contributes.\n2. A code-analysis platform: far more than a prototype needs.\n3. Nothing enforced at all: formatting arguments in review within a week.",
739
+ "hubWhen": {
740
+ "STATIC": [
741
+ "format-only"
742
+ ]
743
+ }
744
+ },
745
+ {
746
+ "id": "ff-gate-job",
747
+ "type": "fitness-fn",
748
+ "label": "Static checks in time, required for merge",
749
+ "x": 1040,
750
+ "y": 0,
751
+ "characteristic": "maintainability",
752
+ "scope": "atomic",
753
+ "cadence": "triggered",
754
+ "trigger": "pull-request",
755
+ "invocation": "automated",
756
+ "description": "The job that runs the formatter check, the linter and the type check has a hard timeout of {{LINT_MINUTES}} minutes, so a slow gate fails instead of being waited for; concurrency cancels the run of a superseded push. A weekly job reads the rules in force on main through the GitHub API and fails when the job is not among the required status checks, so a check switched off in the web UI is noticed within a week.\n\nThreshold: The static-check job finishes within {{LINT_MINUTES}} minutes (its timeout) and \"quality / static\" is a required status check in the branch rules of main\n\nTool: GitHub Actions (timeout-minutes) with the GitHub CLI over the rulesets API\n\n```yaml\n# .github/workflows/quality.yml\nname: quality\non:\n pull_request:\n schedule: [{ cron: '0 6 * * 1' }]\nconcurrency:\n group: quality-${{ github.ref }}\n cancel-in-progress: true\njobs:\n static:\n if: github.event_name == 'pull_request'\n runs-on: ubuntu-latest\n timeout-minutes: {{LINT_MINUTES}}\n steps:\n - uses: actions/checkout@v4.2.2 # pin by commit SHA in your repository\n with: { fetch-depth: 0 } # new-code checks need the base branch\n - uses: actions/setup-node@v4.1.0 # pin by commit SHA in your repository\n with: { node-version-file: .nvmrc, cache: npm }\n - run: npm ci\n - run: npm run format:check # prettier --check .\n - run: npm run lint # eslint . --cache --max-warnings 0 (where a linter is enforced)\n - run: npm run typecheck # tsc --noEmit\n required:\n if: github.event_name == 'schedule'\n runs-on: ubuntu-latest\n env:\n GH_TOKEN: ${{ github.token }}\n steps:\n - run: |\n gh api \"repos/$GITHUB_REPOSITORY/rules/branches/main\" \\\n | jq -e '[.[] | select(.type == \"required_status_checks\") | .parameters.required_status_checks[].context] | index(\"quality / static\")' > /dev/null \\\n || { echo \"::error::quality / static is not a required status check on main\"; exit 1; }\n```"
757
+ },
758
+ {
759
+ "id": "ff-pre-commit",
760
+ "type": "fitness-fn",
761
+ "label": "Formatted on commit",
762
+ "x": 1040,
763
+ "y": 130,
764
+ "characteristic": "maintainability",
765
+ "scope": "atomic",
766
+ "cadence": "triggered",
767
+ "trigger": "pull-request",
768
+ "invocation": "automated",
769
+ "description": "husky installs a pre-commit hook that runs lint-staged, which formats and (where a linter is enforced) lints only the staged files in the versions pinned in package.json; CI runs the same formatter check over the whole tree, so a commit made with --no-verify still fails there. On Python the pre-commit framework with ruff-pre-commit does the same. The file is package.json; .husky/pre-commit holds the one line npx lint-staged.\n\nThreshold: 0 files in a pull request differ from the formatter's output (prettier --check exits 0 in CI); the formatter runs on every staged file at commit\n\nTool: husky with lint-staged; pre-commit with ruff-pre-commit for Python\n\n```json\n{\n \"scripts\": {\n \"prepare\": \"husky\",\n \"format:check\": \"prettier --check .\",\n \"lint\": \"eslint . --cache --max-warnings 0\"\n },\n \"lint-staged\": {\n \"*.{ts,tsx,js,mjs,cjs}\": [\"prettier --write\", \"eslint --cache --fix --max-warnings 0\"],\n \"*.{json,md,yml,yaml,css}\": [\"prettier --write\"]\n }\n}\n```"
770
+ },
771
+ {
772
+ "id": "ff-eslint-config",
773
+ "type": "fitness-fn",
774
+ "label": "Recommended rules, every one an error",
775
+ "x": 1040,
776
+ "y": 260,
777
+ "characteristic": "maintainability",
778
+ "scope": "atomic",
779
+ "cadence": "triggered",
780
+ "trigger": "pull-request",
781
+ "invocation": "automated",
782
+ "description": "The flat config enables the recommended and type-checked rule sets, turns unused disable directives into errors, requires a description on every disable directive (eslint-comments/require-description) and keeps no rule at \"warn\"; CI runs eslint with --max-warnings 0 so a rule accidentally set to warn still fails. On Python the equivalent is ruff with select = [\"E\", \"F\", \"B\", \"UP\", \"C90\"] in pyproject.toml and ruff's PGH004 for a blanket noqa; on Go, golangci-lint with the default linters enabled and nolintlint requiring an explanation.\n\nThreshold: 0 rules at warning severity; an unused disable directive is an error; a disable directive without a description is an error; eslint exits non-zero on any finding\n\nTool: ESLint (flat config) with typescript-eslint and eslint-plugin-eslint-comments; ruff for Python; golangci-lint for Go\n\n```js\n// eslint.config.js\nimport js from '@eslint/js'\nimport comments from '@eslint-community/eslint-plugin-eslint-comments/configs'\nimport tseslint from 'typescript-eslint'\n\nexport default tseslint.config(\n { ignores: ['dist/**', 'coverage/**'] },\n js.configs.recommended,\n ...tseslint.configs.recommendedTypeChecked,\n comments.recommended,\n {\n languageOptions: { parserOptions: { projectService: true, tsconfigRootDir: import.meta.dirname } },\n linterOptions: { reportUnusedDisableDirectives: 'error' },\n rules: {\n '@eslint-community/eslint-comments/require-description': ['error', { ignore: [] }], // every disable names its reason\n '@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': { descriptionFormat: '^: [A-Z]+-\\\\d+ .+$' }, 'ts-expect-error': { descriptionFormat: '^: [A-Z]+-\\\\d+ .+$' } }],\n 'no-warning-comments': 'off',\n },\n },\n)\n```",
783
+ "hubWhen": {
784
+ "STATIC": [
785
+ "linter"
786
+ ]
787
+ }
788
+ },
789
+ {
790
+ "id": "ff-sonar-gate",
791
+ "type": "fitness-fn",
792
+ "label": "Quality gate on new code holds",
793
+ "x": 1040,
794
+ "y": 390,
795
+ "characteristic": "maintainability",
796
+ "scope": "atomic",
797
+ "cadence": "triggered",
798
+ "trigger": "pull-request",
799
+ "invocation": "automated",
800
+ "description": "The scanner runs on every pull request with new code defined against the main branch and waits for the gate; the gate in SonarQube holds conditions on new code only (Reliability rating A, Security rating A, Security hotspots reviewed 100%, Maintainability rating A, and Duplicated lines on new code where duplication is blocked). Where the findings rule is \"no new findings\", this gate is what carries it for the platform's findings. Coverage conditions from the Test strategy decision live in the same gate.\n\nThreshold: 0 new bugs, 0 new vulnerabilities, 100% of new hotspots reviewed, maintainability rating A on new code; the pipeline fails when the gate fails\n\nTool: SonarQube quality gate (sonar-scanner)\n\n```properties\n# sonar-project.properties\nsonar.projectKey=shop-order-api\nsonar.sources=src\nsonar.tests=test\nsonar.newCode.referenceBranch=main\nsonar.pullrequest.key=${env.PR_NUMBER}\nsonar.pullrequest.branch=${env.PR_BRANCH}\nsonar.pullrequest.base=main\n# fail the pipeline when the gate fails (polls up to 5 min)\nsonar.qualitygate.wait=true\nsonar.qualitygate.timeout=300\n# Quality gate \"Clean as You Code\", conditions on new code:\n# Reliability rating worse than A -> failed\n# Security rating worse than A -> failed\n# Security hotspots reviewed < 100% -> failed\n# Maintainability rating worse than A -> failed\n# Duplicated lines (%) on new code > {{DUPLICATION_PCT}} -> failed (when duplication is blocked)\n```",
801
+ "hubWhen": {
802
+ "STATIC": [
803
+ "sonar"
804
+ ]
805
+ }
806
+ },
807
+ {
808
+ "id": "ff-size-watch",
809
+ "type": "fitness-fn",
810
+ "label": "Growth is counted monthly",
811
+ "x": 1040,
812
+ "y": 520,
813
+ "characteristic": "maintainability",
814
+ "scope": "atomic",
815
+ "cadence": "temporal",
816
+ "every": "30d",
817
+ "invocation": "automated",
818
+ "description": "A scheduled job counts source lines with cloc and contributors with 5 or more commits in the last 90 days from git; when either passes the limit it opens an issue to introduce a linter (once, linking this decision) and fails, and keeps failing every month until the decision is superseded, so the schedule stays red for as long as the element has outgrown this decision.\n\nThreshold: Source lines below 5,000 and regular contributors (5 or more commits in 90 days) below 3; the monthly job opens an issue and fails otherwise\n\nTool: GitHub Actions (schedule) with cloc, git shortlog and the GitHub CLI\n\n```bash\n#!/usr/bin/env bash\n# .github/workflows/size-watch.yml runs this on: schedule: - cron: '0 6 1 * *'\nset -euo pipefail\nlines=$(npx cloc src --json | jq '.SUM.code')\npeople=$(git shortlog -sn --since='90 days ago' -- src | awk '$1 >= 5' | wc -l)\necho \"source lines: $lines, regular contributors: $people\"\nif [ \"$lines\" -ge 5000 ] || [ \"$people\" -ge 3 ]; then\n gh issue list --label quality-gate --state open --json number | grep -q number ||\n gh issue create --label quality-gate --title 'Introduce a linter (ADR Only a formatter is enforced)' \\\n --body \"src has $lines lines and $people regular contributors; the decision says revisit now.\"\n exit 1\nfi\n```",
819
+ "hubWhen": {
820
+ "STATIC": [
821
+ "format-only"
822
+ ]
823
+ }
824
+ },
825
+ {
826
+ "id": "ff-strict-types",
827
+ "type": "fitness-fn",
828
+ "label": "Strict type check passes",
829
+ "x": 1040,
830
+ "y": 650,
831
+ "characteristic": "maintainability",
832
+ "scope": "atomic",
833
+ "cadence": "triggered",
834
+ "trigger": "pull-request",
835
+ "invocation": "automated",
836
+ "description": "tsconfig turns on strict and the checks strict leaves out, and the type check runs on every pull request; a grep in the same CI step refuses a suppression comment that does not name an issue (the ban-ts-comment lint rule does the same where a linter is enforced). On Python the equivalent is mypy --strict in pyproject.toml and a grep for \"type: ignore\" without an issue id; on C#, <Nullable>enable</Nullable> with <TreatWarningsAsErrors>true</TreatWarningsAsErrors>.\n\nThreshold: 0 type errors with strict on for the whole element; 0 @ts-ignore or @ts-expect-error comments without an issue id (KEY-123)\n\nTool: TypeScript compiler (tsc --noEmit) with git grep; mypy --strict for Python\n\n```jsonc\n// tsconfig.json\n{\n \"compilerOptions\": {\n \"strict\": true,\n \"noImplicitAny\": true,\n \"noUncheckedIndexedAccess\": true,\n \"noImplicitOverride\": true,\n \"noFallthroughCasesInSwitch\": true,\n \"exactOptionalPropertyTypes\": true,\n \"useUnknownInCatchVariables\": true,\n \"noEmit\": true\n },\n \"include\": [\"src\", \"test\"]\n}\n// CI step:\n// npx tsc --noEmit\n// ! git grep -nE '@ts-(ignore|expect-error)' -- src | grep -vE '@ts-(ignore|expect-error): [A-Z]+-[0-9]+ ' # a suppression names its issue\n// pyproject.toml equivalent: [tool.mypy] strict = true; ! git grep -nE 'type: ignore' -- src | grep -vE '# [A-Z]+-[0-9]+'\n```",
837
+ "hubWhen": {
838
+ "TYPES": [
839
+ "strict"
840
+ ]
841
+ }
842
+ },
843
+ {
844
+ "id": "ff-type-ratchet",
845
+ "type": "fitness-fn",
846
+ "label": "Non-strict files only decrease",
847
+ "x": 1040,
848
+ "y": 780,
849
+ "characteristic": "maintainability",
850
+ "scope": "atomic",
851
+ "cadence": "triggered",
852
+ "trigger": "pull-request",
853
+ "invocation": "automated",
854
+ "description": "typescript-strict-plugin checks every file in strict mode except those with a // @ts-strict-ignore comment at the top; tsc-strict runs in CI. A test compares the marked files with the committed list in strict-baseline.json: a file marked but not listed fails (the baseline cannot grow), a file listed but no longer marked fails until the list is shortened; then it runs tsc --strict over the whole project once and fails on a marked file that produced no error, which can be unmarked. On Python, mypy per-module overrides in pyproject.toml with strict = false for the listed modules play the same role.\n\nThreshold: Every file not marked @ts-strict-ignore passes strict checking (tsc-strict); the set of marked files equals the committed baseline list, so a file added to it fails; a marked file with 0 errors under tsc --strict fails until it is unmarked\n\nTool: typescript-strict-plugin (tsc-strict) with a Vitest test over the baseline\n\n```ts\n// tsconfig.json: \"plugins\": [{ \"name\": \"typescript-strict-plugin\" }] CI: npx tsc-strict\n// test/strict-baseline.test.ts\nimport { execSync } from 'node:child_process'\nimport { expect, it } from 'vitest'\nimport baseline from '../strict-baseline.json' // { \"nonStrictFiles\": [\"src/legacy/orders.ts\", \"src/legacy/pricing.ts\"] }\n\nconst marked = execSync(\"grep -rl '^// *@ts-strict-ignore' src || true\").toString().trim().split('\\n').filter(Boolean).sort()\nconst listed = [...baseline.nonStrictFiles].sort()\n\nit('no file is added to the non-strict baseline', () => {\n expect(marked.filter((f) => !listed.includes(f)), 'marked @ts-strict-ignore but not in strict-baseline.json').toEqual([])\n})\nit('a file that became strict leaves the baseline', () => {\n expect(listed.filter((f) => !marked.includes(f)), 'listed in strict-baseline.json but no longer marked: shorten the list').toEqual([])\n})\nit('a marked file that passes strict is unmarked', () => {\n let out = ''\n try { execSync('npx tsc --noEmit --strict --pretty false', { stdio: 'pipe' }) } catch (e) { out = String((e as { stdout: Buffer }).stdout) }\n const failing = new Set([...out.matchAll(/^([^\\s(]+)\\(\\d+,\\d+\\): error/gm)].map((m) => m[1]))\n expect(marked.filter((f) => !failing.has(f)), 'these files pass strict: remove @ts-strict-ignore and shorten the baseline').toEqual([])\n})\n```",
855
+ "hubWhen": {
856
+ "TYPES": [
857
+ "ratchet"
858
+ ]
859
+ }
860
+ },
861
+ {
862
+ "id": "ff-boundary-types",
863
+ "type": "fitness-fn",
864
+ "label": "Exported functions declare their types",
865
+ "x": 1040,
866
+ "y": 910,
867
+ "characteristic": "maintainability",
868
+ "scope": "atomic",
869
+ "cadence": "triggered",
870
+ "trigger": "pull-request",
871
+ "invocation": "automated",
872
+ "description": "One ESLint rule, explicit-module-boundary-types, runs on src (even where only a formatter is enforced, this one rule is the whole lint run) and fails on an exported function or public method without explicit parameter or return types; code that is not exported is not checked. For Python, ruff's ANN001 and ANN201 with per-file-ignores on private modules do the same.\n\nThreshold: 0 exported functions or public methods without explicit parameter and return types; untyped code inside modules is not reported\n\nTool: typescript-eslint (explicit-module-boundary-types); ruff ANN rules for Python\n\n```js\n// eslint.config.js (the only rule where no linter is enforced; added to the shared config otherwise)\nimport tseslint from 'typescript-eslint'\nexport default tseslint.config({\n files: ['src/**/*.ts'],\n languageOptions: { parserOptions: { projectService: true } },\n rules: { '@typescript-eslint/explicit-module-boundary-types': 'error' },\n})\n// Python, pyproject.toml:\n// [tool.ruff.lint] extend-select = [\"ANN001\", \"ANN201\"] # parameters and return types of public functions\n// [tool.ruff.lint.per-file-ignores] \"src/**/_*.py\" = [\"ANN\"] # private modules stay untyped\n```",
873
+ "hubWhen": {
874
+ "TYPES": [
875
+ "loose"
876
+ ]
877
+ }
878
+ },
879
+ {
880
+ "id": "ff-complexity-rules",
881
+ "type": "fitness-fn",
882
+ "label": "Complexity and length limits enforced",
883
+ "x": 1040,
884
+ "y": 1040,
885
+ "characteristic": "maintainability",
886
+ "scope": "atomic",
887
+ "cadence": "triggered",
888
+ "trigger": "pull-request",
889
+ "invocation": "automated",
890
+ "description": "ESLint's core complexity, max-lines-per-function, max-lines and max-depth rules fail the check on a function or file over the limit; blank lines and comments are not counted. On Python, ruff's C901 (mccabe) with max-complexity and PLR0915 do the same; on Go, gocyclo in golangci-lint; in SonarQube the rules S1541 \"Functions should not be too complex\" (cyclomatic) and \"Files should not have too many lines\" carry the same limits. Where only a formatter is enforced and there is no linter to carry the rules, the language-independent lizard runs in the same CI step instead and exits non-zero on a function over either limit.\n\nThreshold: Cyclomatic complexity per function at most {{MAX_COMPLEXITY}}, functions at most {{MAX_FUNCTION_LINES}} lines, files at most {{MAX_FILE_LINES}} lines, nesting at most 4; each fails the check\n\nTool: ESLint core rules (complexity, max-lines, max-lines-per-function, max-depth); lizard where no linter runs\n\n```js\n// eslint.config.js, added to the shared config\nexport default tseslint.config(\n // ...recommended configs\n {\n rules: {\n 'complexity': ['error', { max: {{MAX_COMPLEXITY}} }],\n 'max-lines-per-function': ['error', { max: {{MAX_FUNCTION_LINES}}, skipBlankLines: true, skipComments: true }],\n 'max-lines': ['error', { max: {{MAX_FILE_LINES}}, skipBlankLines: true, skipComments: true }],\n 'max-depth': ['error', 4],\n 'max-params': ['error', 5],\n },\n },\n { files: ['**/*.test.ts'], rules: { 'max-lines-per-function': 'off' } }, // describe blocks are long by nature\n)\n// ruff: [tool.ruff.lint.mccabe] max-complexity = {{MAX_COMPLEXITY}}\n// no linter: pipx run lizard src --CCN {{MAX_COMPLEXITY}} --length {{MAX_FUNCTION_LINES}} --warnings_only\n```",
891
+ "hubWhen": {
892
+ "COMPLEXITY": [
893
+ "limits"
894
+ ]
895
+ }
896
+ },
897
+ {
898
+ "id": "ff-complexity-advisory",
899
+ "type": "fitness-fn",
900
+ "label": "Complexity annotated, not blocking",
901
+ "x": 1040,
902
+ "y": 1170,
903
+ "characteristic": "maintainability",
904
+ "scope": "atomic",
905
+ "cadence": "triggered",
906
+ "trigger": "pull-request",
907
+ "invocation": "automated",
908
+ "description": "lizard measures every function in src and prints a warning line per function over the limits; reviewdog reads those lines with an errorformat, keeps the ones on lines the pull request added or changed, posts them as review comments and exits 0 (fail-level none), so the numbers are in front of the reviewer without blocking. Where a linter is enforced, the same step can read ESLint's complexity rules set to warn through -f=sarif instead; lizard works for every language without one.\n\nThreshold: Every changed function over {{MAX_COMPLEXITY}} complexity or {{MAX_FUNCTION_LINES}} lines gets a review annotation on the pull request; the step exits 0\n\nTool: lizard with reviewdog (github-pr-review, fail-level none)\n\n```yaml\n# step in .github/workflows/quality.yml (pull_request, after checkout with fetch-depth: 0)\n- uses: actions/setup-python@v5.3.0 # pin by commit SHA in your repository\n with: { python-version: '3.12' }\n- uses: reviewdog/action-setup@v1.3.0 # pin by commit SHA in your repository\n- name: complexity shown in review\n env:\n REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n run: |\n pipx run lizard src --CCN {{MAX_COMPLEXITY}} --length {{MAX_FUNCTION_LINES}} --warnings_only > lizard.txt || true\n reviewdog -efm='%f:%l: warning: %m' -name=lizard -reporter=github-pr-review -filter-mode=added -fail-level=none < lizard.txt\n```",
909
+ "hubWhen": {
910
+ "COMPLEXITY": [
911
+ "advisory"
912
+ ]
913
+ }
914
+ },
915
+ {
916
+ "id": "ff-new-findings",
917
+ "type": "fitness-fn",
918
+ "label": "No findings on changed lines",
919
+ "x": 1040,
920
+ "y": 1300,
921
+ "characteristic": "maintainability",
922
+ "scope": "atomic",
923
+ "cadence": "triggered",
924
+ "trigger": "pull-request",
925
+ "invocation": "automated",
926
+ "description": "reviewdog takes the linter's SARIF output, keeps only the findings that fall on lines the pull request added (filter-mode added), posts them as review comments and fails the job on any; findings elsewhere in a changed file are shown with filter-mode diff_context in a second non-blocking step. With the platform variant the Sonar gate on new code carries this rule, so this check is not imported there.\n\nThreshold: 0 linter findings on lines added or changed by the pull request; findings on other lines are reported, not blocking\n\nTool: reviewdog with ESLint's SARIF formatter; ruff --output-format sarif for Python\n\n```yaml\n# step in .github/workflows/quality.yml\n- uses: reviewdog/action-setup@v1.3.0 # pin by commit SHA in your repository\n- name: new findings block\n env:\n REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n run: |\n npx eslint . --format=@microsoft/eslint-formatter-sarif --output-file eslint.sarif || true\n reviewdog -f=sarif -name=eslint -reporter=github-pr-review \\\n -filter-mode=added -fail-level=any < eslint.sarif\n- name: old findings shown\n env:\n REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n run: reviewdog -f=sarif -name=eslint-context -reporter=github-pr-check -filter-mode=diff_context -fail-level=none < eslint.sarif\n```",
927
+ "hubWhen": {
928
+ "DEBT": [
929
+ "zero-new"
930
+ ],
931
+ "STATIC": [
932
+ "linter"
933
+ ]
934
+ }
935
+ },
936
+ {
937
+ "id": "ff-ratchet",
938
+ "type": "fitness-fn",
939
+ "label": "Findings count only goes down",
940
+ "x": 1040,
941
+ "y": 1430,
942
+ "characteristic": "maintainability",
943
+ "scope": "atomic",
944
+ "cadence": "triggered",
945
+ "trigger": "pull-request",
946
+ "invocation": "automated",
947
+ "description": "A test runs the linter in JSON mode, counts the findings, and compares the count with lint-baseline.json: more fails with the difference, fewer fails with the instruction to lower the baseline, so the file in git always shows the current debt and its history shows the trend. The baseline may only be edited in the same pull request that lowers the count. On Python the same test reads ruff check --output-format json.\n\nThreshold: The number of linter findings is at most the committed baseline; a lower number fails until the baseline is lowered to it\n\nTool: Vitest (a test over lint-baseline.json) with eslint --format json; ruff --output-format json for Python\n\n```ts\n// test/lint-baseline.test.ts\nimport { execSync } from 'node:child_process'\nimport { expect, it } from 'vitest'\nimport baseline from '../lint-baseline.json' // { \"findings\": 120 }\n\nit('the number of lint findings only goes down', () => {\n const out = execSync('npx eslint . --format json || true', { maxBuffer: 64 * 1024 * 1024 }).toString() // eslint exits 1 on findings; its JSON is complete\n const count = (JSON.parse(out) as Array<{ messages: unknown[] }>).reduce((n, f) => n + f.messages.length, 0)\n if (count > baseline.findings) throw new Error(`${count - baseline.findings} new findings over the baseline of ${baseline.findings}`)\n expect(count, `findings fell to ${count}: set lint-baseline.json to it`).toBe(baseline.findings)\n})\n```",
948
+ "hubWhen": {
949
+ "DEBT": [
950
+ "ratchet"
951
+ ],
952
+ "STATIC": [
953
+ "linter",
954
+ "sonar"
955
+ ]
956
+ }
957
+ },
958
+ {
959
+ "id": "ff-fix-all",
960
+ "type": "fitness-fn",
961
+ "label": "Zero findings, no baseline file",
962
+ "x": 1040,
963
+ "y": 1560,
964
+ "characteristic": "maintainability",
965
+ "scope": "atomic",
966
+ "cadence": "triggered",
967
+ "trigger": "pull-request",
968
+ "invocation": "automated",
969
+ "description": "The CI step runs the linter with --max-warnings 0 (ruff check with no per-file-ignores), and a test asserts that no findings baseline file exists, so a baseline cannot be introduced without superseding the decision. The types decision keeps its own baseline (strict-baseline.json) where strictness is ratcheted; that file is not a findings baseline and is not listed here.\n\nThreshold: 0 linter findings on the main branch and in every pull request; no findings baseline file (lint-baseline.json, .eslint-baseline.json) in the repository\n\nTool: Vitest with the linter's --max-warnings 0; ruff for Python\n\n```ts\n// test/no-baseline.test.ts\nimport { existsSync } from 'node:fs'\nimport { execSync } from 'node:child_process'\nimport { expect, it } from 'vitest'\n\nconst BASELINES = ['lint-baseline.json', '.eslint-baseline.json', '.sonar-false-positives.json'] // findings baselines only; the types decision owns strict-baseline.json\n\nit('every finding is fixed, none is baselined', () => {\n expect(BASELINES.filter((f) => existsSync(f)), 'ADR fix-all: supersede it before adding a baseline').toEqual([])\n expect(() => execSync('npx eslint . --max-warnings 0', { stdio: 'pipe' })).not.toThrow()\n})\n```",
970
+ "hubWhen": {
971
+ "DEBT": [
972
+ "fix-all"
973
+ ],
974
+ "STATIC": [
975
+ "linter",
976
+ "sonar"
977
+ ]
978
+ }
979
+ },
980
+ {
981
+ "id": "ff-duplication",
982
+ "type": "fitness-fn",
983
+ "label": "Duplication under the threshold",
984
+ "x": 1040,
985
+ "y": 1690,
986
+ "characteristic": "maintainability",
987
+ "scope": "atomic",
988
+ "cadence": "triggered",
989
+ "trigger": "pull-request",
990
+ "invocation": "automated",
991
+ "description": "jscpd runs over the source tree in CI with a minimum block of 10 lines and the threshold, exits 1 above it and prints both locations of every clone; the number is the whole tree's, so the threshold is set at the level found when this decision is adopted and lowered as clones are removed. With the platform variant the condition \"Duplicated lines on new code\" in the Sonar gate measures only the pull request's new lines instead. The HTML report is kept as a build artifact for the reviewer. The file is .jscpd.json; CI runs npx jscpd src, which exits 1 when duplication is above the threshold.\n\nThreshold: Duplicated lines at most {{DUPLICATION_PCT}}% of the source tree jscpd scans, blocks of 10 or more lines; the check fails above it and names both copies\n\nTool: jscpd; the Sonar duplication condition on new code with the platform\n\n```json\n{\n \"threshold\": {{DUPLICATION_PCT}},\n \"minLines\": 10,\n \"minTokens\": 70,\n \"mode\": \"mild\",\n \"format\": [\"typescript\", \"javascript\", \"tsx\", \"python\", \"go\", \"kotlin\", \"csharp\"],\n \"ignore\": [\"**/node_modules/**\", \"**/dist/**\", \"**/*.test.ts\", \"**/*.spec.ts\"],\n \"reporters\": [\"console\", \"html\"],\n \"output\": \"reports/jscpd\"\n}\n```",
992
+ "hubWhen": {
993
+ "DUPLICATION": [
994
+ "block"
995
+ ]
996
+ }
997
+ },
998
+ {
999
+ "id": "ff-duplication-report",
1000
+ "type": "fitness-fn",
1001
+ "label": "Clones posted on the pull request",
1002
+ "x": 1040,
1003
+ "y": 1820,
1004
+ "characteristic": "maintainability",
1005
+ "scope": "atomic",
1006
+ "cadence": "triggered",
1007
+ "trigger": "pull-request",
1008
+ "invocation": "automated",
1009
+ "description": "jscpd runs over the source tree with the markdown reporter and no threshold, so it exits 0; the step posts the report file as a comment on the pull request (replacing its previous comment) when it lists any clone, and the reviewer decides. With the platform variant the pull request's duplication is also on the Sonar summary.\n\nThreshold: Every pull request gets a comment with jscpd's clone list (both locations per clone) when clones exist; the step exits 0\n\nTool: jscpd (markdown reporter) with the GitHub CLI\n\n```bash\n#!/usr/bin/env bash\n# pull-request step: duplication reported, never blocking\nset -euo pipefail\nnpx jscpd src --min-lines 10 --reporters markdown,console --output reports/jscpd || true # no threshold: exit 0\nreport=reports/jscpd/jscpd-report.md\nif grep -q '|' \"$report\"; then\n pr=$(jq -r .pull_request.number \"$GITHUB_EVENT_PATH\")\n gh pr comment \"$pr\" --edit-last --body-file \"$report\" 2>/dev/null || gh pr comment \"$pr\" --body-file \"$report\"\nfi\n```",
1010
+ "hubWhen": {
1011
+ "DUPLICATION": [
1012
+ "report"
1013
+ ]
1014
+ }
1015
+ }
1016
+ ],
1017
+ "relations": [
1018
+ {
1019
+ "id": "req-gate-on-pr--derives--need",
1020
+ "sourceId": "req-gate-on-pr",
1021
+ "targetId": "need",
1022
+ "relationType": "derives"
1023
+ },
1024
+ {
1025
+ "id": "req-formatted--derives--need",
1026
+ "sourceId": "req-formatted",
1027
+ "targetId": "need",
1028
+ "relationType": "derives"
1029
+ },
1030
+ {
1031
+ "id": "req-lint-rules--derives--need",
1032
+ "sourceId": "req-lint-rules",
1033
+ "targetId": "need",
1034
+ "relationType": "derives"
1035
+ },
1036
+ {
1037
+ "id": "req-sonar-gate--derives--need",
1038
+ "sourceId": "req-sonar-gate",
1039
+ "targetId": "need",
1040
+ "relationType": "derives"
1041
+ },
1042
+ {
1043
+ "id": "req-format-only-revisit--derives--need",
1044
+ "sourceId": "req-format-only-revisit",
1045
+ "targetId": "need",
1046
+ "relationType": "derives"
1047
+ },
1048
+ {
1049
+ "id": "req-strict-types--derives--need",
1050
+ "sourceId": "req-strict-types",
1051
+ "targetId": "need",
1052
+ "relationType": "derives"
1053
+ },
1054
+ {
1055
+ "id": "req-type-ratchet--derives--need",
1056
+ "sourceId": "req-type-ratchet",
1057
+ "targetId": "need",
1058
+ "relationType": "derives"
1059
+ },
1060
+ {
1061
+ "id": "req-boundary-types--derives--need",
1062
+ "sourceId": "req-boundary-types",
1063
+ "targetId": "need",
1064
+ "relationType": "derives"
1065
+ },
1066
+ {
1067
+ "id": "req-complexity-limits--derives--need",
1068
+ "sourceId": "req-complexity-limits",
1069
+ "targetId": "need",
1070
+ "relationType": "derives"
1071
+ },
1072
+ {
1073
+ "id": "req-complexity-shown--derives--need",
1074
+ "sourceId": "req-complexity-shown",
1075
+ "targetId": "need",
1076
+ "relationType": "derives"
1077
+ },
1078
+ {
1079
+ "id": "req-zero-new--derives--need",
1080
+ "sourceId": "req-zero-new",
1081
+ "targetId": "need",
1082
+ "relationType": "derives"
1083
+ },
1084
+ {
1085
+ "id": "req-ratchet--derives--need",
1086
+ "sourceId": "req-ratchet",
1087
+ "targetId": "need",
1088
+ "relationType": "derives"
1089
+ },
1090
+ {
1091
+ "id": "req-fix-all--derives--need",
1092
+ "sourceId": "req-fix-all",
1093
+ "targetId": "need",
1094
+ "relationType": "derives"
1095
+ },
1096
+ {
1097
+ "id": "req-duplication--derives--need",
1098
+ "sourceId": "req-duplication",
1099
+ "targetId": "need",
1100
+ "relationType": "derives"
1101
+ },
1102
+ {
1103
+ "id": "req-duplication-reported--derives--need",
1104
+ "sourceId": "req-duplication-reported",
1105
+ "targetId": "need",
1106
+ "relationType": "derives"
1107
+ },
1108
+ {
1109
+ "id": "sc-gate-on-pr--verifies--req-gate-on-pr",
1110
+ "sourceId": "sc-gate-on-pr",
1111
+ "targetId": "req-gate-on-pr",
1112
+ "relationType": "verifies"
1113
+ },
1114
+ {
1115
+ "id": "sc-formatted--verifies--req-formatted",
1116
+ "sourceId": "sc-formatted",
1117
+ "targetId": "req-formatted",
1118
+ "relationType": "verifies"
1119
+ },
1120
+ {
1121
+ "id": "sc-lint-rules--verifies--req-lint-rules",
1122
+ "sourceId": "sc-lint-rules",
1123
+ "targetId": "req-lint-rules",
1124
+ "relationType": "verifies"
1125
+ },
1126
+ {
1127
+ "id": "sc-sonar-gate--verifies--req-sonar-gate",
1128
+ "sourceId": "sc-sonar-gate",
1129
+ "targetId": "req-sonar-gate",
1130
+ "relationType": "verifies"
1131
+ },
1132
+ {
1133
+ "id": "sc-format-only-revisit--verifies--req-format-only-revisit",
1134
+ "sourceId": "sc-format-only-revisit",
1135
+ "targetId": "req-format-only-revisit",
1136
+ "relationType": "verifies"
1137
+ },
1138
+ {
1139
+ "id": "sc-strict-types--verifies--req-strict-types",
1140
+ "sourceId": "sc-strict-types",
1141
+ "targetId": "req-strict-types",
1142
+ "relationType": "verifies"
1143
+ },
1144
+ {
1145
+ "id": "sc-type-ratchet--verifies--req-type-ratchet",
1146
+ "sourceId": "sc-type-ratchet",
1147
+ "targetId": "req-type-ratchet",
1148
+ "relationType": "verifies"
1149
+ },
1150
+ {
1151
+ "id": "sc-boundary-types--verifies--req-boundary-types",
1152
+ "sourceId": "sc-boundary-types",
1153
+ "targetId": "req-boundary-types",
1154
+ "relationType": "verifies"
1155
+ },
1156
+ {
1157
+ "id": "sc-complexity-limits--verifies--req-complexity-limits",
1158
+ "sourceId": "sc-complexity-limits",
1159
+ "targetId": "req-complexity-limits",
1160
+ "relationType": "verifies"
1161
+ },
1162
+ {
1163
+ "id": "sc-complexity-shown--verifies--req-complexity-shown",
1164
+ "sourceId": "sc-complexity-shown",
1165
+ "targetId": "req-complexity-shown",
1166
+ "relationType": "verifies"
1167
+ },
1168
+ {
1169
+ "id": "sc-zero-new--verifies--req-zero-new",
1170
+ "sourceId": "sc-zero-new",
1171
+ "targetId": "req-zero-new",
1172
+ "relationType": "verifies"
1173
+ },
1174
+ {
1175
+ "id": "sc-ratchet--verifies--req-ratchet",
1176
+ "sourceId": "sc-ratchet",
1177
+ "targetId": "req-ratchet",
1178
+ "relationType": "verifies"
1179
+ },
1180
+ {
1181
+ "id": "sc-fix-all--verifies--req-fix-all",
1182
+ "sourceId": "sc-fix-all",
1183
+ "targetId": "req-fix-all",
1184
+ "relationType": "verifies"
1185
+ },
1186
+ {
1187
+ "id": "sc-duplication--verifies--req-duplication",
1188
+ "sourceId": "sc-duplication",
1189
+ "targetId": "req-duplication",
1190
+ "relationType": "verifies"
1191
+ },
1192
+ {
1193
+ "id": "sc-duplication-reported--verifies--req-duplication-reported",
1194
+ "sourceId": "sc-duplication-reported",
1195
+ "targetId": "req-duplication-reported",
1196
+ "relationType": "verifies"
1197
+ },
1198
+ {
1199
+ "id": "ff-gate-job--implements--adr-linter",
1200
+ "sourceId": "ff-gate-job",
1201
+ "targetId": "adr-linter",
1202
+ "relationType": "implements"
1203
+ },
1204
+ {
1205
+ "id": "ff-gate-job--implements--adr-sonar",
1206
+ "sourceId": "ff-gate-job",
1207
+ "targetId": "adr-sonar",
1208
+ "relationType": "implements"
1209
+ },
1210
+ {
1211
+ "id": "ff-gate-job--implements--adr-format-only",
1212
+ "sourceId": "ff-gate-job",
1213
+ "targetId": "adr-format-only",
1214
+ "relationType": "implements"
1215
+ },
1216
+ {
1217
+ "id": "ff-pre-commit--implements--adr-linter",
1218
+ "sourceId": "ff-pre-commit",
1219
+ "targetId": "adr-linter",
1220
+ "relationType": "implements"
1221
+ },
1222
+ {
1223
+ "id": "ff-pre-commit--implements--adr-sonar",
1224
+ "sourceId": "ff-pre-commit",
1225
+ "targetId": "adr-sonar",
1226
+ "relationType": "implements"
1227
+ },
1228
+ {
1229
+ "id": "ff-pre-commit--implements--adr-format-only",
1230
+ "sourceId": "ff-pre-commit",
1231
+ "targetId": "adr-format-only",
1232
+ "relationType": "implements"
1233
+ },
1234
+ {
1235
+ "id": "ff-eslint-config--implements--adr-linter",
1236
+ "sourceId": "ff-eslint-config",
1237
+ "targetId": "adr-linter",
1238
+ "relationType": "implements"
1239
+ },
1240
+ {
1241
+ "id": "ff-sonar-gate--implements--adr-sonar",
1242
+ "sourceId": "ff-sonar-gate",
1243
+ "targetId": "adr-sonar",
1244
+ "relationType": "implements"
1245
+ },
1246
+ {
1247
+ "id": "ff-size-watch--implements--adr-format-only",
1248
+ "sourceId": "ff-size-watch",
1249
+ "targetId": "adr-format-only",
1250
+ "relationType": "implements"
1251
+ },
1252
+ {
1253
+ "id": "ff-strict-types--implements--adr-linter",
1254
+ "sourceId": "ff-strict-types",
1255
+ "targetId": "adr-linter",
1256
+ "relationType": "implements"
1257
+ },
1258
+ {
1259
+ "id": "ff-strict-types--implements--adr-sonar",
1260
+ "sourceId": "ff-strict-types",
1261
+ "targetId": "adr-sonar",
1262
+ "relationType": "implements"
1263
+ },
1264
+ {
1265
+ "id": "ff-strict-types--implements--adr-format-only",
1266
+ "sourceId": "ff-strict-types",
1267
+ "targetId": "adr-format-only",
1268
+ "relationType": "implements"
1269
+ },
1270
+ {
1271
+ "id": "ff-type-ratchet--implements--adr-linter",
1272
+ "sourceId": "ff-type-ratchet",
1273
+ "targetId": "adr-linter",
1274
+ "relationType": "implements"
1275
+ },
1276
+ {
1277
+ "id": "ff-type-ratchet--implements--adr-sonar",
1278
+ "sourceId": "ff-type-ratchet",
1279
+ "targetId": "adr-sonar",
1280
+ "relationType": "implements"
1281
+ },
1282
+ {
1283
+ "id": "ff-type-ratchet--implements--adr-format-only",
1284
+ "sourceId": "ff-type-ratchet",
1285
+ "targetId": "adr-format-only",
1286
+ "relationType": "implements"
1287
+ },
1288
+ {
1289
+ "id": "ff-boundary-types--implements--adr-linter",
1290
+ "sourceId": "ff-boundary-types",
1291
+ "targetId": "adr-linter",
1292
+ "relationType": "implements"
1293
+ },
1294
+ {
1295
+ "id": "ff-boundary-types--implements--adr-sonar",
1296
+ "sourceId": "ff-boundary-types",
1297
+ "targetId": "adr-sonar",
1298
+ "relationType": "implements"
1299
+ },
1300
+ {
1301
+ "id": "ff-boundary-types--implements--adr-format-only",
1302
+ "sourceId": "ff-boundary-types",
1303
+ "targetId": "adr-format-only",
1304
+ "relationType": "implements"
1305
+ },
1306
+ {
1307
+ "id": "ff-complexity-rules--implements--adr-linter",
1308
+ "sourceId": "ff-complexity-rules",
1309
+ "targetId": "adr-linter",
1310
+ "relationType": "implements"
1311
+ },
1312
+ {
1313
+ "id": "ff-complexity-rules--implements--adr-sonar",
1314
+ "sourceId": "ff-complexity-rules",
1315
+ "targetId": "adr-sonar",
1316
+ "relationType": "implements"
1317
+ },
1318
+ {
1319
+ "id": "ff-complexity-rules--implements--adr-format-only",
1320
+ "sourceId": "ff-complexity-rules",
1321
+ "targetId": "adr-format-only",
1322
+ "relationType": "implements"
1323
+ },
1324
+ {
1325
+ "id": "ff-complexity-advisory--implements--adr-linter",
1326
+ "sourceId": "ff-complexity-advisory",
1327
+ "targetId": "adr-linter",
1328
+ "relationType": "implements"
1329
+ },
1330
+ {
1331
+ "id": "ff-complexity-advisory--implements--adr-sonar",
1332
+ "sourceId": "ff-complexity-advisory",
1333
+ "targetId": "adr-sonar",
1334
+ "relationType": "implements"
1335
+ },
1336
+ {
1337
+ "id": "ff-complexity-advisory--implements--adr-format-only",
1338
+ "sourceId": "ff-complexity-advisory",
1339
+ "targetId": "adr-format-only",
1340
+ "relationType": "implements"
1341
+ },
1342
+ {
1343
+ "id": "ff-new-findings--implements--adr-linter",
1344
+ "sourceId": "ff-new-findings",
1345
+ "targetId": "adr-linter",
1346
+ "relationType": "implements"
1347
+ },
1348
+ {
1349
+ "id": "ff-ratchet--implements--adr-linter",
1350
+ "sourceId": "ff-ratchet",
1351
+ "targetId": "adr-linter",
1352
+ "relationType": "implements"
1353
+ },
1354
+ {
1355
+ "id": "ff-ratchet--implements--adr-sonar",
1356
+ "sourceId": "ff-ratchet",
1357
+ "targetId": "adr-sonar",
1358
+ "relationType": "implements"
1359
+ },
1360
+ {
1361
+ "id": "ff-fix-all--implements--adr-linter",
1362
+ "sourceId": "ff-fix-all",
1363
+ "targetId": "adr-linter",
1364
+ "relationType": "implements"
1365
+ },
1366
+ {
1367
+ "id": "ff-fix-all--implements--adr-sonar",
1368
+ "sourceId": "ff-fix-all",
1369
+ "targetId": "adr-sonar",
1370
+ "relationType": "implements"
1371
+ },
1372
+ {
1373
+ "id": "ff-duplication--implements--adr-linter",
1374
+ "sourceId": "ff-duplication",
1375
+ "targetId": "adr-linter",
1376
+ "relationType": "implements"
1377
+ },
1378
+ {
1379
+ "id": "ff-duplication--implements--adr-sonar",
1380
+ "sourceId": "ff-duplication",
1381
+ "targetId": "adr-sonar",
1382
+ "relationType": "implements"
1383
+ },
1384
+ {
1385
+ "id": "ff-duplication--implements--adr-format-only",
1386
+ "sourceId": "ff-duplication",
1387
+ "targetId": "adr-format-only",
1388
+ "relationType": "implements"
1389
+ },
1390
+ {
1391
+ "id": "ff-duplication-report--implements--adr-linter",
1392
+ "sourceId": "ff-duplication-report",
1393
+ "targetId": "adr-linter",
1394
+ "relationType": "implements"
1395
+ },
1396
+ {
1397
+ "id": "ff-duplication-report--implements--adr-sonar",
1398
+ "sourceId": "ff-duplication-report",
1399
+ "targetId": "adr-sonar",
1400
+ "relationType": "implements"
1401
+ },
1402
+ {
1403
+ "id": "ff-duplication-report--implements--adr-format-only",
1404
+ "sourceId": "ff-duplication-report",
1405
+ "targetId": "adr-format-only",
1406
+ "relationType": "implements"
1407
+ }
1408
+ ]
1409
+ }