@conformetry/validation 0.0.5 → 0.0.7
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/CHANGELOG.md +20 -0
- package/README.md +51 -40
- package/dist/src/index.d.ts +42 -5
- package/dist/src/index.js +89 -14
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
## 0.0.7 (2026-10-08)
|
|
2
|
+
|
|
3
|
+
### 🧱 Updated Dependencies
|
|
4
|
+
|
|
5
|
+
- Updated conformetry-configuration to 0.0.7
|
|
6
|
+
- Updated conformetry-languages to 0.0.7
|
|
7
|
+
- Updated conformetry-core to 0.0.7
|
|
8
|
+
|
|
9
|
+
## 0.0.6 (2026-10-08)
|
|
10
|
+
|
|
11
|
+
### 🚀 Features
|
|
12
|
+
|
|
13
|
+
- **conformetry,lexico:** ✨ add frontend conformetry templates and infer validation inputs ([#1301](https://github.com/organizzolini/codebase/pull/1301))
|
|
14
|
+
|
|
15
|
+
### 🧱 Updated Dependencies
|
|
16
|
+
|
|
17
|
+
- Updated conformetry-configuration to 0.0.6
|
|
18
|
+
- Updated conformetry-languages to 0.0.6
|
|
19
|
+
- Updated conformetry-core to 0.0.6
|
|
20
|
+
|
|
1
21
|
## 0.0.5 (2026-10-06)
|
|
2
22
|
|
|
3
23
|
### 💅 Refactors
|
package/README.md
CHANGED
|
@@ -103,13 +103,13 @@ Call stacks traced through `packages/ic-suite/conformetry/conformetry-validation
|
|
|
103
103
|
|
|
104
104
|
| Measure | Value |
|
|
105
105
|
| --- | --- |
|
|
106
|
-
| Callables |
|
|
106
|
+
| Callables | 58 |
|
|
107
107
|
| Files | 18 |
|
|
108
|
-
| Calls traced |
|
|
108
|
+
| Calls traced | 61 |
|
|
109
109
|
| Call stacks | 0 |
|
|
110
110
|
| Deepest stack | 0 |
|
|
111
111
|
| Stacks through recursion | 0 |
|
|
112
|
-
| Unfollowable calls |
|
|
112
|
+
| Unfollowable calls | 2 |
|
|
113
113
|
|
|
114
114
|
### Limits
|
|
115
115
|
|
|
@@ -128,32 +128,41 @@ None.
|
|
|
128
128
|
|
|
129
129
|
| Callable | Breadth | Calls directly | Location |
|
|
130
130
|
| --- | --- | --- | --- |
|
|
131
|
-
| `ValidationService.validate` | 10 | `ConfigurationService.matchInstances`, `ValidationService.selectValidators`, `LanguagesService.resolveValidators`, `ValidationService.readTemplateExtensions`, `ValidationService.map(…)`, `ValidationScoringService.scoreInstances`, `ValidationDeduplicationService.deduplicate`, `ValidationFindingsService.buildUnmatchedResults`, `ValidationService.map(…)`, `ValidationService.every(…)` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/validation/validation.service.ts:
|
|
132
|
-
| `ValidationService.
|
|
133
|
-
| `
|
|
131
|
+
| `ValidationService.validate` | 10 | `ConfigurationService.matchInstances`, `ValidationService.selectValidators`, `LanguagesService.resolveValidators`, `ValidationService.readTemplateExtensions`, `ValidationService.map(…)`, `ValidationScoringService.scoreInstances`, `ValidationDeduplicationService.deduplicate`, `ValidationFindingsService.buildUnmatchedResults`, `ValidationService.map(…)`, `ValidationService.every(…)` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/validation/validation.service.ts:194` |
|
|
132
|
+
| `ValidationService.compareInstance` | 6 | `ConfigurationService.prepareDocuments`, `ValidationService.readClaimedExtensions`, `FilesService.checkInstanceFiles`, `ValidationService.map(…)`, `ValidationService.flatMap(…)`, `ValidationService.reduce(…)` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/validation/validation.service.ts:57` |
|
|
133
|
+
| `ValidationScoringService.scoreInstance` | 5 | `ValidationScoringService.reduce(…)`, `ScoringService.calculateScore`, `ValidationScoringService.resolveThreshold`, `ValidationScoringService.resolveInstancePath`, `ValidationScoringService.some(…)` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/validation/validation-scoring.service.ts:74` |
|
|
134
134
|
|
|
135
135
|
<details>
|
|
136
|
-
<summary>
|
|
136
|
+
<summary>26 more callables</summary>
|
|
137
137
|
|
|
138
138
|
| Callable | Breadth | Calls directly | Location |
|
|
139
139
|
| --- | --- | --- | --- |
|
|
140
|
-
| `
|
|
140
|
+
| `ValidationService.inferPlaceholders` | 5 | `ConfigurationService.prepareDocuments`, `ValidationService.readClaimedExtensions`, `RunnerService.captureDocuments`, `ValidationService.flatMap(…)`, `ValidationService.filter(…)` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/validation/validation.service.ts:102` |
|
|
141
|
+
| `RunnerService.runValidator` | 4 | `RunnerService.map(…)`, `RunnerService.filter(…)`, `RunnerService.filter(…)`, `RunnerService.reduce(…)` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/runner/runner.service.ts:108` |
|
|
142
|
+
| `ValidationFindingsService.reportMissingPlaceholders` | 3 | `ValidationFindingsService.filter(…)`, `ValidationFindingsService.map(…)`, `ValidationFindingsService.map(…)` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/validation/validation-findings.service.ts:109` |
|
|
143
|
+
| `ValidationService.map(…)` | 3 | `ValidationService.inferPlaceholders`, `ValidationFindingsService.reportMissingPlaceholders`, `ValidationService.compareInstance` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/validation/validation.service.ts:205` |
|
|
141
144
|
| `ValidationDeduplicationService.deduplicate` | 2 | `ValidationDeduplicationService.selectOwners`, `ValidationDeduplicationService.flatMap(…)` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/validation/validation-deduplication.service.ts:90` |
|
|
142
|
-
| `ValidationFindingsService.buildUnmatchedResults` | 2 | `ValidationFindingsService.resolveTemplatesRootPath`, `ValidationFindingsService.map(…)` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/validation/validation-findings.service.ts:
|
|
143
|
-
| `ValidationScoringService.scoreInstances` | 2 | `ValidationScoringService.scoreInstance`, `ValidationScoringService.resolveScoreKey` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/validation/validation-scoring.service.ts:
|
|
144
|
-
| `RunnerService.
|
|
145
|
-
| `RunnerService.
|
|
145
|
+
| `ValidationFindingsService.buildUnmatchedResults` | 2 | `ValidationFindingsService.resolveTemplatesRootPath`, `ValidationFindingsService.map(…)` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/validation/validation-findings.service.ts:69` |
|
|
146
|
+
| `ValidationScoringService.scoreInstances` | 2 | `ValidationScoringService.scoreInstance`, `ValidationScoringService.resolveScoreKey` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/validation/validation-scoring.service.ts:119` |
|
|
147
|
+
| `RunnerService.captureDocuments` | 1 | `RunnerService.reduce(…)` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/runner/runner.service.ts:75` |
|
|
148
|
+
| `RunnerService.reduce(…)` | 1 | `RunnerService.find(…)` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/runner/runner.service.ts:80` |
|
|
149
|
+
| `RunnerService.find(…)` | 1 | `RunnerService.claimsDocument` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/runner/runner.service.ts:81` |
|
|
150
|
+
| `RunnerService.filter(…)` | 1 | `RunnerService.claimsDocument` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/runner/runner.service.ts:112` |
|
|
151
|
+
| `RunnerService.map(…)` | 1 | `RunnerService.validateDocument` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/runner/runner.service.ts:115` |
|
|
146
152
|
| `ValidationDeduplicationService.selectOwners` | 1 | `ValidationDeduplicationService.compareInstances` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/validation/validation-deduplication.service.ts:57` |
|
|
147
153
|
| `ValidationDeduplicationService.flatMap(…)` | 1 | `ValidationDeduplicationService.filter(…)` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/validation/validation-deduplication.service.ts:94` |
|
|
148
154
|
| `ValidationDeduplicationService.filter(…)` | 1 | `ValidationDeduplicationService.resolveFindingKey` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/validation/validation-deduplication.service.ts:95` |
|
|
149
|
-
| `ValidationFindingsService.resolveTemplatesRootPath` | 1 | `ValidationFindingsService.map(…)` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/validation/validation-findings.service.ts:
|
|
150
|
-
| `ValidationFindingsService.map(…)` | 1 | `ValidationFindingsService.describeReason` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/validation/validation-findings.service.ts:
|
|
155
|
+
| `ValidationFindingsService.resolveTemplatesRootPath` | 1 | `ValidationFindingsService.map(…)` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/validation/validation-findings.service.ts:58` |
|
|
156
|
+
| `ValidationFindingsService.map(…)` | 1 | `ValidationFindingsService.describeReason` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/validation/validation-findings.service.ts:75` |
|
|
157
|
+
| `ValidationFindingsService.map(…)` | 1 | `ValidationFindingsService.filter(…)` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/validation/validation-findings.service.ts:121` |
|
|
158
|
+
| `ValidationFindingsService.filter(…)` | 1 | `ValidationFindingsService.some(…)` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/validation/validation-findings.service.ts:124` |
|
|
151
159
|
| `ValidationScoringService.reduce(…)` | 1 | `ScoringService.sumWeights` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/validation/validation-scoring.service.ts:75` |
|
|
152
|
-
| `
|
|
153
|
-
| `ValidationService.
|
|
154
|
-
| `ValidationService.
|
|
155
|
-
| `ValidationService.
|
|
156
|
-
| `ValidationService.
|
|
160
|
+
| `ValidationScoringService.some(…)` | 1 | `ValidationScoringService.some(…)` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/validation/validation-scoring.service.ts:92` |
|
|
161
|
+
| `ValidationService.map(…)` | 1 | `RunnerService.runValidator` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/validation/validation.service.ts:68` |
|
|
162
|
+
| `ValidationService.readClaimedExtensions` | 1 | `ValidationService.flatMap(…)` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/validation/validation.service.ts:142` |
|
|
163
|
+
| `ValidationService.readTemplateExtensions` | 1 | `ValidationService.flatMap(…)` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/validation/validation.service.ts:151` |
|
|
164
|
+
| `ValidationService.flatMap(…)` | 1 | `ValidationService.map(…)` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/validation/validation.service.ts:154` |
|
|
165
|
+
| `ValidationService.selectValidators` | 1 | `ValidationService.filter(…)` | `packages/ic-suite/conformetry/conformetry-validation/src/modules/validation/validation.service.ts:164` |
|
|
157
166
|
|
|
158
167
|
</details>
|
|
159
168
|
<!-- callidescope:end -->
|
|
@@ -281,6 +290,7 @@ graph LR
|
|
|
281
290
|
file_src_modules_validation_validation_deduplication_service_ts --> file_src_modules_validation_validation_types_ts
|
|
282
291
|
file_src_modules_validation_validation_deduplication_service_unit_test_ts --> file_src_modules_validation_validation_deduplication_service_ts
|
|
283
292
|
file_src_modules_validation_validation_deduplication_service_unit_test_ts --> file_src_modules_validation_validation_types_ts
|
|
293
|
+
file_src_modules_validation_validation_findings_service_ts --> file_src_modules_validation_validation_types_ts
|
|
284
294
|
file_src_modules_validation_validation_findings_service_unit_test_ts --> file_src_modules_validation_validation_findings_service_ts
|
|
285
295
|
file_src_modules_validation_validation_scoring_service_ts --> file_src_modules_validation_validation_constants_ts
|
|
286
296
|
file_src_modules_validation_validation_scoring_service_ts --> file_src_modules_validation_validation_types_ts
|
|
@@ -297,6 +307,7 @@ graph LR
|
|
|
297
307
|
file_src_modules_validation_validation_service_ts --> file_src_modules_validation_validation_types_ts
|
|
298
308
|
file_src_modules_validation_validation_service_unit_test_ts --> file_src_modules_validation_validation_module_ts
|
|
299
309
|
file_src_modules_validation_validation_service_unit_test_ts --> file_src_modules_validation_validation_service_ts
|
|
310
|
+
file_src_modules_validation_validation_service_unit_test_ts --> file_src_modules_validation_validation_types_ts
|
|
300
311
|
```
|
|
301
312
|
<!-- codependix:end name="codependix-file-imports" -->
|
|
302
313
|
|
|
@@ -306,23 +317,23 @@ graph LR
|
|
|
306
317
|
|
|
307
318
|
### Project
|
|
308
319
|
|
|
309
|
-

|
|
321
|
+

|
|
311
322
|

|
|
312
323
|

|
|
313
324
|
|
|
314
325
|
### Measured Targets
|
|
315
326
|
|
|
316
|
-

|
|
317
328
|
|
|
318
329
|
### TypeScript
|
|
319
330
|
|
|
320
331
|

|
|
321
|
-

|
|
322
333
|

|
|
323
334
|

|
|
324
335
|

|
|
325
|
-

|
|
326
337
|

|
|
327
338
|
|
|
328
339
|
### JavaScript
|
|
@@ -331,15 +342,15 @@ graph LR
|
|
|
331
342
|

|
|
332
343
|

|
|
333
344
|

|
|
334
|
-

|
|
346
|
+

|
|
347
|
+

|
|
348
|
+

|
|
349
|
+

|
|
350
|
+

|
|
351
|
+

|
|
352
|
+

|
|
353
|
+

|
|
343
354
|

|
|
344
355
|
|
|
345
356
|
### Python
|
|
@@ -495,20 +506,20 @@ graph LR
|
|
|
495
506
|
### Markdown
|
|
496
507
|
|
|
497
508
|

|
|
498
|
-

|
|
499
510
|

|
|
500
|
-

|
|
512
|
+

|
|
502
513
|

|
|
503
514
|

|
|
504
515
|

|
|
505
|
-

|
|
517
|
+

|
|
518
|
+

|
|
508
519
|

|
|
509
520
|

|
|
510
521
|

|
|
511
|
-

|
|
512
523
|

|
|
513
524
|

|
|
514
525
|

|
package/dist/src/index.d.ts
CHANGED
|
@@ -57,6 +57,18 @@ export declare class RunnerService {
|
|
|
57
57
|
private claimsDocument;
|
|
58
58
|
/** Compares one document and keeps its findings with its requirement size. */
|
|
59
59
|
private validateDocument;
|
|
60
|
+
/**
|
|
61
|
+
* Compares every document with the validator claiming it and collects what
|
|
62
|
+
* the placeholder values captured, keyed by value.
|
|
63
|
+
*
|
|
64
|
+
* Documents are visited in order and the first capture of a value is kept,
|
|
65
|
+
* so the value comes from the first file — and within it the first node —
|
|
66
|
+
* that revealed it.
|
|
67
|
+
*/
|
|
68
|
+
captureDocuments(args: {
|
|
69
|
+
documents: PreparedValidationDocument[];
|
|
70
|
+
validators: ConformetryLanguageValidator[];
|
|
71
|
+
}): Record<string, string>;
|
|
60
72
|
/**
|
|
61
73
|
* Selects the documents a validator claims and returns its aggregated
|
|
62
74
|
* result.
|
|
@@ -193,6 +205,17 @@ export declare class ValidationFindingsService {
|
|
|
193
205
|
templates: TemplateDefinition[];
|
|
194
206
|
unmatched: UnmatchedInstance[];
|
|
195
207
|
}): ValidationFileResult[];
|
|
208
|
+
/**
|
|
209
|
+
* Adds one finding per placeholder nothing in the instance revealed.
|
|
210
|
+
*
|
|
211
|
+
* `missing` maps each such placeholder to the random value it was still
|
|
212
|
+
* rendered with. Differences quoting that value are dropped: they restate
|
|
213
|
+
* the same gap in terms of a value nobody wrote, and the finding names it.
|
|
214
|
+
*/
|
|
215
|
+
reportMissingPlaceholders(args: {
|
|
216
|
+
group: InstanceFileResults;
|
|
217
|
+
missing: Record<string, string>;
|
|
218
|
+
}): InstanceFileResults;
|
|
196
219
|
}
|
|
197
220
|
|
|
198
221
|
/**
|
|
@@ -273,10 +296,6 @@ export declare class ValidationService {
|
|
|
273
296
|
private readonly validationFindingsService;
|
|
274
297
|
private readonly validationScoringService;
|
|
275
298
|
constructor(configurationService: ConfigurationService, filesService: FilesService, languagesService: LanguagesService, runnerService: RunnerService, validationDeduplicationService: ValidationDeduplicationService, validationFindingsService: ValidationFindingsService, validationScoringService: ValidationScoringService);
|
|
276
|
-
/** Every distinct file extension the matched templates declare. */
|
|
277
|
-
private readTemplateExtensions;
|
|
278
|
-
/** Narrows the resolved validators to the names the caller asked for. */
|
|
279
|
-
private selectValidators;
|
|
280
299
|
/**
|
|
281
300
|
* Checks one instance's files exist, then compares the documents whose
|
|
282
301
|
* extensions the selected validators claim.
|
|
@@ -284,7 +303,25 @@ export declare class ValidationService {
|
|
|
284
303
|
* File existence comes first because a missing file cannot be compared, and
|
|
285
304
|
* reporting it once is clearer than every language reporting it in turn.
|
|
286
305
|
*/
|
|
287
|
-
private
|
|
306
|
+
private compareInstance;
|
|
307
|
+
/**
|
|
308
|
+
* Fills in each placeholder nothing supplied from the instance itself.
|
|
309
|
+
*
|
|
310
|
+
* The template was rendered with a random value standing in for each one,
|
|
311
|
+
* and a first comparison captures the text of the instance node aligned with
|
|
312
|
+
* the first template node holding each value. The instance comes back with
|
|
313
|
+
* that text substituted, ready for the ordinary comparison — which is the
|
|
314
|
+
* consistency check, since a later occurrence holding different text is an
|
|
315
|
+
* ordinary difference. `missing` keeps the stand-in of every placeholder
|
|
316
|
+
* nothing revealed. The capture pass runs only when something is unresolved.
|
|
317
|
+
*/
|
|
318
|
+
private inferPlaceholders;
|
|
319
|
+
/** Every extension the selected validators claim. */
|
|
320
|
+
private readClaimedExtensions;
|
|
321
|
+
/** Every distinct file extension the matched templates declare. */
|
|
322
|
+
private readTemplateExtensions;
|
|
323
|
+
/** Narrows the resolved validators to the names the caller asked for. */
|
|
324
|
+
private selectValidators;
|
|
288
325
|
/**
|
|
289
326
|
* Validates every instance and returns the differences found.
|
|
290
327
|
*
|
package/dist/src/index.js
CHANGED
|
@@ -32,6 +32,15 @@ var p = class {
|
|
|
32
32
|
totalWeight: n
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
+
captureDocuments(e) {
|
|
36
|
+
return e.documents.reduce((t, n) => ({
|
|
37
|
+
...e.validators.find((e) => this.claimsDocument({
|
|
38
|
+
document: n,
|
|
39
|
+
validator: e
|
|
40
|
+
}))?.validateDocument(n).captures,
|
|
41
|
+
...t
|
|
42
|
+
}), {});
|
|
43
|
+
}
|
|
35
44
|
runValidator(e) {
|
|
36
45
|
let t = e.documents.filter((t) => this.claimsDocument({
|
|
37
46
|
document: t,
|
|
@@ -126,6 +135,33 @@ var g = class {
|
|
|
126
135
|
};
|
|
127
136
|
});
|
|
128
137
|
}
|
|
138
|
+
reportMissingPlaceholders(e) {
|
|
139
|
+
let t = Object.entries(e.missing);
|
|
140
|
+
if (t.length === 0) return e.group;
|
|
141
|
+
let { instance: r } = e.group.instance, i = e.group.fileResults.map((e) => ({
|
|
142
|
+
...e,
|
|
143
|
+
differences: e.differences.filter((e) => {
|
|
144
|
+
let n = JSON.stringify(e);
|
|
145
|
+
return !t.some(([, e]) => n.includes(e));
|
|
146
|
+
})
|
|
147
|
+
})).filter((e) => e.differences.length > 0);
|
|
148
|
+
return {
|
|
149
|
+
...e.group,
|
|
150
|
+
fileResults: [{
|
|
151
|
+
differences: t.map(([e]) => ({
|
|
152
|
+
differenceType: "placeholder",
|
|
153
|
+
fix: `Supply ${e} in the instance group's substitutions, or restore the template text that uses {{${e}}} in the instance.`,
|
|
154
|
+
message: `Could not infer {{${e}}}: no instance node aligned with the template text that uses it`,
|
|
155
|
+
weight: 1
|
|
156
|
+
})),
|
|
157
|
+
filename: r.nameStem,
|
|
158
|
+
instanceFilePath: n.join(r.path, r.nameStem),
|
|
159
|
+
templateFilePath: e.group.instance.template.directoryPath,
|
|
160
|
+
totalWeight: t.length
|
|
161
|
+
}, ...i],
|
|
162
|
+
totalWeight: e.group.totalWeight + t.length
|
|
163
|
+
};
|
|
164
|
+
}
|
|
129
165
|
};
|
|
130
166
|
g = f([e(), d("design:paramtypes", [])], g);
|
|
131
167
|
//#endregion
|
|
@@ -152,7 +188,7 @@ var _ = class {
|
|
|
152
188
|
return {
|
|
153
189
|
failedWeight: t,
|
|
154
190
|
instancePath: this.resolveInstancePath(e.instance),
|
|
155
|
-
ok: r >= i,
|
|
191
|
+
ok: r >= i && !e.fileResults.some((e) => e.differences.some((e) => e.differenceType === "placeholder")),
|
|
156
192
|
score: r,
|
|
157
193
|
templateName: e.instance.template.name,
|
|
158
194
|
threshold: i,
|
|
@@ -187,16 +223,9 @@ var v = class {
|
|
|
187
223
|
constructor(e, t, n, r, i, a, o) {
|
|
188
224
|
this.configurationService = e, this.filesService = t, this.languagesService = n, this.runnerService = r, this.validationDeduplicationService = i, this.validationFindingsService = a, this.validationScoringService = o;
|
|
189
225
|
}
|
|
190
|
-
|
|
191
|
-
return [...new Set(e.flatMap((e) => e.template.filePaths.map((e) => n.extname(e))))];
|
|
192
|
-
}
|
|
193
|
-
selectValidators(e) {
|
|
194
|
-
let { languageNames: t } = e;
|
|
195
|
-
return t === void 0 || t.length === 0 ? e.validators : e.validators.filter((e) => t.includes(e.descriptor.name));
|
|
196
|
-
}
|
|
197
|
-
validateInstance(e) {
|
|
226
|
+
compareInstance(e) {
|
|
198
227
|
let [t] = this.configurationService.prepareDocuments({
|
|
199
|
-
fileExtensions:
|
|
228
|
+
fileExtensions: this.readClaimedExtensions(e.validators),
|
|
200
229
|
instances: [e.instance]
|
|
201
230
|
}), n = this.filesService.checkInstanceFiles({ instances: [e.instance] }), r = e.validators.map((n) => this.runnerService.runValidator({
|
|
202
231
|
checkedPaths: [e.instance.instance.path],
|
|
@@ -209,6 +238,43 @@ var v = class {
|
|
|
209
238
|
totalWeight: r.reduce((e, t) => e + t.totalWeight, n.totalWeight)
|
|
210
239
|
};
|
|
211
240
|
}
|
|
241
|
+
inferPlaceholders(e) {
|
|
242
|
+
let t = Object.entries(e.instance.placeholderValues ?? {});
|
|
243
|
+
if (t.length === 0) return {
|
|
244
|
+
instance: e.instance,
|
|
245
|
+
missing: {}
|
|
246
|
+
};
|
|
247
|
+
let [n] = this.configurationService.prepareDocuments({
|
|
248
|
+
fileExtensions: this.readClaimedExtensions(e.validators),
|
|
249
|
+
instances: [e.instance]
|
|
250
|
+
}), r = this.runnerService.captureDocuments({
|
|
251
|
+
documents: n?.documents ?? [],
|
|
252
|
+
validators: e.validators
|
|
253
|
+
}), i = Object.fromEntries(t.flatMap(([e, t]) => {
|
|
254
|
+
let n = r[t];
|
|
255
|
+
return n === void 0 ? [] : [[e, n]];
|
|
256
|
+
}));
|
|
257
|
+
return {
|
|
258
|
+
instance: {
|
|
259
|
+
...e.instance,
|
|
260
|
+
substitutions: {
|
|
261
|
+
...e.instance.substitutions,
|
|
262
|
+
...i
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
missing: Object.fromEntries(t.filter(([e]) => !Object.hasOwn(i, e)))
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
readClaimedExtensions(e) {
|
|
269
|
+
return e.flatMap((e) => [...e.descriptor.fileExtensions]);
|
|
270
|
+
}
|
|
271
|
+
readTemplateExtensions(e) {
|
|
272
|
+
return [...new Set(e.flatMap((e) => e.template.filePaths.map((e) => n.extname(e))))];
|
|
273
|
+
}
|
|
274
|
+
selectValidators(e) {
|
|
275
|
+
let { languageNames: t } = e;
|
|
276
|
+
return t === void 0 || t.length === 0 ? e.validators : e.validators.filter((e) => t.includes(e.descriptor.name));
|
|
277
|
+
}
|
|
212
278
|
validate(e) {
|
|
213
279
|
let { matched: t, unmatched: n } = this.configurationService.matchInstances({
|
|
214
280
|
instances: e.instances,
|
|
@@ -216,10 +282,19 @@ var v = class {
|
|
|
216
282
|
}), r = this.selectValidators({
|
|
217
283
|
languageNames: e.languageNames,
|
|
218
284
|
validators: this.languagesService.resolveValidators({ extensions: this.readTemplateExtensions(t) })
|
|
219
|
-
}), i = t.map((e) =>
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
285
|
+
}), i = t.map((e) => {
|
|
286
|
+
let t = this.inferPlaceholders({
|
|
287
|
+
instance: e,
|
|
288
|
+
validators: r
|
|
289
|
+
});
|
|
290
|
+
return this.validationFindingsService.reportMissingPlaceholders({
|
|
291
|
+
group: this.compareInstance({
|
|
292
|
+
instance: t.instance,
|
|
293
|
+
validators: r
|
|
294
|
+
}),
|
|
295
|
+
missing: t.missing
|
|
296
|
+
});
|
|
297
|
+
}), a = this.validationScoringService.scoreInstances({
|
|
223
298
|
groups: i,
|
|
224
299
|
runThreshold: e.threshold
|
|
225
300
|
}), o = [...this.validationDeduplicationService.deduplicate(i), ...this.validationFindingsService.buildUnmatchedResults({
|
package/package.json
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
"url": "https://github.com/organizzolini/codebase/issues"
|
|
5
5
|
},
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@conformetry/configuration": "0.0.
|
|
8
|
-
"@conformetry/core": "0.0.
|
|
9
|
-
"@conformetry/languages": "0.0.
|
|
7
|
+
"@conformetry/configuration": "0.0.7",
|
|
8
|
+
"@conformetry/core": "0.0.7",
|
|
9
|
+
"@conformetry/languages": "0.0.7",
|
|
10
10
|
"@nestjs/common": "^11.1.21 || ^12.0.1",
|
|
11
11
|
"reflect-metadata": "^0.2.2"
|
|
12
12
|
},
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"strict": true
|
|
61
61
|
},
|
|
62
62
|
"types": "./dist/src/index.d.ts",
|
|
63
|
-
"version": "0.0.
|
|
63
|
+
"version": "0.0.7"
|
|
64
64
|
}
|