@dialecte/cli 0.7.0 → 0.8.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.
- package/README.md +33 -2194
- package/dist/cli.js +49099 -26727
- package/dist/corpus/manifest.json +692 -0
- package/dist/corpus/overrides/fhir-xhtml.xsd +17 -0
- package/dist/corpus/overrides/xlink.xsd +102 -0
- package/dist/corpus/overrides/xml.xsd +35 -0
- package/dist/dialecte_tdd_pytest.py +792 -0
- package/dist/lookups.d.ts +10 -0
- package/dist/lookups.js +97 -13
- package/dist/schemas/config-list.schema.json +121 -0
- package/dist/schemas/config-yml.schema.json +52 -0
- package/dist/schemas/dialecterc.schema.json +33 -0
- package/dist/schemas/lot-risk.schema.json +32 -0
- package/dist/schemas/risk-line.schema.json +49 -0
- package/dist/schemas/rules.schema.json +51 -0
- package/dist/schemas/scope-change.schema.json +103 -0
- package/dist/tdd-node-reporter.js +167 -0
- package/dist/tdd-reporter.js +2 -0
- package/package.json +25 -6
package/dist/lookups.d.ts
CHANGED
|
@@ -591,6 +591,10 @@ type LoadedStandards = {
|
|
|
591
591
|
ready: StandardReadyIndex[];
|
|
592
592
|
skipped: StandardFolder[];
|
|
593
593
|
installed: StandardInstalledVocabulary;
|
|
594
|
+
/** Every file of the folders read, as its bytes are now: id, sha256 and original line count, in folder order. */
|
|
595
|
+
manifest: ManifestFile[];
|
|
596
|
+
/** Each file's original lines, from the same bytes as its sha256 (line n at index n - 1). */
|
|
597
|
+
originalLines: Map<string, string[]>;
|
|
594
598
|
};
|
|
595
599
|
/**
|
|
596
600
|
* The standards loaded; a refusal (exit 2, `layout` the expected layout of the root when the refusal is about it);
|
|
@@ -608,6 +612,12 @@ type LoadedStandardIndexes = LoadedStandards | {
|
|
|
608
612
|
kind: 'aborted';
|
|
609
613
|
message: string;
|
|
610
614
|
};
|
|
615
|
+
/** A file of the ask's manifest. */
|
|
616
|
+
type ManifestFile = {
|
|
617
|
+
id: string;
|
|
618
|
+
sha256: string;
|
|
619
|
+
lines: number;
|
|
620
|
+
};
|
|
611
621
|
|
|
612
622
|
/**
|
|
613
623
|
* The selected standards' search indexes (built in the cache when missing), each folder's files key and the
|
package/dist/lookups.js
CHANGED
|
@@ -528,6 +528,10 @@ import { basename as basename2, dirname as dirname3, isAbsolute as isAbsolute2,
|
|
|
528
528
|
// src/lib/git.constants.ts
|
|
529
529
|
var GIT_READ_ENVIRONMENT = { GIT_OPTIONAL_LOCKS: "0" };
|
|
530
530
|
|
|
531
|
+
// src/lib/worktree/worktree.constants.ts
|
|
532
|
+
var MINUTE_MS = 60 * 1e3;
|
|
533
|
+
var RECLAIM_DAY_MS = 24 * 60 * 60 * 1e3;
|
|
534
|
+
|
|
531
535
|
// src/lib/git.ts
|
|
532
536
|
function readGit(params) {
|
|
533
537
|
const result = spawnSync("git", ["-c", "core.quotePath=false", ...params.args], {
|
|
@@ -867,6 +871,46 @@ import { join as join18 } from "path";
|
|
|
867
871
|
|
|
868
872
|
// src/lib/tdd/tdd.constants.ts
|
|
869
873
|
var TEST_FILE_PATTERN = /\.(test|spec)\.[cm]?[jt]sx?$/;
|
|
874
|
+
var NODE_EVENT_TYPES = {
|
|
875
|
+
start: "test:start",
|
|
876
|
+
pass: "test:pass",
|
|
877
|
+
fail: "test:fail",
|
|
878
|
+
stderr: "test:stderr"
|
|
879
|
+
};
|
|
880
|
+
var NODE_TEST_EVENT_TYPES = [
|
|
881
|
+
NODE_EVENT_TYPES.start,
|
|
882
|
+
NODE_EVENT_TYPES.pass,
|
|
883
|
+
NODE_EVENT_TYPES.fail
|
|
884
|
+
];
|
|
885
|
+
var BASE_COPY_PYTEST_ARGUMENTS = [
|
|
886
|
+
"-c",
|
|
887
|
+
[
|
|
888
|
+
"import os, sys",
|
|
889
|
+
"folder = sys.argv[1]",
|
|
890
|
+
'current = {"", os.getcwd(), folder}',
|
|
891
|
+
"sys.path[:] = [folder] + [entry for entry in sys.path if entry not in current]",
|
|
892
|
+
'sys.argv = ["pytest"] + sys.argv[2:]',
|
|
893
|
+
"try:",
|
|
894
|
+
" import pytest",
|
|
895
|
+
"except ImportError:",
|
|
896
|
+
' sys.exit("No module named pytest")',
|
|
897
|
+
"sys.exit(pytest.console_main())"
|
|
898
|
+
].join("\n")
|
|
899
|
+
];
|
|
900
|
+
var EDITABLE_PROBE_SCRIPT = [
|
|
901
|
+
"import json, sys",
|
|
902
|
+
"from importlib import metadata",
|
|
903
|
+
"try:",
|
|
904
|
+
" found = metadata.distribution(sys.argv[1])",
|
|
905
|
+
"except metadata.PackageNotFoundError:",
|
|
906
|
+
" sys.exit(0)",
|
|
907
|
+
'direct = json.loads(found.read_text("direct_url.json") or "{}")',
|
|
908
|
+
"paths = [str(path) for path in (found.files or [])]",
|
|
909
|
+
'editable = direct.get("dir_info", {}).get("editable") or any(',
|
|
910
|
+
' "__editable__" in path or path.endswith(".pth") for path in paths',
|
|
911
|
+
")",
|
|
912
|
+
'print("editable" if editable else "installed")'
|
|
913
|
+
].join("\n");
|
|
870
914
|
|
|
871
915
|
// src/lib/discover.constants.ts
|
|
872
916
|
import ts from "typescript";
|
|
@@ -3048,6 +3092,10 @@ async function readSchemaDialectes(params) {
|
|
|
3048
3092
|
};
|
|
3049
3093
|
}
|
|
3050
3094
|
|
|
3095
|
+
// src/lib/knowledge/ask/load-standard-indexes.ts
|
|
3096
|
+
import { createHash as createHash5 } from "crypto";
|
|
3097
|
+
import { readFileSync as readFileSync18 } from "fs";
|
|
3098
|
+
|
|
3051
3099
|
// src/lib/knowledge/standard/ensure-standard-index.ts
|
|
3052
3100
|
import { createHash as createHash2 } from "crypto";
|
|
3053
3101
|
import { existsSync as existsSync22, readdirSync as readdirSync11, readFileSync as readFileSync16, renameSync as renameSync5, rmSync as rmSync5 } from "fs";
|
|
@@ -4771,18 +4819,38 @@ function standardFilesKey(params) {
|
|
|
4771
4819
|
const pairs = params.files.map((file) => [file.id, file.sha256]).sort(([first], [second]) => first < second ? -1 : first > second ? 1 : 0);
|
|
4772
4820
|
return `${STANDARD_FILES_KEY_PREFIX}${sha256Of2(stableJson(pairs))}`;
|
|
4773
4821
|
}
|
|
4774
|
-
function standardFolderFilesKey(params) {
|
|
4775
|
-
return standardFilesKey({
|
|
4776
|
-
files: params.standard.files.map((file) => ({
|
|
4777
|
-
id: file.id,
|
|
4778
|
-
sha256: sha256Of2(readFileSync17(file.path))
|
|
4779
|
-
}))
|
|
4780
|
-
});
|
|
4781
|
-
}
|
|
4782
4822
|
function sha256Of2(content) {
|
|
4783
4823
|
return createHash4("sha256").update(content).digest("hex");
|
|
4784
4824
|
}
|
|
4785
4825
|
|
|
4826
|
+
// src/lib/knowledge/ask/ask.constants.ts
|
|
4827
|
+
var SLOT_NAME = "[^\\s?@]+";
|
|
4828
|
+
var SLOT_CODE = "[^\\s?]+";
|
|
4829
|
+
var SLOT_REST = ".+?";
|
|
4830
|
+
var SLOT_PLACEHOLDER_PATTERNS = {
|
|
4831
|
+
"<T>": `(?<tag#>${SLOT_NAME})(?:\\s+(?:under|in)\\s+(?<parent#>${SLOT_NAME}))?`,
|
|
4832
|
+
"<A>": `(?:(?<tag#a>${SLOT_NAME})@(?<attribute#a>${SLOT_NAME})|@?(?<attribute#b>${SLOT_NAME})(?:\\s+on\\s+(?<tag#b>${SLOT_NAME}))?)`,
|
|
4833
|
+
"<C>": `(?<code#>${SLOT_CODE})`,
|
|
4834
|
+
"<rest>": `(?<rest#>${SLOT_REST})`
|
|
4835
|
+
};
|
|
4836
|
+
var SETUP_HASH_ALGORITHM = "sha256";
|
|
4837
|
+
var SETUP_HASH_ENCODING = "hex";
|
|
4838
|
+
var IN_WORD_HYPHEN_PATTERN = new RegExp("(?<=\\p{L})-(?=\\p{L})", "gu");
|
|
4839
|
+
var REPORT_VERDICTS = [
|
|
4840
|
+
"yes",
|
|
4841
|
+
"no",
|
|
4842
|
+
"depends",
|
|
4843
|
+
"value",
|
|
4844
|
+
"not-in-text"
|
|
4845
|
+
];
|
|
4846
|
+
var NOT_KNOWN_VERDICT = "not-known";
|
|
4847
|
+
var OUTSIDE_VERDICTS = [
|
|
4848
|
+
...REPORT_VERDICTS,
|
|
4849
|
+
NOT_KNOWN_VERDICT
|
|
4850
|
+
];
|
|
4851
|
+
var UPPER_CASE_PATTERN = new RegExp("\\p{Lu}", "u");
|
|
4852
|
+
var CLAIM_MAX_HELD_MS = 10 * 60 * 1e3;
|
|
4853
|
+
|
|
4786
4854
|
// src/lib/knowledge/ask/selected-folders-of.ts
|
|
4787
4855
|
function selectedFoldersOf(params) {
|
|
4788
4856
|
const { environment, standardIds } = params;
|
|
@@ -4824,7 +4892,9 @@ async function loadStandardIndexes(params) {
|
|
|
4824
4892
|
standard: { kind: "documents", indexes: [], folders: [] },
|
|
4825
4893
|
ready: [],
|
|
4826
4894
|
skipped: [],
|
|
4827
|
-
|
|
4895
|
+
manifest: [],
|
|
4896
|
+
installed,
|
|
4897
|
+
originalLines: /* @__PURE__ */ new Map()
|
|
4828
4898
|
};
|
|
4829
4899
|
for (const standard of selected.folders) {
|
|
4830
4900
|
if (!isReadableFolder({ folder: standard })) {
|
|
@@ -4843,13 +4913,27 @@ async function loadStandardIndexes(params) {
|
|
|
4843
4913
|
if (answer.kind === "aborted") return answer;
|
|
4844
4914
|
loaded.ready.push(answer.index);
|
|
4845
4915
|
loaded.standard.indexes.push(answer.index.search);
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4916
|
+
const read = filesReadOf({ standard, search: answer.index.search });
|
|
4917
|
+
const manifest = read.map((entry) => entry.manifest);
|
|
4918
|
+
loaded.manifest.push(...manifest);
|
|
4919
|
+
for (const entry of read) loaded.originalLines.set(entry.manifest.id, entry.lines);
|
|
4920
|
+
loaded.standard.folders.push({ id: standard.id, files: standardFilesKey({ files: manifest }) });
|
|
4850
4921
|
}
|
|
4851
4922
|
return loaded;
|
|
4852
4923
|
}
|
|
4924
|
+
function filesReadOf(params) {
|
|
4925
|
+
return params.standard.files.map(function fileReadOf(file) {
|
|
4926
|
+
const bytes = readFileSync18(file.path);
|
|
4927
|
+
return {
|
|
4928
|
+
manifest: {
|
|
4929
|
+
id: file.id,
|
|
4930
|
+
sha256: createHash5(SETUP_HASH_ALGORITHM).update(bytes).digest(SETUP_HASH_ENCODING),
|
|
4931
|
+
lines: params.search.files.find((index) => index.fileId === file.id)?.lineCount ?? 0
|
|
4932
|
+
},
|
|
4933
|
+
lines: bytes.toString("utf8").split(LINE_BREAK_PATTERN)
|
|
4934
|
+
};
|
|
4935
|
+
});
|
|
4936
|
+
}
|
|
4853
4937
|
async function vocabularyOf2(params) {
|
|
4854
4938
|
if (params.readVocabulary === false)
|
|
4855
4939
|
return { kind: "read", installed: emptyInstalledVocabulary() };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "config-list.schema.json",
|
|
4
|
+
"$comment": "Output of `dialecte config list --json`, `config get <key> --json` and `config check --json`, schema version 1.",
|
|
5
|
+
"title": "The answer of config list|get|check --json",
|
|
6
|
+
"oneOf": [{ "$ref": "#/$defs/list" }, { "$ref": "#/$defs/get" }, { "$ref": "#/$defs/check" }],
|
|
7
|
+
"$defs": {
|
|
8
|
+
"schema": { "type": "integer", "const": 1, "enum": [1] },
|
|
9
|
+
"list": {
|
|
10
|
+
"type": "object",
|
|
11
|
+
"required": ["schema", "projectFile", "personalFile", "repo", "values", "findings", "notes"],
|
|
12
|
+
"additionalProperties": false,
|
|
13
|
+
"properties": {
|
|
14
|
+
"schema": { "$ref": "#/$defs/schema" },
|
|
15
|
+
"projectFile": { "type": "string" },
|
|
16
|
+
"personalFile": { "type": "string" },
|
|
17
|
+
"repo": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"required": ["key", "from"],
|
|
20
|
+
"additionalProperties": false,
|
|
21
|
+
"properties": {
|
|
22
|
+
"key": { "type": "string" },
|
|
23
|
+
"from": { "enum": ["remote", "path"] }
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"values": { "type": "array", "items": { "$ref": "#/$defs/value" } },
|
|
27
|
+
"findings": { "type": "array", "items": { "$ref": "#/$defs/finding" } },
|
|
28
|
+
"notes": { "type": "array", "items": { "type": "string" } }
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"get": {
|
|
32
|
+
"type": "object",
|
|
33
|
+
"required": ["schema", "key", "value", "source"],
|
|
34
|
+
"additionalProperties": false,
|
|
35
|
+
"properties": {
|
|
36
|
+
"schema": { "$ref": "#/$defs/schema" },
|
|
37
|
+
"key": { "type": "string" },
|
|
38
|
+
"value": { "$comment": "Any value; null with a null source when the key is not set." },
|
|
39
|
+
"source": { "oneOf": [{ "$ref": "#/$defs/source" }, { "type": "null" }] },
|
|
40
|
+
"findings": { "type": "array", "items": { "$ref": "#/$defs/finding" } }
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"check": {
|
|
44
|
+
"type": "object",
|
|
45
|
+
"required": ["schema", "ok", "findings", "notes"],
|
|
46
|
+
"additionalProperties": false,
|
|
47
|
+
"properties": {
|
|
48
|
+
"schema": { "$ref": "#/$defs/schema" },
|
|
49
|
+
"ok": { "type": "boolean" },
|
|
50
|
+
"findings": { "type": "array", "items": { "$ref": "#/$defs/finding" } },
|
|
51
|
+
"notes": { "type": "array", "items": { "type": "string" } }
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"value": {
|
|
55
|
+
"type": "object",
|
|
56
|
+
"required": ["key", "value", "source"],
|
|
57
|
+
"additionalProperties": false,
|
|
58
|
+
"properties": {
|
|
59
|
+
"key": { "type": "string" },
|
|
60
|
+
"value": { "$comment": "Any value." },
|
|
61
|
+
"source": { "$ref": "#/$defs/source" }
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"source": {
|
|
65
|
+
"oneOf": [
|
|
66
|
+
{
|
|
67
|
+
"type": "object",
|
|
68
|
+
"required": ["kind", "file", "line"],
|
|
69
|
+
"additionalProperties": false,
|
|
70
|
+
"properties": {
|
|
71
|
+
"kind": { "enum": ["project"] },
|
|
72
|
+
"file": { "type": "string" },
|
|
73
|
+
"line": { "type": "integer", "minimum": 1 }
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"type": "object",
|
|
78
|
+
"required": ["kind", "file", "line"],
|
|
79
|
+
"additionalProperties": false,
|
|
80
|
+
"properties": {
|
|
81
|
+
"kind": { "enum": ["personal"] },
|
|
82
|
+
"file": { "type": "string" },
|
|
83
|
+
"line": { "type": "integer", "minimum": 1 }
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"type": "object",
|
|
88
|
+
"required": ["kind", "file", "line", "repo"],
|
|
89
|
+
"additionalProperties": false,
|
|
90
|
+
"properties": {
|
|
91
|
+
"kind": { "enum": ["repo"] },
|
|
92
|
+
"file": { "type": "string" },
|
|
93
|
+
"line": { "type": "integer", "minimum": 1 },
|
|
94
|
+
"repo": { "type": "string" }
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"type": "object",
|
|
99
|
+
"required": ["kind", "variable"],
|
|
100
|
+
"additionalProperties": false,
|
|
101
|
+
"properties": {
|
|
102
|
+
"kind": { "enum": ["environment"] },
|
|
103
|
+
"variable": { "type": "string" }
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
"finding": {
|
|
109
|
+
"type": "object",
|
|
110
|
+
"required": ["file", "line", "problem", "refused"],
|
|
111
|
+
"additionalProperties": false,
|
|
112
|
+
"properties": {
|
|
113
|
+
"file": { "type": "string" },
|
|
114
|
+
"line": { "type": "integer", "minimum": 0 },
|
|
115
|
+
"key": { "type": "string" },
|
|
116
|
+
"problem": { "type": "string" },
|
|
117
|
+
"refused": { "type": "boolean" }
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "config-yml.schema.json",
|
|
4
|
+
"$comment": "The personal settings file config.yml, schema version 1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["schema"],
|
|
7
|
+
"$defs": {
|
|
8
|
+
"editor": { "type": "string" },
|
|
9
|
+
"load": {
|
|
10
|
+
"type": "object",
|
|
11
|
+
"properties": { "budget": { "type": "integer", "minimum": 1 } },
|
|
12
|
+
"additionalProperties": false
|
|
13
|
+
},
|
|
14
|
+
"words": { "type": "array", "items": { "type": "string" } },
|
|
15
|
+
"repoOverride": {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"properties": {
|
|
18
|
+
"editor": { "$ref": "#/$defs/editor" },
|
|
19
|
+
"load": { "$ref": "#/$defs/load" },
|
|
20
|
+
"personProcesses": { "$ref": "#/$defs/words" },
|
|
21
|
+
"forbiddenWords": { "$ref": "#/$defs/words" },
|
|
22
|
+
"consumerNames": { "$ref": "#/$defs/words" }
|
|
23
|
+
},
|
|
24
|
+
"additionalProperties": false
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"properties": {
|
|
28
|
+
"schema": { "const": 1 },
|
|
29
|
+
"editor": { "$ref": "#/$defs/editor" },
|
|
30
|
+
"load": { "$ref": "#/$defs/load" },
|
|
31
|
+
"personProcesses": { "$ref": "#/$defs/words" },
|
|
32
|
+
"forbiddenWords": { "$ref": "#/$defs/words" },
|
|
33
|
+
"consumerNames": { "$ref": "#/$defs/words" },
|
|
34
|
+
"corpora": {
|
|
35
|
+
"type": "object",
|
|
36
|
+
"additionalProperties": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"required": ["xsd"],
|
|
39
|
+
"properties": {
|
|
40
|
+
"xsd": { "type": "string" },
|
|
41
|
+
"instances": { "type": "string" }
|
|
42
|
+
},
|
|
43
|
+
"additionalProperties": false
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"repos": {
|
|
47
|
+
"type": "object",
|
|
48
|
+
"additionalProperties": { "$ref": "#/$defs/repoOverride" }
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"additionalProperties": false
|
|
52
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "dialecterc.schema.json",
|
|
4
|
+
"$comment": "The project settings file .dialecterc, schema version 1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["schema"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"schema": { "const": 1 },
|
|
9
|
+
"profile": { "type": "string" },
|
|
10
|
+
"baseBranch": { "type": "string" },
|
|
11
|
+
"gate": { "type": "object" },
|
|
12
|
+
"contrib": { "type": "object" },
|
|
13
|
+
"tdd": { "type": "object" },
|
|
14
|
+
"references": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"properties": {
|
|
17
|
+
"allow": { "type": "array", "items": { "type": "string" } },
|
|
18
|
+
"patterns": { "type": "array", "items": { "type": "string" } }
|
|
19
|
+
},
|
|
20
|
+
"additionalProperties": false
|
|
21
|
+
},
|
|
22
|
+
"mutation": { "type": "object" },
|
|
23
|
+
"generatedDocs": { "type": "array", "items": { "type": "string" } },
|
|
24
|
+
"risk": { "type": "object" },
|
|
25
|
+
"rebuiltIgnored": { "type": "array", "items": { "type": "string" } },
|
|
26
|
+
"tsconfig": { "type": "string" },
|
|
27
|
+
"namespace": { "type": "string" },
|
|
28
|
+
"entry": { "type": "string" },
|
|
29
|
+
"constantsDir": { "type": "string" },
|
|
30
|
+
"out": { "type": "string" }
|
|
31
|
+
},
|
|
32
|
+
"additionalProperties": false
|
|
33
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "lot-risk.schema.json",
|
|
4
|
+
"$comment": "Output of `dialecte lot risk <id|folder> --json`, schema version 1.",
|
|
5
|
+
"title": "The answer of lot risk --json",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["class", "reasons", "effort", "below", "cap"],
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"properties": {
|
|
10
|
+
"class": { "oneOf": [{ "$ref": "#/$defs/class" }, { "type": "null" }] },
|
|
11
|
+
"reasons": { "type": "array", "items": { "$ref": "#/$defs/reason" } },
|
|
12
|
+
"effort": { "oneOf": [{ "enum": ["low", "medium", "high"] }, { "type": "null" }] },
|
|
13
|
+
"below": { "type": "boolean" },
|
|
14
|
+
"cap": { "type": "integer", "minimum": 1 }
|
|
15
|
+
},
|
|
16
|
+
"$defs": {
|
|
17
|
+
"class": { "enum": ["light", "medium", "high"] },
|
|
18
|
+
"reason": {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"required": ["kind", "detail"],
|
|
21
|
+
"additionalProperties": false,
|
|
22
|
+
"properties": {
|
|
23
|
+
"kind": {
|
|
24
|
+
"enum": ["declared", "destructive", "api", "broad-scope", "size", "docs", "more"]
|
|
25
|
+
},
|
|
26
|
+
"file": { "type": "string" },
|
|
27
|
+
"line": { "type": "integer" },
|
|
28
|
+
"detail": { "type": "string" }
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "risk-line.schema.json",
|
|
4
|
+
"title": "A line of risk.jsonl",
|
|
5
|
+
"oneOf": [{ "$ref": "#/$defs/effortLine" }, { "$ref": "#/$defs/derivedLine" }],
|
|
6
|
+
"$defs": {
|
|
7
|
+
"class": { "enum": ["light", "medium", "high"] },
|
|
8
|
+
"reason": {
|
|
9
|
+
"type": "object",
|
|
10
|
+
"required": ["kind", "detail"],
|
|
11
|
+
"additionalProperties": false,
|
|
12
|
+
"properties": {
|
|
13
|
+
"kind": {
|
|
14
|
+
"enum": ["declared", "destructive", "api", "broad-scope", "size", "docs", "more"]
|
|
15
|
+
},
|
|
16
|
+
"file": { "type": "string" },
|
|
17
|
+
"line": { "type": "integer" },
|
|
18
|
+
"detail": { "type": "string" }
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"effortLine": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"required": ["schema", "kind", "at", "effort", "by"],
|
|
24
|
+
"additionalProperties": false,
|
|
25
|
+
"properties": {
|
|
26
|
+
"schema": { "const": 1 },
|
|
27
|
+
"kind": { "const": "effort" },
|
|
28
|
+
"at": { "type": "string" },
|
|
29
|
+
"effort": { "enum": ["low", "medium", "high"] },
|
|
30
|
+
"class": { "$ref": "#/$defs/class" },
|
|
31
|
+
"by": { "type": "string" },
|
|
32
|
+
"reason": { "type": "string" }
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"derivedLine": {
|
|
36
|
+
"type": "object",
|
|
37
|
+
"required": ["schema", "kind", "at", "class", "reasons", "from"],
|
|
38
|
+
"additionalProperties": false,
|
|
39
|
+
"properties": {
|
|
40
|
+
"schema": { "const": 1 },
|
|
41
|
+
"kind": { "const": "derived" },
|
|
42
|
+
"at": { "type": "string" },
|
|
43
|
+
"class": { "$ref": "#/$defs/class" },
|
|
44
|
+
"reasons": { "type": "array", "items": { "$ref": "#/$defs/reason" } },
|
|
45
|
+
"from": { "enum": ["start", "snapshot", "handover-write"] }
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "rules.schema.json",
|
|
4
|
+
"$comment": "Output of `dialecte rules [<files...>] --json`, schema version 1.",
|
|
5
|
+
"title": "The answer of rules --json",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["files", "errors", "warnings", "findings"],
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"properties": {
|
|
10
|
+
"files": { "type": "array", "items": { "type": "string" } },
|
|
11
|
+
"errors": { "type": "integer", "minimum": 0 },
|
|
12
|
+
"warnings": { "type": "integer", "minimum": 0 },
|
|
13
|
+
"findings": { "type": "array", "items": { "$ref": "#/$defs/finding" } },
|
|
14
|
+
"allowed": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"additionalProperties": { "type": "integer", "minimum": 1 }
|
|
17
|
+
},
|
|
18
|
+
"noForbiddenWordsList": { "type": "string" },
|
|
19
|
+
"queryInLoopNotRun": { "type": "string" },
|
|
20
|
+
"dialecteChanges": { "type": "array", "items": { "$ref": "#/$defs/dialecteChange" } },
|
|
21
|
+
"notJudged": { "type": "integer", "minimum": 1 },
|
|
22
|
+
"baseLine": { "type": "string" }
|
|
23
|
+
},
|
|
24
|
+
"$defs": {
|
|
25
|
+
"finding": {
|
|
26
|
+
"type": "object",
|
|
27
|
+
"required": ["file", "line", "column", "rule", "severity", "message"],
|
|
28
|
+
"additionalProperties": false,
|
|
29
|
+
"properties": {
|
|
30
|
+
"file": { "type": "string" },
|
|
31
|
+
"line": { "type": "integer", "minimum": 1 },
|
|
32
|
+
"column": { "type": "integer", "minimum": 1 },
|
|
33
|
+
"rule": { "type": "string" },
|
|
34
|
+
"severity": { "enum": ["error", "warning"] },
|
|
35
|
+
"message": { "type": "string" }
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"dialecteChange": {
|
|
39
|
+
"type": "object",
|
|
40
|
+
"required": ["file", "dialecteChange", "rule"],
|
|
41
|
+
"additionalProperties": false,
|
|
42
|
+
"properties": {
|
|
43
|
+
"file": { "type": "string" },
|
|
44
|
+
"dialecteChange": { "type": "boolean" },
|
|
45
|
+
"rule": {
|
|
46
|
+
"enum": ["package-source", "template", "import", "own-import", "cli", "file-kind", "none"]
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "scope-change.schema.json",
|
|
4
|
+
"title": "A line of scope-changes.jsonl",
|
|
5
|
+
"oneOf": [
|
|
6
|
+
{
|
|
7
|
+
"$ref": "#/$defs/dropLine"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"$ref": "#/$defs/addLine"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"$ref": "#/$defs/undoLine"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"$defs": {
|
|
17
|
+
"dropLine": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"required": ["schema", "at", "op", "paths"],
|
|
20
|
+
"additionalProperties": false,
|
|
21
|
+
"properties": {
|
|
22
|
+
"schema": {
|
|
23
|
+
"const": 1
|
|
24
|
+
},
|
|
25
|
+
"at": {
|
|
26
|
+
"type": "string"
|
|
27
|
+
},
|
|
28
|
+
"op": {
|
|
29
|
+
"const": "drop"
|
|
30
|
+
},
|
|
31
|
+
"paths": {
|
|
32
|
+
"type": "array",
|
|
33
|
+
"items": {
|
|
34
|
+
"type": "string"
|
|
35
|
+
},
|
|
36
|
+
"minItems": 1
|
|
37
|
+
},
|
|
38
|
+
"by": {
|
|
39
|
+
"type": "string"
|
|
40
|
+
},
|
|
41
|
+
"reason": {
|
|
42
|
+
"type": "string"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"dependentRequired": {
|
|
46
|
+
"by": ["reason"],
|
|
47
|
+
"reason": ["by"]
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"addLine": {
|
|
51
|
+
"type": "object",
|
|
52
|
+
"required": ["schema", "at", "op", "paths", "by", "reason"],
|
|
53
|
+
"additionalProperties": false,
|
|
54
|
+
"properties": {
|
|
55
|
+
"schema": {
|
|
56
|
+
"const": 1
|
|
57
|
+
},
|
|
58
|
+
"at": {
|
|
59
|
+
"type": "string"
|
|
60
|
+
},
|
|
61
|
+
"op": {
|
|
62
|
+
"const": "add"
|
|
63
|
+
},
|
|
64
|
+
"paths": {
|
|
65
|
+
"type": "array",
|
|
66
|
+
"items": {
|
|
67
|
+
"type": "string"
|
|
68
|
+
},
|
|
69
|
+
"minItems": 1
|
|
70
|
+
},
|
|
71
|
+
"by": {
|
|
72
|
+
"type": "string"
|
|
73
|
+
},
|
|
74
|
+
"reason": {
|
|
75
|
+
"type": "string"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"undoLine": {
|
|
80
|
+
"type": "object",
|
|
81
|
+
"required": ["schema", "at", "op", "paths"],
|
|
82
|
+
"additionalProperties": false,
|
|
83
|
+
"properties": {
|
|
84
|
+
"schema": {
|
|
85
|
+
"const": 1
|
|
86
|
+
},
|
|
87
|
+
"at": {
|
|
88
|
+
"type": "string"
|
|
89
|
+
},
|
|
90
|
+
"op": {
|
|
91
|
+
"const": "undo"
|
|
92
|
+
},
|
|
93
|
+
"paths": {
|
|
94
|
+
"type": "array",
|
|
95
|
+
"items": {
|
|
96
|
+
"type": "string"
|
|
97
|
+
},
|
|
98
|
+
"minItems": 1
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|