type-rename-move 0.0.1 → 0.14.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/LICENSE +21 -0
- package/README.md +15 -0
- package/dist/bin/trmv-compliance.js +4 -0
- package/dist/bin/trmv-config.js +4 -0
- package/dist/bin/trmv-doctor.js +4 -0
- package/dist/bin/trmv-mock-lint.js +4 -0
- package/dist/bin/trmv-refactor.js +4 -0
- package/dist/bin/trmv-typecheck.js +4 -0
- package/dist/changes/index.d.ts +24 -0
- package/dist/changes/index.js +112 -0
- package/dist/cli/index.d.ts +4 -0
- package/dist/cli/index.js +36 -0
- package/dist/config/command.d.ts +20 -0
- package/dist/config/command.js +68 -0
- package/dist/config/error.d.ts +3 -0
- package/dist/config/error.js +4 -0
- package/dist/config/files.d.ts +6 -0
- package/dist/config/files.js +29 -0
- package/dist/config/format.d.ts +25 -0
- package/dist/config/format.js +172 -0
- package/dist/config/index.d.ts +73 -0
- package/dist/config/index.js +239 -0
- package/dist/config/read.d.ts +4 -0
- package/dist/config/read.js +37 -0
- package/dist/contract/data/CONTRACT_HASH +1 -0
- package/dist/contract/data/README.md +69 -0
- package/dist/contract/data/cli.yaml +239 -0
- package/dist/contract/data/config.yaml +8 -0
- package/dist/contract/data/findings.yaml +212 -0
- package/dist/contract/data/languages.yaml +146 -0
- package/dist/contract/data/regex-subset.md +28 -0
- package/dist/contract/data/schema/rename-map.schema.json +51 -0
- package/dist/contract/data/schema/trmv.schema.json +92 -0
- package/dist/contract/data/schema/word-table.schema.json +55 -0
- package/dist/contract/data/vectors/cli.yaml +216 -0
- package/dist/contract/data/vectors/command-split.yaml +69 -0
- package/dist/contract/data/vectors/diff.yaml +287 -0
- package/dist/contract/data/vectors/format.yaml +160 -0
- package/dist/contract/data/vectors/glob.yaml +148 -0
- package/dist/contract/data/vectors/materialize.yaml +51 -0
- package/dist/contract/data/vectors/os-errors.yaml +123 -0
- package/dist/contract/data/vectors/refactor-symbols.yaml +220 -0
- package/dist/contract/data/vectors/refactor-text.yaml +186 -0
- package/dist/contract/data/vectors/refactor-words.yaml +83 -0
- package/dist/contract/data/vectors/regex-subset.yaml +40 -0
- package/dist/contract/data/vectors/repr.yaml +118 -0
- package/dist/contract/data/vectors/skill-leaks.yaml +6 -0
- package/dist/contract/data/vectors/test-files.yaml +135 -0
- package/dist/contract/data/vectors/yaml.yaml +858 -0
- package/dist/contract/glob.d.ts +3 -0
- package/dist/contract/glob.js +49 -0
- package/dist/contract/index.d.ts +13 -0
- package/dist/contract/index.js +14 -0
- package/dist/contract/json.d.ts +1 -0
- package/dist/contract/json.js +43 -0
- package/dist/contract/os-error.d.ts +13 -0
- package/dist/contract/os-error.js +66 -0
- package/dist/contract/parser.d.ts +18 -0
- package/dist/contract/parser.js +207 -0
- package/dist/contract/plugin.d.ts +5 -0
- package/dist/contract/plugin.js +90 -0
- package/dist/contract/regex.d.ts +5 -0
- package/dist/contract/regex.js +116 -0
- package/dist/contract/render.d.ts +3 -0
- package/dist/contract/render.js +19 -0
- package/dist/contract/schema.d.ts +10 -0
- package/dist/contract/schema.js +139 -0
- package/dist/contract/snapshot.d.ts +47 -0
- package/dist/contract/snapshot.js +129 -0
- package/dist/contract/text.d.ts +14 -0
- package/dist/contract/text.js +56 -0
- package/dist/contract/values.d.ts +24 -0
- package/dist/contract/values.js +127 -0
- package/dist/contract/which.d.ts +4 -0
- package/dist/contract/which.js +27 -0
- package/dist/contract/yaml.d.ts +11 -0
- package/dist/contract/yaml.js +595 -0
- package/dist/doctor/index.d.ts +3 -0
- package/dist/doctor/index.js +69 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -0
- package/dist/lang/conventions.d.ts +33 -0
- package/dist/lang/conventions.js +216 -0
- package/dist/lang/edges.d.ts +2 -0
- package/dist/lang/edges.js +142 -0
- package/dist/lang/files.d.ts +28 -0
- package/dist/lang/files.js +122 -0
- package/dist/lang/imports.d.ts +3 -0
- package/dist/lang/imports.js +64 -0
- package/dist/lang/index.d.ts +13 -0
- package/dist/lang/index.js +18 -0
- package/dist/lang/lines.d.ts +21 -0
- package/dist/lang/lines.js +96 -0
- package/dist/lang/projects.d.ts +30 -0
- package/dist/lang/projects.js +115 -0
- package/dist/lang/specifiers.d.ts +7 -0
- package/dist/lang/specifiers.js +88 -0
- package/dist/lang/ts.d.ts +2 -0
- package/dist/lang/ts.js +7 -0
- package/dist/lang/tsc.d.ts +32 -0
- package/dist/lang/tsc.js +130 -0
- package/dist/lang/types.d.ts +27 -0
- package/dist/lang/types.js +4 -0
- package/dist/refactor/baseline.d.ts +13 -0
- package/dist/refactor/baseline.js +148 -0
- package/dist/refactor/bindings.d.ts +76 -0
- package/dist/refactor/bindings.js +594 -0
- package/dist/refactor/carve.d.ts +31 -0
- package/dist/refactor/carve.js +145 -0
- package/dist/refactor/compliance.d.ts +15 -0
- package/dist/refactor/compliance.js +161 -0
- package/dist/refactor/compound.d.ts +5 -0
- package/dist/refactor/compound.js +40 -0
- package/dist/refactor/diff.d.ts +2 -0
- package/dist/refactor/diff.js +170 -0
- package/dist/refactor/edits.d.ts +16 -0
- package/dist/refactor/edits.js +34 -0
- package/dist/refactor/generate.d.ts +4 -0
- package/dist/refactor/generate.js +209 -0
- package/dist/refactor/index.d.ts +11 -0
- package/dist/refactor/index.js +144 -0
- package/dist/refactor/lines.d.ts +13 -0
- package/dist/refactor/lines.js +34 -0
- package/dist/refactor/literal-sources.d.ts +20 -0
- package/dist/refactor/literal-sources.js +243 -0
- package/dist/refactor/map.d.ts +21 -0
- package/dist/refactor/map.js +45 -0
- package/dist/refactor/members.d.ts +68 -0
- package/dist/refactor/members.js +187 -0
- package/dist/refactor/mention-scope.d.ts +19 -0
- package/dist/refactor/mention-scope.js +113 -0
- package/dist/refactor/mentions.d.ts +28 -0
- package/dist/refactor/mentions.js +92 -0
- package/dist/refactor/mocks.d.ts +16 -0
- package/dist/refactor/mocks.js +139 -0
- package/dist/refactor/module-rename.d.ts +17 -0
- package/dist/refactor/module-rename.js +160 -0
- package/dist/refactor/outcomes.d.ts +42 -0
- package/dist/refactor/outcomes.js +61 -0
- package/dist/refactor/own-scope.d.ts +16 -0
- package/dist/refactor/own-scope.js +142 -0
- package/dist/refactor/position.d.ts +34 -0
- package/dist/refactor/position.js +58 -0
- package/dist/refactor/program-check.d.ts +11 -0
- package/dist/refactor/program-check.js +49 -0
- package/dist/refactor/progress.d.ts +27 -0
- package/dist/refactor/progress.js +66 -0
- package/dist/refactor/rename.d.ts +18 -0
- package/dist/refactor/rename.js +1299 -0
- package/dist/refactor/retarget.d.ts +79 -0
- package/dist/refactor/retarget.js +647 -0
- package/dist/refactor/routing.d.ts +19 -0
- package/dist/refactor/routing.js +237 -0
- package/dist/refactor/session.d.ts +81 -0
- package/dist/refactor/session.js +180 -0
- package/dist/refactor/sites.d.ts +62 -0
- package/dist/refactor/sites.js +207 -0
- package/dist/refactor/symbols.d.ts +41 -0
- package/dist/refactor/symbols.js +385 -0
- package/dist/refactor/timings.d.ts +24 -0
- package/dist/refactor/timings.js +79 -0
- package/dist/refactor/typescript.d.ts +5 -0
- package/dist/refactor/typescript.js +279 -0
- package/dist/refactor/words.d.ts +42 -0
- package/dist/refactor/words.js +114 -0
- package/dist/refactor/workspace.d.ts +59 -0
- package/dist/refactor/workspace.js +314 -0
- package/dist/refactor/writer.d.ts +10 -0
- package/dist/refactor/writer.js +110 -0
- package/dist/twin/index.d.ts +50 -0
- package/dist/twin/index.js +180 -0
- package/dist/typecheck/index.d.ts +11 -0
- package/dist/typecheck/index.js +210 -0
- package/package.json +84 -3
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "rename-map.schema.json",
|
|
4
|
+
"title": "trmv-refactor rename-map MAP",
|
|
5
|
+
"description": "A non-empty list of entries, each a file relative to --project, exactly one locator (symbol, line with an optional col, or offset) and exactly one intent (new_name, or retarget: the target's path in the same file). Or a module entry: module (a source file relative to --project; a Python __init__.py names its package) and new_name, nothing else.",
|
|
6
|
+
"type": "array",
|
|
7
|
+
"minItems": 1,
|
|
8
|
+
"items": {"$ref": "#/$defs/entry"},
|
|
9
|
+
"$defs": {
|
|
10
|
+
"entry": {"oneOf": [{"$ref": "#/$defs/located"}, {"$ref": "#/$defs/module"}]},
|
|
11
|
+
"module": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"additionalProperties": false,
|
|
14
|
+
"required": ["module", "new_name"],
|
|
15
|
+
"properties": {
|
|
16
|
+
"module": {"type": "string", "minLength": 1},
|
|
17
|
+
"new_name": {"type": "string"}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"located": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"additionalProperties": false,
|
|
23
|
+
"required": ["file"],
|
|
24
|
+
"properties": {
|
|
25
|
+
"file": {"type": "string", "minLength": 1},
|
|
26
|
+
"symbol": {"type": "string", "minLength": 1},
|
|
27
|
+
"line": {"type": "integer"},
|
|
28
|
+
"col": {"type": "integer"},
|
|
29
|
+
"offset": {"type": "integer"},
|
|
30
|
+
"new_name": {"type": "string"},
|
|
31
|
+
"retarget": {"type": "string", "minLength": 1}
|
|
32
|
+
},
|
|
33
|
+
"dependentRequired": {"col": ["line"]},
|
|
34
|
+
"allOf": [
|
|
35
|
+
{
|
|
36
|
+
"oneOf": [
|
|
37
|
+
{"required": ["symbol"], "not": {"anyOf": [{"required": ["line"]}, {"required": ["offset"]}]}},
|
|
38
|
+
{"required": ["line"], "not": {"anyOf": [{"required": ["symbol"]}, {"required": ["offset"]}]}},
|
|
39
|
+
{"required": ["offset"], "not": {"anyOf": [{"required": ["symbol"]}, {"required": ["line"]}]}}
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"oneOf": [
|
|
44
|
+
{"required": ["new_name"], "not": {"required": ["retarget"]}},
|
|
45
|
+
{"required": ["retarget"], "not": {"required": ["new_name"]}}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "trmv.schema.json",
|
|
4
|
+
"title": "trmv.yaml",
|
|
5
|
+
"description": "trmv's config keys at the repo root, in trmv.yaml or, in a repo using la, in living-architecture.yaml. Every key is optional in the schema; absent keys take their defaults, and the format check requires format.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"properties": {
|
|
9
|
+
"format": {
|
|
10
|
+
"type": [
|
|
11
|
+
"string",
|
|
12
|
+
"null"
|
|
13
|
+
],
|
|
14
|
+
"pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$",
|
|
15
|
+
"default": null,
|
|
16
|
+
"description": "The file's format: the release that introduced it. Every command but the exempt ones refuses any other format."
|
|
17
|
+
},
|
|
18
|
+
"exempt": {
|
|
19
|
+
"type": "array",
|
|
20
|
+
"items": {
|
|
21
|
+
"type": "string"
|
|
22
|
+
},
|
|
23
|
+
"default": [],
|
|
24
|
+
"description": "Repo-relative fnmatch globs naming paths that are not the repo's own source (fixtures, generated code): language detection leaves them out and the conventions gate exempts them."
|
|
25
|
+
},
|
|
26
|
+
"commands": {
|
|
27
|
+
"type": "object",
|
|
28
|
+
"additionalProperties": false,
|
|
29
|
+
"properties": {
|
|
30
|
+
"test": {
|
|
31
|
+
"type": [
|
|
32
|
+
"string",
|
|
33
|
+
"null"
|
|
34
|
+
],
|
|
35
|
+
"default": null,
|
|
36
|
+
"description": "The repo's full non-integration test command."
|
|
37
|
+
},
|
|
38
|
+
"typecheck": {
|
|
39
|
+
"type": "object",
|
|
40
|
+
"additionalProperties": false,
|
|
41
|
+
"description": "trmv-typecheck's checker per language, run without a shell from the repo root; null turns the language off. Setting a language forces it on.",
|
|
42
|
+
"properties": {
|
|
43
|
+
"python": {
|
|
44
|
+
"type": [
|
|
45
|
+
"string",
|
|
46
|
+
"null"
|
|
47
|
+
],
|
|
48
|
+
"default": "basedpyright",
|
|
49
|
+
"description": "A basedpyright-compatible command: it must accept --writebaseline and keep its baseline at .basedpyright/baseline.json. It must run a verified basedpyright (languages.yaml checker_patch_versions) under Node and keep NODE_OPTIONS, so la can apply the pyright#11919 patch."
|
|
50
|
+
},
|
|
51
|
+
"typescript": {
|
|
52
|
+
"type": [
|
|
53
|
+
"string",
|
|
54
|
+
"null"
|
|
55
|
+
],
|
|
56
|
+
"default": "tsc --noEmit",
|
|
57
|
+
"description": "A tsc-compatible command; --pretty false is appended."
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"refactor": {
|
|
64
|
+
"type": "object",
|
|
65
|
+
"additionalProperties": false,
|
|
66
|
+
"properties": {
|
|
67
|
+
"python": {
|
|
68
|
+
"type": "object",
|
|
69
|
+
"additionalProperties": false,
|
|
70
|
+
"properties": {
|
|
71
|
+
"moved_module_stub": {
|
|
72
|
+
"type": [
|
|
73
|
+
"string",
|
|
74
|
+
"null"
|
|
75
|
+
],
|
|
76
|
+
"default": null,
|
|
77
|
+
"description": "The text `trmv-refactor rename --stub REMOVAL` leaves at a renamed Python module's old path; {old} and {new} (dotted module names) and {removal} are replaced."
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"string_forms": {
|
|
82
|
+
"type": "array",
|
|
83
|
+
"items": {
|
|
84
|
+
"type": "string"
|
|
85
|
+
},
|
|
86
|
+
"default": [],
|
|
87
|
+
"description": "Patterns for strings that carry a symbol's name (a mini-language such as Cypher): `trmv-refactor` respells the one capturing group's text when a class or another module-level symbol of that name is renamed. Each pattern uses the portable regex subset and holds exactly one capturing group."
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "word-table.schema.json",
|
|
4
|
+
"title": "trmv-refactor word table",
|
|
5
|
+
"description": "A vocabulary rename: words (each from becomes its to wherever a name holds it as a word), carve_outs (where a word keeps its old sense: by a written annotation naming an identifier, by the declaring file's path, or by symbol) and entries (hand-written rename-map entries, kept on every regeneration). The loader also refuses a from given twice, a from equal to its to, and a carve-out word that is no from.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["words"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"words": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/row"}},
|
|
11
|
+
"carve_outs": {"type": "array", "items": {"$ref": "#/$defs/carve_out"}},
|
|
12
|
+
"entries": {"type": "array", "items": {"$ref": "rename-map.schema.json#/$defs/entry"}}
|
|
13
|
+
},
|
|
14
|
+
"$defs": {
|
|
15
|
+
"word": {"type": "string", "pattern": "^[a-z][a-z0-9]*$"},
|
|
16
|
+
"row": {
|
|
17
|
+
"type": "object",
|
|
18
|
+
"additionalProperties": false,
|
|
19
|
+
"required": ["from", "to"],
|
|
20
|
+
"properties": {"from": {"$ref": "#/$defs/word"}, "to": {"$ref": "#/$defs/word"}}
|
|
21
|
+
},
|
|
22
|
+
"carve_out": {
|
|
23
|
+
"type": "object",
|
|
24
|
+
"additionalProperties": false,
|
|
25
|
+
"required": ["words"],
|
|
26
|
+
"properties": {
|
|
27
|
+
"words": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/word"}},
|
|
28
|
+
"annotated": {
|
|
29
|
+
"type": "array",
|
|
30
|
+
"minItems": 1,
|
|
31
|
+
"items": {"type": "string", "pattern": "^(?![0-9])[^\\s!-#%-/:-@\\[-^`{-~]+$"}
|
|
32
|
+
},
|
|
33
|
+
"paths": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}},
|
|
34
|
+
"symbols": {
|
|
35
|
+
"type": "array",
|
|
36
|
+
"minItems": 1,
|
|
37
|
+
"items": {
|
|
38
|
+
"type": "object",
|
|
39
|
+
"additionalProperties": false,
|
|
40
|
+
"required": ["file", "symbol"],
|
|
41
|
+
"properties": {
|
|
42
|
+
"file": {"type": "string", "minLength": 1},
|
|
43
|
+
"symbol": {"type": "string", "minLength": 1}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"oneOf": [
|
|
49
|
+
{"required": ["annotated"], "not": {"anyOf": [{"required": ["paths"]}, {"required": ["symbols"]}]}},
|
|
50
|
+
{"required": ["paths"], "not": {"anyOf": [{"required": ["annotated"]}, {"required": ["symbols"]}]}},
|
|
51
|
+
{"required": ["symbols"], "not": {"anyOf": [{"required": ["annotated"]}, {"required": ["paths"]}]}}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# Manifest parser vectors: `argv` given to `command` either parses to `args` (every dest, defaults included, plus
|
|
2
|
+
# `subcommand` for a command with subcommands; a passthrough command's handler receives `{argv: [...]}` verbatim)
|
|
3
|
+
# or is a usage error (`exit: 2`). Parser error wording and --help text are not pinned.
|
|
4
|
+
cases:
|
|
5
|
+
- name: rename with defaults
|
|
6
|
+
command: trmv-refactor
|
|
7
|
+
argv: [rename, --file, a.py, --symbol, f, --new-name, g]
|
|
8
|
+
args: {project: ., apply: false, timings: false, subcommand: rename, file: a.py, offset: null, line: null, col: null, symbol: f, new_name: g,
|
|
9
|
+
in_hierarchy: true, unsure: skip, allow_blindspots: false, with_stand_ins: [], without_stand_ins: [], keep: [],
|
|
10
|
+
docs: false, docs_pick: [], keep_literal: [], words: null, fail_fast: false, stub: null}
|
|
11
|
+
- name: store-false flag and choice
|
|
12
|
+
command: trmv-refactor
|
|
13
|
+
argv: [--apply, --project, p, rename, --file, a.py, --line, '3', --col, '7', --new-name, g, --no-in-hierarchy, --unsure,
|
|
14
|
+
include]
|
|
15
|
+
args: {project: p, apply: true, timings: false, subcommand: rename, file: a.py, offset: null, line: 3, col: 7, symbol: null, new_name: g,
|
|
16
|
+
in_hierarchy: false, unsure: include, allow_blindspots: false, with_stand_ins: [], without_stand_ins: [], keep: [],
|
|
17
|
+
docs: false, docs_pick: [], keep_literal: [], words: null, fail_fast: false, stub: null}
|
|
18
|
+
- name: rename guard options repeat and keep order
|
|
19
|
+
command: trmv-refactor
|
|
20
|
+
argv: [rename, --file, a.py, --symbol, f, --new-name, g, --with, b.py:3, --without, c.py:7, --with, d.py:1, --keep,
|
|
21
|
+
tests/compat, --keep, e.py:12, --allow-blindspots, --docs]
|
|
22
|
+
args: {project: ., apply: false, timings: false, subcommand: rename, file: a.py, offset: null, line: null, col: null, symbol: f, new_name: g,
|
|
23
|
+
in_hierarchy: true, unsure: skip, allow_blindspots: true, with_stand_ins: [b.py:3, d.py:1], without_stand_ins: [c.py:7],
|
|
24
|
+
keep: [tests/compat, e.py:12], docs: true, docs_pick: [], keep_literal: [], words: null, fail_fast: false, stub: null}
|
|
25
|
+
- name: timings flag before the subcommand
|
|
26
|
+
command: trmv-refactor
|
|
27
|
+
argv: [--timings, rename-map, map.yaml]
|
|
28
|
+
args: {project: ., apply: false, timings: true, subcommand: rename-map, map: map.yaml, in_hierarchy: true, unsure: skip,
|
|
29
|
+
allow_blindspots: false, with_stand_ins: [], without_stand_ins: [], keep: [], docs: false, docs_pick: [], keep_literal: [], words: null, fail_fast: false, stub: null}
|
|
30
|
+
- name: timings flag after the subcommand rejected
|
|
31
|
+
command: trmv-refactor
|
|
32
|
+
argv: [rename-map, map.yaml, --timings]
|
|
33
|
+
exit: 2
|
|
34
|
+
- name: rename guard option needs a value
|
|
35
|
+
command: trmv-refactor
|
|
36
|
+
argv: [rename, --file, a.py, --symbol, f, --new-name, g, --keep]
|
|
37
|
+
exit: 2
|
|
38
|
+
- name: rename guard flag takes no value
|
|
39
|
+
command: trmv-refactor
|
|
40
|
+
argv: [rename, --file, a.py, --symbol, f, --new-name, g, --docs=yes]
|
|
41
|
+
exit: 2
|
|
42
|
+
- name: choice rejected
|
|
43
|
+
command: trmv-refactor
|
|
44
|
+
argv: [rename, --file, a.py, --new-name, g, --unsure, maybe]
|
|
45
|
+
exit: 2
|
|
46
|
+
- name: int option
|
|
47
|
+
command: trmv-refactor
|
|
48
|
+
argv: [rename, --file, a.py, --offset, '-5', --new-name, g]
|
|
49
|
+
args: {project: ., apply: false, timings: false, subcommand: rename, file: a.py, offset: -5, line: null, col: null, symbol: null, new_name: g,
|
|
50
|
+
in_hierarchy: true, unsure: skip, allow_blindspots: false, with_stand_ins: [], without_stand_ins: [], keep: [],
|
|
51
|
+
docs: false, docs_pick: [], keep_literal: [], words: null, fail_fast: false, stub: null}
|
|
52
|
+
- name: int option type error
|
|
53
|
+
command: trmv-refactor
|
|
54
|
+
argv: [rename, --file, a.py, --offset, '1.5', --new-name, g]
|
|
55
|
+
exit: 2
|
|
56
|
+
- name: required option missing
|
|
57
|
+
command: trmv-refactor
|
|
58
|
+
argv: [rename, --file, a.py]
|
|
59
|
+
exit: 2
|
|
60
|
+
- name: move-symbol
|
|
61
|
+
command: trmv-refactor
|
|
62
|
+
argv: [move-symbol, --file, a.py, --symbol, f, --dest, b.py]
|
|
63
|
+
args: {project: ., apply: false, timings: false, subcommand: move-symbol, file: a.py, offset: null, line: null, col: null, symbol: f, dest: b.py}
|
|
64
|
+
- name: removed --name rejected
|
|
65
|
+
command: trmv-refactor
|
|
66
|
+
argv: [rename, --file, a.py, --name, f, --new-name, g]
|
|
67
|
+
exit: 2
|
|
68
|
+
- name: symbol and line are exclusive
|
|
69
|
+
command: trmv-refactor
|
|
70
|
+
argv: [rename, --file, a.py, --line, '1', --symbol, foo, --new-name, bar]
|
|
71
|
+
exit: 2
|
|
72
|
+
- name: offset and line are exclusive
|
|
73
|
+
command: trmv-refactor
|
|
74
|
+
argv: [rename, --file, a.py, --offset, '0', --line, '1', --new-name, bar]
|
|
75
|
+
exit: 2
|
|
76
|
+
- name: exclusive options rejected in move-symbol
|
|
77
|
+
command: trmv-refactor
|
|
78
|
+
argv: [move-symbol, --file, a.py, --offset, '0', --symbol, f, --dest, b.py]
|
|
79
|
+
exit: 2
|
|
80
|
+
- name: one locator of a group is accepted with --col
|
|
81
|
+
command: trmv-refactor
|
|
82
|
+
argv: [move-symbol, --file, a.py, --line, '2', --col, '5', --dest, b.py]
|
|
83
|
+
args: {project: ., apply: false, timings: false, subcommand: move-symbol, file: a.py, offset: null, line: 2, col: 5, symbol: null, dest: b.py}
|
|
84
|
+
- name: rename-map with defaults
|
|
85
|
+
command: trmv-refactor
|
|
86
|
+
argv: [rename-map, map.yaml]
|
|
87
|
+
args: {project: ., apply: false, timings: false, subcommand: rename-map, map: map.yaml, in_hierarchy: true, unsure: skip,
|
|
88
|
+
allow_blindspots: false, with_stand_ins: [], without_stand_ins: [], keep: [], docs: false, docs_pick: [], keep_literal: [], words: null, fail_fast: false, stub: null}
|
|
89
|
+
- name: rename-map options apply to every entry
|
|
90
|
+
command: trmv-refactor
|
|
91
|
+
argv: [--apply, rename-map, maps/m.yaml, --no-in-hierarchy, --keep, tests/compat, --with, b.py:3, --docs,
|
|
92
|
+
--allow-blindspots, --fail-fast]
|
|
93
|
+
args: {project: ., apply: true, timings: false, subcommand: rename-map, map: maps/m.yaml, in_hierarchy: false, unsure: skip,
|
|
94
|
+
allow_blindspots: true, with_stand_ins: [b.py:3], without_stand_ins: [], keep: [tests/compat], docs: true, docs_pick: [], keep_literal: [], words: null,
|
|
95
|
+
fail_fast: true, stub: null}
|
|
96
|
+
- name: rename-map takes no locator
|
|
97
|
+
command: trmv-refactor
|
|
98
|
+
argv: [rename-map, map.yaml, --symbol, f]
|
|
99
|
+
exit: 2
|
|
100
|
+
- name: rename-map takes no new name
|
|
101
|
+
command: trmv-refactor
|
|
102
|
+
argv: [rename-map, map.yaml, --new-name, g]
|
|
103
|
+
exit: 2
|
|
104
|
+
- name: rename-map needs the map
|
|
105
|
+
command: trmv-refactor
|
|
106
|
+
argv: [rename-map]
|
|
107
|
+
exit: 2
|
|
108
|
+
- name: retarget
|
|
109
|
+
command: trmv-refactor
|
|
110
|
+
argv: [retarget, --file, a.py, --symbol, Engine.save, --target, Engine.save_model, --keep, tests/compat, --docs]
|
|
111
|
+
args: {project: ., apply: false, timings: false, subcommand: retarget, file: a.py, offset: null, line: null, col: null,
|
|
112
|
+
symbol: Engine.save, target: Engine.save_model, allow_blindspots: false, with_stand_ins: [], without_stand_ins: [],
|
|
113
|
+
keep: [tests/compat], docs: true, words: null, fail_fast: false}
|
|
114
|
+
- name: a word table on rename
|
|
115
|
+
command: trmv-refactor
|
|
116
|
+
argv: [rename, --file, a.py, --symbol, f, --new-name, g, --docs, --words, words.yaml]
|
|
117
|
+
args: {project: ., apply: false, timings: false, subcommand: rename, file: a.py, offset: null, line: null, col: null, symbol: f, new_name: g,
|
|
118
|
+
in_hierarchy: true, unsure: skip, allow_blindspots: false, with_stand_ins: [], without_stand_ins: [], keep: [],
|
|
119
|
+
docs: true, docs_pick: [], keep_literal: [], words: words.yaml, fail_fast: false, stub: null}
|
|
120
|
+
- name: a word table on rename-map
|
|
121
|
+
command: trmv-refactor
|
|
122
|
+
argv: [rename-map, map.yaml, --words, tables/words.yaml]
|
|
123
|
+
args: {project: ., apply: false, timings: false, subcommand: rename-map, map: map.yaml, in_hierarchy: true, unsure: skip,
|
|
124
|
+
allow_blindspots: false, with_stand_ins: [], without_stand_ins: [], keep: [], docs: false, docs_pick: [], keep_literal: [],
|
|
125
|
+
words: tables/words.yaml, fail_fast: false, stub: null}
|
|
126
|
+
- name: a word table on retarget
|
|
127
|
+
command: trmv-refactor
|
|
128
|
+
argv: [retarget, --file, a.py, --symbol, Old, --target, New, --words, words.yaml]
|
|
129
|
+
args: {project: ., apply: false, timings: false, subcommand: retarget, file: a.py, offset: null, line: null, col: null,
|
|
130
|
+
symbol: Old, target: New, allow_blindspots: false, with_stand_ins: [], without_stand_ins: [], keep: [], docs: false,
|
|
131
|
+
words: words.yaml, fail_fast: false}
|
|
132
|
+
- name: a word table needs a value
|
|
133
|
+
command: trmv-refactor
|
|
134
|
+
argv: [rename-map, map.yaml, --words]
|
|
135
|
+
exit: 2
|
|
136
|
+
- name: move-symbol takes no word table
|
|
137
|
+
command: trmv-refactor
|
|
138
|
+
argv: [move-symbol, --file, a.py, --symbol, f, --dest, b.py, --words, words.yaml]
|
|
139
|
+
exit: 2
|
|
140
|
+
- name: generate-map
|
|
141
|
+
command: trmv-refactor
|
|
142
|
+
argv: [generate-map, words.yaml]
|
|
143
|
+
args: {project: ., apply: false, timings: false, subcommand: generate-map, table: words.yaml, language: null}
|
|
144
|
+
- name: generate-map with a language
|
|
145
|
+
command: trmv-refactor
|
|
146
|
+
argv: [--project, p, --apply, generate-map, words.yaml, --language, typescript]
|
|
147
|
+
args: {project: p, apply: true, timings: false, subcommand: generate-map, table: words.yaml, language: typescript}
|
|
148
|
+
- name: generate-map needs the table
|
|
149
|
+
command: trmv-refactor
|
|
150
|
+
argv: [generate-map]
|
|
151
|
+
exit: 2
|
|
152
|
+
- name: generate-map language choice rejected
|
|
153
|
+
command: trmv-refactor
|
|
154
|
+
argv: [generate-map, words.yaml, --language, ruby]
|
|
155
|
+
exit: 2
|
|
156
|
+
- name: generate-map takes no word-table option
|
|
157
|
+
command: trmv-refactor
|
|
158
|
+
argv: [generate-map, words.yaml, --words, other.yaml]
|
|
159
|
+
exit: 2
|
|
160
|
+
- name: retarget needs the target
|
|
161
|
+
command: trmv-refactor
|
|
162
|
+
argv: [retarget, --file, a.py, --symbol, Old]
|
|
163
|
+
exit: 2
|
|
164
|
+
- name: retarget locators are exclusive
|
|
165
|
+
command: trmv-refactor
|
|
166
|
+
argv: [retarget, --file, a.py, --line, '3', --symbol, Old, --target, New]
|
|
167
|
+
exit: 2
|
|
168
|
+
- name: retarget takes no new name
|
|
169
|
+
command: trmv-refactor
|
|
170
|
+
argv: [retarget, --file, a.py, --symbol, Old, --target, New, --new-name, x]
|
|
171
|
+
exit: 2
|
|
172
|
+
- name: move-module
|
|
173
|
+
command: trmv-refactor
|
|
174
|
+
argv: [move-module, --module, a.py, --dest, pkg]
|
|
175
|
+
args: {project: ., apply: false, timings: false, subcommand: move-module, module: a.py, dest: pkg}
|
|
176
|
+
- name: nargs plus
|
|
177
|
+
command: trmv-compliance
|
|
178
|
+
argv: [a.py, b, --select, mock, --attr, x]
|
|
179
|
+
args:
|
|
180
|
+
paths: [a.py, b]
|
|
181
|
+
select: mock
|
|
182
|
+
attr: [x]
|
|
183
|
+
- name: attr repeats and keeps order
|
|
184
|
+
command: trmv-compliance
|
|
185
|
+
argv: [--attr, save_model, tests, --attr, get_model]
|
|
186
|
+
args:
|
|
187
|
+
paths: [tests]
|
|
188
|
+
select: null
|
|
189
|
+
attr: [save_model, get_model]
|
|
190
|
+
- name: nargs plus needs one
|
|
191
|
+
command: trmv-compliance
|
|
192
|
+
argv: [--select, mock]
|
|
193
|
+
exit: 2
|
|
194
|
+
- name: double dash before positionals
|
|
195
|
+
command: trmv-compliance
|
|
196
|
+
argv: [--, -a.py, b.py]
|
|
197
|
+
args:
|
|
198
|
+
paths: [-a.py, b.py]
|
|
199
|
+
select: null
|
|
200
|
+
attr: []
|
|
201
|
+
- name: mock-lint paths
|
|
202
|
+
command: trmv-mock-lint
|
|
203
|
+
argv: [tests/test_a.py, web]
|
|
204
|
+
args: {paths: [tests/test_a.py, web], base: null}
|
|
205
|
+
- name: mock-lint against a base
|
|
206
|
+
command: trmv-mock-lint
|
|
207
|
+
argv: [--base, main, tests]
|
|
208
|
+
args: {paths: [tests], base: main}
|
|
209
|
+
- name: mock-lint rejects abbreviations
|
|
210
|
+
command: trmv-mock-lint
|
|
211
|
+
argv: [--bas, main, tests]
|
|
212
|
+
exit: 2
|
|
213
|
+
- name: mock-lint needs a path
|
|
214
|
+
command: trmv-mock-lint
|
|
215
|
+
argv: [--base, main]
|
|
216
|
+
exit: 2
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Splitting a configured command (`commands.typecheck.*`) into words without a shell: POSIX shell-word rules
|
|
2
|
+
# as Python's `shlex.split` applies them (no expansion, no comments). `error: true` means the text is rejected.
|
|
3
|
+
cases:
|
|
4
|
+
- name: plain words
|
|
5
|
+
text: tsc --noEmit
|
|
6
|
+
words: [tsc, --noEmit]
|
|
7
|
+
- name: single quotes keep spaces
|
|
8
|
+
text: basedpyright -p 'my dir'
|
|
9
|
+
words: [basedpyright, -p, my dir]
|
|
10
|
+
- name: double quotes keep spaces
|
|
11
|
+
text: a "b c" d
|
|
12
|
+
words: [a, b c, d]
|
|
13
|
+
- name: double quote inside single quotes
|
|
14
|
+
text: a 'b"c'
|
|
15
|
+
words: [a, b"c]
|
|
16
|
+
- name: single quote inside double quotes
|
|
17
|
+
text: a "b'c"
|
|
18
|
+
words: [a, b'c]
|
|
19
|
+
- name: escaped double quote inside double quotes
|
|
20
|
+
text: a "b\"c"
|
|
21
|
+
words: [a, b"c]
|
|
22
|
+
- name: escaped backslash inside double quotes
|
|
23
|
+
text: '"a\\b"'
|
|
24
|
+
words: ['a\b']
|
|
25
|
+
- name: other backslash inside double quotes is kept
|
|
26
|
+
text: '"a\b"'
|
|
27
|
+
words: ['a\b']
|
|
28
|
+
- name: backslash inside single quotes is literal
|
|
29
|
+
text: "'a\\b'"
|
|
30
|
+
words: ['a\b']
|
|
31
|
+
- name: backslash outside quotes escapes the next character
|
|
32
|
+
text: a\b
|
|
33
|
+
words: [ab]
|
|
34
|
+
- name: escaped space joins words
|
|
35
|
+
text: a b\ c
|
|
36
|
+
words: [a, b c]
|
|
37
|
+
- name: adjacent quoted and bare parts concatenate
|
|
38
|
+
text: a 'b'c"d"
|
|
39
|
+
words: [a, bcd]
|
|
40
|
+
- name: empty single-quoted word
|
|
41
|
+
text: "a ''"
|
|
42
|
+
words: [a, '']
|
|
43
|
+
- name: empty double-quoted word
|
|
44
|
+
text: a ""
|
|
45
|
+
words: [a, '']
|
|
46
|
+
- name: surrounding and repeated spaces
|
|
47
|
+
text: ' a b '
|
|
48
|
+
words: [a, b]
|
|
49
|
+
- name: tab and newline separate words
|
|
50
|
+
text: "a\tb\nc"
|
|
51
|
+
words: [a, b, c]
|
|
52
|
+
- name: dollar sign is not expanded
|
|
53
|
+
text: echo '$HOME' $PATH
|
|
54
|
+
words: [echo, $HOME, $PATH]
|
|
55
|
+
- name: empty text
|
|
56
|
+
text: ''
|
|
57
|
+
words: []
|
|
58
|
+
- name: whitespace only
|
|
59
|
+
text: " \t "
|
|
60
|
+
words: []
|
|
61
|
+
- name: unterminated single quote
|
|
62
|
+
text: a 'b
|
|
63
|
+
error: true
|
|
64
|
+
- name: unterminated double quote
|
|
65
|
+
text: a "b
|
|
66
|
+
error: true
|
|
67
|
+
- name: trailing backslash
|
|
68
|
+
text: a b\
|
|
69
|
+
error: true
|