@fyuld/pano 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/assessments/classes/index.d.ts +15 -0
- package/dist/src/assessments/classes/index.d.ts.map +1 -0
- package/dist/src/assessments/classes/index.js +112 -0
- package/dist/src/assessments/classes/index.js.map +1 -0
- package/dist/src/assessments/index-files/index.d.ts +13 -0
- package/dist/src/assessments/index-files/index.d.ts.map +1 -0
- package/dist/src/assessments/index-files/index.js +91 -0
- package/dist/src/assessments/index-files/index.js.map +1 -0
- package/dist/src/assessments/throws/index.d.ts +16 -0
- package/dist/src/assessments/throws/index.d.ts.map +1 -0
- package/dist/src/assessments/throws/index.js +110 -0
- package/dist/src/assessments/throws/index.js.map +1 -0
- package/dist/src/assessments/types/index.d.ts +14 -0
- package/dist/src/assessments/types/index.d.ts.map +1 -0
- package/dist/src/assessments/types/index.js +96 -0
- package/dist/src/assessments/types/index.js.map +1 -0
- package/dist/src/fitness-tests/barrel-purity/index.d.ts +11 -0
- package/dist/src/fitness-tests/barrel-purity/index.d.ts.map +1 -0
- package/dist/src/fitness-tests/barrel-purity/index.js +84 -0
- package/dist/src/fitness-tests/barrel-purity/index.js.map +1 -0
- package/dist/src/fitness-tests/datamodel-encapsulation/index.d.ts +10 -0
- package/dist/src/fitness-tests/datamodel-encapsulation/index.d.ts.map +1 -0
- package/dist/src/fitness-tests/datamodel-encapsulation/index.js +99 -0
- package/dist/src/fitness-tests/datamodel-encapsulation/index.js.map +1 -0
- package/dist/src/fitness-tests/error-factories/index.d.ts +17 -0
- package/dist/src/fitness-tests/error-factories/index.d.ts.map +1 -0
- package/dist/src/fitness-tests/error-factories/index.js +97 -0
- package/dist/src/fitness-tests/error-factories/index.js.map +1 -0
- package/dist/src/fitness-tests/unhelpful-errors/index.d.ts +11 -0
- package/dist/src/fitness-tests/unhelpful-errors/index.d.ts.map +1 -0
- package/dist/src/fitness-tests/unhelpful-errors/index.js +87 -0
- package/dist/src/fitness-tests/unhelpful-errors/index.js.map +1 -0
- package/dist/src/format.d.ts +3 -0
- package/dist/src/format.d.ts.map +1 -0
- package/dist/src/format.js +11 -0
- package/dist/src/format.js.map +1 -0
- package/dist/src/fpou-cli.d.ts +3 -0
- package/dist/src/fpou-cli.d.ts.map +1 -0
- package/dist/src/fpou-cli.js +235 -0
- package/dist/src/fpou-cli.js.map +1 -0
- package/dist/src/languages/gherkin/index.d.ts +2 -0
- package/dist/src/languages/gherkin/index.d.ts.map +1 -0
- package/dist/src/languages/gherkin/index.js +18 -0
- package/dist/src/languages/gherkin/index.js.map +1 -0
- package/dist/src/languages/gherkin/parser.d.ts +3 -0
- package/dist/src/languages/gherkin/parser.d.ts.map +1 -0
- package/dist/src/languages/gherkin/parser.js +11 -0
- package/dist/src/languages/gherkin/parser.js.map +1 -0
- package/dist/src/languages/typescript/comment-classification.d.ts +9 -0
- package/dist/src/languages/typescript/comment-classification.d.ts.map +1 -0
- package/dist/src/languages/typescript/comment-classification.js +45 -0
- package/dist/src/languages/typescript/comment-classification.js.map +1 -0
- package/dist/src/languages/typescript/comments.d.ts +12 -0
- package/dist/src/languages/typescript/comments.d.ts.map +1 -0
- package/dist/src/languages/typescript/comments.js +77 -0
- package/dist/src/languages/typescript/comments.js.map +1 -0
- package/dist/src/languages/typescript/index.d.ts +4 -0
- package/dist/src/languages/typescript/index.d.ts.map +1 -0
- package/dist/src/languages/typescript/index.js +20 -0
- package/dist/src/languages/typescript/index.js.map +1 -0
- package/dist/src/languages/typescript/parser.d.ts +4 -0
- package/dist/src/languages/typescript/parser.d.ts.map +1 -0
- package/dist/src/languages/typescript/parser.js +52 -0
- package/dist/src/languages/typescript/parser.js.map +1 -0
- package/package.json +51 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.isDatamodelEncapsulationCriterion = exports.runDatamodelEncapsulation = void 0;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const pandm_1 = require("@fyuld/pandm");
|
|
40
|
+
const format_1 = require("../../format");
|
|
41
|
+
const isInExemptedDirectory = (filePath, dirs) => {
|
|
42
|
+
const normalized = filePath.split(path.sep).join('/');
|
|
43
|
+
return dirs.some((d) => {
|
|
44
|
+
const dn = d.replace(/^\.\//, '').replace(/\/$/, '');
|
|
45
|
+
return normalized === dn || normalized.startsWith(`${dn}/`);
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
const matchesAnyConvention = (name, conventions) => conventions.some((c) => new RegExp(c.pattern).test(name));
|
|
49
|
+
const isTemp = (name, prefix) => prefix.length > 0 && name.startsWith(prefix);
|
|
50
|
+
const interpolate = (template, vars) => template.replace(/\{\{(\w+)\}\}/g, (_, key) => vars[key] ?? `{{${key}}}`);
|
|
51
|
+
const render = (criterion, violations, objectiveMarkdown) => {
|
|
52
|
+
const origins = criterion.datamodelOrigins.join(', ');
|
|
53
|
+
const detailsRendered = interpolate(criterion.details, { origins });
|
|
54
|
+
const lines = [];
|
|
55
|
+
lines.push((0, format_1.styled)('30;47', criterion.title));
|
|
56
|
+
lines.push(detailsRendered);
|
|
57
|
+
if (objectiveMarkdown) {
|
|
58
|
+
lines.push('');
|
|
59
|
+
lines.push(objectiveMarkdown.trimEnd());
|
|
60
|
+
}
|
|
61
|
+
lines.push('');
|
|
62
|
+
lines.push(`Found ${violations.length} rogue/disallowed type definition${violations.length === 1 ? '' : 's'}:`);
|
|
63
|
+
for (const v of violations) {
|
|
64
|
+
lines.push(` - ${v.name} (${v.kind}) at ${v.file}:${v.line}`);
|
|
65
|
+
}
|
|
66
|
+
lines.push('');
|
|
67
|
+
lines.push('Allowed permanent exceptions:');
|
|
68
|
+
for (const c of criterion.exemptions) {
|
|
69
|
+
lines.push(` - ${c.name}: ${c.details}`);
|
|
70
|
+
}
|
|
71
|
+
lines.push('');
|
|
72
|
+
lines.push('Allowed development/experimental exceptions:');
|
|
73
|
+
lines.push(` - ${criterion.tempTypeUglyPrefix}*`);
|
|
74
|
+
lines.push('');
|
|
75
|
+
lines.push(`Absolute Score: ${violations.length}`);
|
|
76
|
+
return lines.join('\n');
|
|
77
|
+
};
|
|
78
|
+
const runDatamodelEncapsulation = (criterion, typesFile, objectiveMarkdown) => {
|
|
79
|
+
const entries = JSON.parse(fs.readFileSync(typesFile, 'utf-8'));
|
|
80
|
+
const violations = [];
|
|
81
|
+
for (const e of entries) {
|
|
82
|
+
if (isInExemptedDirectory(e.file, criterion.exemptedDirectories ?? []))
|
|
83
|
+
continue;
|
|
84
|
+
if (matchesAnyConvention(e.name, criterion.exemptions))
|
|
85
|
+
continue;
|
|
86
|
+
if (isTemp(e.name, criterion.tempTypeUglyPrefix))
|
|
87
|
+
continue;
|
|
88
|
+
violations.push(e);
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
absoluteScore: violations.length,
|
|
92
|
+
rendered: render(criterion, violations, objectiveMarkdown),
|
|
93
|
+
violations,
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
exports.runDatamodelEncapsulation = runDatamodelEncapsulation;
|
|
97
|
+
const isDatamodelEncapsulationCriterion = (c) => c.kind === pandm_1.CriterionKind.DatamodelEncapsulation;
|
|
98
|
+
exports.isDatamodelEncapsulationCriterion = isDatamodelEncapsulationCriterion;
|
|
99
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/fitness-tests/datamodel-encapsulation/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAwB;AACxB,2CAA4B;AAC5B,wCAKqB;AAErB,yCAAqC;AAQrC,MAAM,qBAAqB,GAAG,CAAC,QAAgB,EAAE,IAAc,EAAW,EAAE;IAC1E,MAAM,UAAU,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACrD,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;QACrB,MAAM,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,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A0B,EACI,EAAE;IAChC,MAAM,OAAO,GAAgB,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAA;IAC5E,MAAM,UAAU,GAAgB,EAAE,CAAA;IAClC,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,IAAI,qBAAqB,CAAC,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,mBAAmB,IAAI,EAAE,CAAC;YACpE,SAAQ;QACV,IAAI,oBAAoB,CAAC,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,UAAU,CAAC;YAAE,SAAQ;QAChE,IAAI,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,kBAAkB,CAAC;YAAE,SAAQ;QAC1D,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACpB,CAAC;IACD,OAAO;QACL,aAAa,EAAE,UAAU,CAAC,MAAM;QAChC,QAAQ,EAAE,MAAM,CAAC,SAAS,EAAE,UAAU,EAAE,iBAAiB,CAAC;QAC1D,UAAU;KACX,CAAA;AACH,CAAC,CAAA;AAnBY,QAAA,yBAAyB,6BAmBrC;AAEM,MAAM,iCAAiC,GAAG,CAC/C,CAAY,EAC0B,EAAE,CACxC,CAAC,CAAC,IAAI,KAAK,qBAAa,CAAC,sBAAsB,CAAA;AAHpC,QAAA,iCAAiC,qCAGG"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Criterion, CriterionKind } from '@fyuld/pandm';
|
|
2
|
+
import { ThrowEntry } from '../../assessments/throws';
|
|
3
|
+
import { ClassEntry } from '../../assessments/classes';
|
|
4
|
+
export type ErrorFactoriesCriterion = Criterion & {
|
|
5
|
+
kind: CriterionKind.ErrorFactories;
|
|
6
|
+
exemptedDirectories: string[];
|
|
7
|
+
};
|
|
8
|
+
export type ErrorFactoriesResult = {
|
|
9
|
+
absoluteScore: number;
|
|
10
|
+
proportionalScore: number;
|
|
11
|
+
rendered: string;
|
|
12
|
+
throwViolations: ThrowEntry[];
|
|
13
|
+
classViolations: ClassEntry[];
|
|
14
|
+
};
|
|
15
|
+
export declare const runErrorFactories: (criterion: ErrorFactoriesCriterion, throwsJson: string, classesJson: string, objectiveMarkdown?: string) => ErrorFactoriesResult;
|
|
16
|
+
export declare const isErrorFactoriesCriterion: (c: Criterion) => c is ErrorFactoriesCriterion;
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/fitness-tests/error-factories/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACvD,OAAO,EAAE,UAAU,EAAgB,MAAM,0BAA0B,CAAA;AACnE,OAAO,EAAE,UAAU,EAAiB,MAAM,2BAA2B,CAAA;AAGrE,MAAM,MAAM,uBAAuB,GAAG,SAAS,GAAG;IAChD,IAAI,EAAE,aAAa,CAAC,cAAc,CAAA;IAClC,mBAAmB,EAAE,MAAM,EAAE,CAAA;CAC9B,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,aAAa,EAAE,MAAM,CAAA;IACrB,iBAAiB,EAAE,MAAM,CAAA;IACzB,QAAQ,EAAE,MAAM,CAAA;IAChB,eAAe,EAAE,UAAU,EAAE,CAAA;IAC7B,eAAe,EAAE,UAAU,EAAE,CAAA;CAC9B,CAAA;AAwDD,eAAO,MAAM,iBAAiB,GAC5B,WAAW,uBAAuB,EAClC,YAAY,MAAM,EAClB,aAAa,MAAM,EACnB,oBAAoB,MAAM,KACzB,oBA6CF,CAAA;AAED,eAAO,MAAM,yBAAyB,GACpC,GAAG,SAAS,KACX,CAAC,IAAI,uBAAkE,CAAA"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.isErrorFactoriesCriterion = exports.runErrorFactories = void 0;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const pandm_1 = require("@fyuld/pandm");
|
|
40
|
+
const format_1 = require("../../format");
|
|
41
|
+
const isInExemptedDirectory = (filePath, dirs) => {
|
|
42
|
+
const normalized = filePath.split(path.sep).join('/');
|
|
43
|
+
return dirs.some((d) => {
|
|
44
|
+
const dn = d.replace(/^\.\//, '').replace(/\/$/, '');
|
|
45
|
+
return normalized === dn || normalized.startsWith(`${dn}/`);
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
const interpolate = (template, vars) => template.replace(/\{\{(\w+)\}\}/g, (_, key) => vars[key] ?? `{{${key}}}`);
|
|
49
|
+
const isErrorClass = (c) => c.name.endsWith('Error');
|
|
50
|
+
const render = (criterion, throwViolations, classViolations, totalThrows, errorClassCount, proportionalScore, objectiveMarkdown) => {
|
|
51
|
+
const detailsRendered = interpolate(criterion.details, {});
|
|
52
|
+
const lines = [];
|
|
53
|
+
lines.push((0, format_1.styled)('30;47', criterion.title));
|
|
54
|
+
lines.push(detailsRendered);
|
|
55
|
+
if (objectiveMarkdown) {
|
|
56
|
+
lines.push('');
|
|
57
|
+
lines.push(objectiveMarkdown.trimEnd());
|
|
58
|
+
}
|
|
59
|
+
lines.push('');
|
|
60
|
+
lines.push(`Throws using direct construction (${throwViolations.length} of ${totalThrows}):`);
|
|
61
|
+
for (const v of throwViolations) {
|
|
62
|
+
lines.push(` - new ${v.className}(...) at ${v.file}:${v.line}`);
|
|
63
|
+
}
|
|
64
|
+
lines.push('');
|
|
65
|
+
lines.push(`Error classes with non-private constructors (${classViolations.length} of ${errorClassCount}):`);
|
|
66
|
+
for (const v of classViolations) {
|
|
67
|
+
lines.push(` - ${v.name} at ${v.file}:${v.line} (${v.constructorVisibility ?? 'undefined'})`);
|
|
68
|
+
}
|
|
69
|
+
lines.push('');
|
|
70
|
+
lines.push(`Absolute Score: ${throwViolations.length + classViolations.length}`);
|
|
71
|
+
lines.push(`Proportional Score: ${(proportionalScore * 100).toFixed(2)}%`);
|
|
72
|
+
return lines.join('\n');
|
|
73
|
+
};
|
|
74
|
+
const runErrorFactories = (criterion, throwsJson, classesJson, objectiveMarkdown) => {
|
|
75
|
+
const throwsReport = JSON.parse(fs.readFileSync(throwsJson, 'utf-8'));
|
|
76
|
+
const classesReport = JSON.parse(fs.readFileSync(classesJson, 'utf-8'));
|
|
77
|
+
const throwViolations = throwsReport.throws.filter((t) => t.kind === 'new' &&
|
|
78
|
+
!isInExemptedDirectory(t.file, criterion.exemptedDirectories));
|
|
79
|
+
const errorClasses = classesReport.classes.filter((c) => isErrorClass(c) &&
|
|
80
|
+
!isInExemptedDirectory(c.file, criterion.exemptedDirectories));
|
|
81
|
+
const classViolations = errorClasses.filter((c) => c.constructorVisibility === 'public' ||
|
|
82
|
+
c.constructorVisibility === 'protected');
|
|
83
|
+
const denominator = throwsReport.totalThrows + errorClasses.length;
|
|
84
|
+
const totalViolations = throwViolations.length + classViolations.length;
|
|
85
|
+
const proportionalScore = denominator === 0 ? 0 : totalViolations / denominator;
|
|
86
|
+
return {
|
|
87
|
+
absoluteScore: totalViolations,
|
|
88
|
+
proportionalScore,
|
|
89
|
+
rendered: render(criterion, throwViolations, classViolations, throwsReport.totalThrows, errorClasses.length, proportionalScore, objectiveMarkdown),
|
|
90
|
+
throwViolations,
|
|
91
|
+
classViolations,
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
exports.runErrorFactories = runErrorFactories;
|
|
95
|
+
const isErrorFactoriesCriterion = (c) => c.kind === pandm_1.CriterionKind.ErrorFactories;
|
|
96
|
+
exports.isErrorFactoriesCriterion = isErrorFactoriesCriterion;
|
|
97
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/fitness-tests/error-factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAwB;AACxB,2CAA4B;AAC5B,wCAAuD;AAGvD,yCAAqC;AAerC,MAAM,qBAAqB,GAAG,CAAC,QAAgB,EAAE,IAAc,EAAW,EAAE;IAC1E,MAAM,UAAU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AAM,yBAAyB,GAAG,CACvC,CAAY,EACkB,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,qBAAa,CAAC,cAAc,CAAA;AAF7D,QAAA,yBAAyB,6BAEoC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Criterion, UnhelpfulErrorsCriterion } from '@fyuld/pandm';
|
|
2
|
+
import { ThrowEntry } from '../../assessments/throws';
|
|
3
|
+
export type UnhelpfulErrorsResult = {
|
|
4
|
+
absoluteScore: number;
|
|
5
|
+
proportionalScore: number;
|
|
6
|
+
rendered: string;
|
|
7
|
+
violations: ThrowEntry[];
|
|
8
|
+
};
|
|
9
|
+
export declare const runUnhelpfulErrors: (criterion: UnhelpfulErrorsCriterion, throwsJson: string, objectiveMarkdown?: string) => UnhelpfulErrorsResult;
|
|
10
|
+
export declare const isUnhelpfulErrorsCriterion: (c: Criterion) => c is UnhelpfulErrorsCriterion;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/fitness-tests/unhelpful-errors/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,SAAS,EAET,wBAAwB,EACzB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,UAAU,EAAgB,MAAM,0BAA0B,CAAA;AAKnE,MAAM,MAAM,qBAAqB,GAAG;IAClC,aAAa,EAAE,MAAM,CAAA;IACrB,iBAAiB,EAAE,MAAM,CAAA;IACzB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,UAAU,EAAE,CAAA;CACzB,CAAA;AA8CD,eAAO,MAAM,kBAAkB,GAC7B,WAAW,wBAAwB,EACnC,YAAY,MAAM,EAClB,oBAAoB,MAAM,KACzB,qBAqBF,CAAA;AAED,eAAO,MAAM,0BAA0B,GACrC,GAAG,SAAS,KACX,CAAC,IAAI,wBAAoE,CAAA"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.isUnhelpfulErrorsCriterion = exports.runUnhelpfulErrors = void 0;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const pandm_1 = require("@fyuld/pandm");
|
|
40
|
+
const format_1 = require("../../format");
|
|
41
|
+
const BANNED_CLASSES = new Set(['Error']);
|
|
42
|
+
const isInExemptedDirectory = (filePath, dirs) => {
|
|
43
|
+
const normalized = filePath.split(path.sep).join('/');
|
|
44
|
+
return dirs.some((d) => {
|
|
45
|
+
const dn = d.replace(/^\.\//, '').replace(/\/$/, '');
|
|
46
|
+
return normalized === dn || normalized.startsWith(`${dn}/`);
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
const isUnhelpful = (t) => t.kind === 'new' &&
|
|
50
|
+
t.className !== undefined &&
|
|
51
|
+
BANNED_CLASSES.has(t.className);
|
|
52
|
+
const interpolate = (template, vars) => template.replace(/\{\{(\w+)\}\}/g, (_, key) => vars[key] ?? `{{${key}}}`);
|
|
53
|
+
const render = (criterion, violations, totalThrows, proportionalScore, objectiveMarkdown) => {
|
|
54
|
+
const detailsRendered = interpolate(criterion.details, {});
|
|
55
|
+
const lines = [];
|
|
56
|
+
lines.push((0, format_1.styled)('30;47', criterion.title));
|
|
57
|
+
lines.push(detailsRendered);
|
|
58
|
+
if (objectiveMarkdown) {
|
|
59
|
+
lines.push('');
|
|
60
|
+
lines.push(objectiveMarkdown.trimEnd());
|
|
61
|
+
}
|
|
62
|
+
lines.push('');
|
|
63
|
+
lines.push(`Found ${violations.length} unhelpful throw${violations.length === 1 ? '' : 's'} (of ${totalThrows} total):`);
|
|
64
|
+
for (const v of violations) {
|
|
65
|
+
lines.push(` - new ${v.className}(...) at ${v.file}:${v.line}`);
|
|
66
|
+
}
|
|
67
|
+
lines.push('');
|
|
68
|
+
lines.push(`Absolute Score: ${violations.length}`);
|
|
69
|
+
lines.push(`Proportional Score: ${(proportionalScore * 100).toFixed(2)}%`);
|
|
70
|
+
return lines.join('\n');
|
|
71
|
+
};
|
|
72
|
+
const runUnhelpfulErrors = (criterion, throwsJson, objectiveMarkdown) => {
|
|
73
|
+
const report = JSON.parse(fs.readFileSync(throwsJson, 'utf-8'));
|
|
74
|
+
const violations = report.throws.filter((t) => isUnhelpful(t) &&
|
|
75
|
+
!isInExemptedDirectory(t.file, criterion.exemptedDirectories));
|
|
76
|
+
const proportionalScore = report.totalThrows === 0 ? 0 : violations.length / report.totalThrows;
|
|
77
|
+
return {
|
|
78
|
+
absoluteScore: violations.length,
|
|
79
|
+
proportionalScore,
|
|
80
|
+
rendered: render(criterion, violations, report.totalThrows, proportionalScore, objectiveMarkdown),
|
|
81
|
+
violations,
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
exports.runUnhelpfulErrors = runUnhelpfulErrors;
|
|
85
|
+
const isUnhelpfulErrorsCriterion = (c) => c.kind === pandm_1.CriterionKind.UnhelpfulErrors;
|
|
86
|
+
exports.isUnhelpfulErrorsCriterion = isUnhelpfulErrorsCriterion;
|
|
87
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/fitness-tests/unhelpful-errors/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAwB;AACxB,2CAA4B;AAC5B,wCAIqB;AAErB,yCAAqC;AAErC,MAAM,cAAc,GAAG,IAAI,GAAG,CAAS,CAAC,OAAO,CAAC,CAAC,CAAA;AASjD,MAAM,qBAAqB,GAAG,CAAC,QAAgB,EAAE,IAAc,EAAW,EAAE;IAC1E,MAAM,UAAU,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACrD,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;QACrB,MAAM,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;QACpD,OAAO,UAAU,KAAK,EA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ACH,CAAC,CAAA;AAzBY,QAAA,kBAAkB,sBAyB9B;AAEM,MAAM,0BAA0B,GAAG,CACxC,CAAY,EACmB,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,qBAAa,CAAC,eAAe,CAAA;AAF/D,QAAA,0BAA0B,8BAEqC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/format.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,GAAI,GAAG,OAAO,KAAG,IAEtC,CAAA;AAED,eAAO,MAAM,MAAM,GAAI,OAAO,MAAM,EAAE,MAAM,MAAM,KAAG,MACF,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.styled = exports.setPretty = void 0;
|
|
4
|
+
let usePretty = true;
|
|
5
|
+
const setPretty = (b) => {
|
|
6
|
+
usePretty = b;
|
|
7
|
+
};
|
|
8
|
+
exports.setPretty = setPretty;
|
|
9
|
+
const styled = (codes, text) => usePretty ? `\x1b[${codes}m${text}\x1b[0m` : text;
|
|
10
|
+
exports.styled = styled;
|
|
11
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/format.ts"],"names":[],"mappings":";;;AAAA,IAAI,SAAS,GAAG,IAAI,CAAA;AAEb,MAAM,SAAS,GAAG,CAAC,CAAU,EAAQ,EAAE;IAC5C,SAAS,GAAG,CAAC,CAAA;AACf,CAAC,CAAA;AAFY,QAAA,SAAS,aAErB;AAEM,MAAM,MAAM,GAAG,CAAC,KAAa,EAAE,IAAY,EAAU,EAAE,CAC5D,SAAS,CAAC,CAAC,CAAC,QAAQ,KAAK,IAAI,IAAI,SAAS,CAAC,CAAC,CAAC,IAAI,CAAA;AADtC,QAAA,MAAM,UACgC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fpou-cli.d.ts","sourceRoot":"","sources":["../../src/fpou-cli.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const ts = __importStar(require("typescript"));
|
|
40
|
+
const typescript_1 = require("./languages/typescript");
|
|
41
|
+
const types_1 = require("./assessments/types");
|
|
42
|
+
const index_files_1 = require("./assessments/index-files");
|
|
43
|
+
const throws_1 = require("./assessments/throws");
|
|
44
|
+
const classes_1 = require("./assessments/classes");
|
|
45
|
+
const format_1 = require("./format");
|
|
46
|
+
const datamodel_encapsulation_1 = require("./fitness-tests/datamodel-encapsulation");
|
|
47
|
+
const barrel_purity_1 = require("./fitness-tests/barrel-purity");
|
|
48
|
+
const unhelpful_errors_1 = require("./fitness-tests/unhelpful-errors");
|
|
49
|
+
const error_factories_1 = require("./fitness-tests/error-factories");
|
|
50
|
+
const pano_bdd_1 = require("@fyuld/pano-bdd");
|
|
51
|
+
const SKIP_DIRS = new Set(['node_modules', 'dist']);
|
|
52
|
+
const CONFIG_FILENAME = '.fpan/fpan.config.json';
|
|
53
|
+
const ASSESSMENTS_SUBDIR = 'generated-assessments';
|
|
54
|
+
const OBJECTIVES_SUBDIR = 'objectives';
|
|
55
|
+
const loadObjective = (configDir, kind) => {
|
|
56
|
+
const file = path.join(configDir, OBJECTIVES_SUBDIR, `${kind}.md`);
|
|
57
|
+
if (!fs.existsSync(file))
|
|
58
|
+
return undefined;
|
|
59
|
+
return fs.readFileSync(file, 'utf-8');
|
|
60
|
+
};
|
|
61
|
+
const walkTypeScript = (dir, acc = []) => {
|
|
62
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
63
|
+
for (const entry of entries) {
|
|
64
|
+
if (entry.isDirectory()) {
|
|
65
|
+
if (SKIP_DIRS.has(entry.name))
|
|
66
|
+
continue;
|
|
67
|
+
walkTypeScript(path.join(dir, entry.name), acc);
|
|
68
|
+
}
|
|
69
|
+
else if (entry.isFile() && entry.name.endsWith('.ts')) {
|
|
70
|
+
acc.push(path.join(dir, entry.name));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return acc;
|
|
74
|
+
};
|
|
75
|
+
const countCodeLines = (sourceFile) => {
|
|
76
|
+
const lines = new Set();
|
|
77
|
+
const visit = (node) => {
|
|
78
|
+
if (node.kind === ts.SyntaxKind.EndOfFileToken)
|
|
79
|
+
return;
|
|
80
|
+
let hasChild = false;
|
|
81
|
+
node.forEachChild(() => {
|
|
82
|
+
hasChild = true;
|
|
83
|
+
});
|
|
84
|
+
if (!hasChild) {
|
|
85
|
+
const startPos = node.getStart(sourceFile);
|
|
86
|
+
const startLine = sourceFile.getLineAndCharacterOfPosition(startPos).line;
|
|
87
|
+
const endLine = sourceFile.getLineAndCharacterOfPosition(node.end).line;
|
|
88
|
+
for (let l = startLine; l <= endLine; l++)
|
|
89
|
+
lines.add(l);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
node.forEachChild(visit);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
visit(sourceFile);
|
|
96
|
+
return lines.size;
|
|
97
|
+
};
|
|
98
|
+
const findConfig = (startDir) => {
|
|
99
|
+
let dir = path.resolve(startDir);
|
|
100
|
+
while (true) {
|
|
101
|
+
const candidate = path.join(dir, CONFIG_FILENAME);
|
|
102
|
+
if (fs.existsSync(candidate))
|
|
103
|
+
return candidate;
|
|
104
|
+
const parent = path.dirname(dir);
|
|
105
|
+
if (parent === dir) {
|
|
106
|
+
throw new Error(`${CONFIG_FILENAME} not found in ${startDir} or any parent directory`);
|
|
107
|
+
}
|
|
108
|
+
dir = parent;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
const loadConfig = (configPath) => JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
112
|
+
const rawArgs = process.argv.slice(2);
|
|
113
|
+
const only = new Set();
|
|
114
|
+
const sans = new Set();
|
|
115
|
+
let plainFormatting = false;
|
|
116
|
+
const positional = [];
|
|
117
|
+
let collecting;
|
|
118
|
+
for (const a of rawArgs) {
|
|
119
|
+
if (a.startsWith('--')) {
|
|
120
|
+
collecting = undefined;
|
|
121
|
+
const eq = a.indexOf('=');
|
|
122
|
+
const name = eq >= 0 ? a.slice(2, eq) : a.slice(2);
|
|
123
|
+
const eqValue = eq >= 0 ? a.slice(eq + 1) : undefined;
|
|
124
|
+
if (name === 'only') {
|
|
125
|
+
collecting = only;
|
|
126
|
+
if (eqValue)
|
|
127
|
+
eqValue.split(',').forEach((s) => only.add(s));
|
|
128
|
+
}
|
|
129
|
+
else if (name === 'sans') {
|
|
130
|
+
collecting = sans;
|
|
131
|
+
if (eqValue)
|
|
132
|
+
eqValue.split(',').forEach((s) => sans.add(s));
|
|
133
|
+
}
|
|
134
|
+
else if (name === 'plain-formatting') {
|
|
135
|
+
plainFormatting = true;
|
|
136
|
+
}
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
if (collecting) {
|
|
140
|
+
a.split(',').forEach((s) => collecting.add(s));
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
positional.push(a);
|
|
144
|
+
}
|
|
145
|
+
(0, format_1.setPretty)(process.stdout.isTTY && !plainFormatting);
|
|
146
|
+
const [subcommand, ...directories] = positional;
|
|
147
|
+
const criterionMatchesFilter = (c, set) => {
|
|
148
|
+
if (set.has(String(c.kind)))
|
|
149
|
+
return true;
|
|
150
|
+
if (c.id !== undefined && set.has(c.id))
|
|
151
|
+
return true;
|
|
152
|
+
return false;
|
|
153
|
+
};
|
|
154
|
+
if (subcommand === 'assess') {
|
|
155
|
+
const files = directories.flatMap((d) => walkTypeScript(d));
|
|
156
|
+
let totalLoC = 0;
|
|
157
|
+
let totalComments = 0;
|
|
158
|
+
for (const file of files) {
|
|
159
|
+
const source = fs.readFileSync(file, 'utf-8');
|
|
160
|
+
const sourceFile = (0, typescript_1.parseTypeScript)(source, file);
|
|
161
|
+
totalLoC += countCodeLines(sourceFile);
|
|
162
|
+
totalComments += (0, typescript_1.getAllComments)(sourceFile).length;
|
|
163
|
+
}
|
|
164
|
+
const configPath = findConfig(process.cwd());
|
|
165
|
+
const config = loadConfig(configPath);
|
|
166
|
+
const configDir = path.dirname(configPath);
|
|
167
|
+
const outDir = path.join(configDir, ASSESSMENTS_SUBDIR);
|
|
168
|
+
const { entries } = (0, types_1.runTypesAssessment)(files, config.assessmentFormats, outDir);
|
|
169
|
+
const indexResult = (0, index_files_1.runIndexFilesAssessment)(files, config.assessmentFormats, outDir);
|
|
170
|
+
const throwsResult = (0, throws_1.runThrowsAssessment)(files, config.assessmentFormats, outDir);
|
|
171
|
+
const classesResult = (0, classes_1.runClassesAssessment)(files, config.assessmentFormats, outDir);
|
|
172
|
+
console.log(`Files: ${files.length}`);
|
|
173
|
+
console.log(`Lines of code: ${totalLoC}`);
|
|
174
|
+
console.log(`Comments: ${totalComments}`);
|
|
175
|
+
console.log(`Types defined: ${entries.length}`);
|
|
176
|
+
console.log(`Impure barrel files: ${indexResult.report.violations.length} of ${indexResult.report.totalIndexFiles} index.ts`);
|
|
177
|
+
console.log(`Throws: ${throwsResult.report.totalThrows}`);
|
|
178
|
+
console.log(`Classes: ${classesResult.report.classes.length}`);
|
|
179
|
+
console.log(`Wrote assessments to ${outDir}`);
|
|
180
|
+
}
|
|
181
|
+
else if (subcommand === 'fitness') {
|
|
182
|
+
const configPath = findConfig(process.cwd());
|
|
183
|
+
const config = loadConfig(configPath);
|
|
184
|
+
const configDir = path.dirname(configPath);
|
|
185
|
+
const outDir = path.join(configDir, ASSESSMENTS_SUBDIR);
|
|
186
|
+
const typesFile = path.join(outDir, 'types.json');
|
|
187
|
+
if (!fs.existsSync(typesFile)) {
|
|
188
|
+
console.error(`Assessment file not found at ${typesFile}. Run \`fpou assess\` first.`);
|
|
189
|
+
process.exit(1);
|
|
190
|
+
}
|
|
191
|
+
const indexFilesFile = path.join(outDir, 'index-files.json');
|
|
192
|
+
const throwsFile = path.join(outDir, 'throws.json');
|
|
193
|
+
const classesFile = path.join(outDir, 'classes.json');
|
|
194
|
+
let ran = 0;
|
|
195
|
+
for (const criterion of config.criteria) {
|
|
196
|
+
const c = criterion;
|
|
197
|
+
if (only.size > 0 && !criterionMatchesFilter(c, only))
|
|
198
|
+
continue;
|
|
199
|
+
if (criterionMatchesFilter(c, sans))
|
|
200
|
+
continue;
|
|
201
|
+
const objective = loadObjective(configDir, String(criterion.kind));
|
|
202
|
+
if ((0, datamodel_encapsulation_1.isDatamodelEncapsulationCriterion)(criterion)) {
|
|
203
|
+
const result = (0, datamodel_encapsulation_1.runDatamodelEncapsulation)(criterion, typesFile, objective);
|
|
204
|
+
console.log(result.rendered);
|
|
205
|
+
console.log('');
|
|
206
|
+
ran++;
|
|
207
|
+
}
|
|
208
|
+
else if ((0, barrel_purity_1.isBarrelPurityCriterion)(criterion)) {
|
|
209
|
+
const result = (0, barrel_purity_1.runBarrelPurity)(criterion, indexFilesFile, objective);
|
|
210
|
+
console.log(result.rendered);
|
|
211
|
+
console.log('');
|
|
212
|
+
ran++;
|
|
213
|
+
}
|
|
214
|
+
else if ((0, unhelpful_errors_1.isUnhelpfulErrorsCriterion)(criterion)) {
|
|
215
|
+
const result = (0, unhelpful_errors_1.runUnhelpfulErrors)(criterion, throwsFile, objective);
|
|
216
|
+
console.log(result.rendered);
|
|
217
|
+
console.log('');
|
|
218
|
+
ran++;
|
|
219
|
+
}
|
|
220
|
+
else if ((0, error_factories_1.isErrorFactoriesCriterion)(criterion)) {
|
|
221
|
+
const result = (0, error_factories_1.runErrorFactories)(criterion, throwsFile, classesFile, objective);
|
|
222
|
+
console.log(result.rendered);
|
|
223
|
+
console.log('');
|
|
224
|
+
ran++;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if (ran === 0) {
|
|
228
|
+
console.log('No criteria configured');
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
else if (subcommand === 'generate-bdd-steps') {
|
|
232
|
+
const [featurePath] = directories;
|
|
233
|
+
console.log((0, pano_bdd_1.generate)(featurePath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