@eagleoutice/flowr 2.17.2 → 2.17.4
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 +9 -9
- package/cli/repl/commands/repl-signature.d.ts +1 -1
- package/cli/repl/completion.d.ts +23 -0
- package/cli/repl/completion.js +9 -0
- package/cli/repl/core.d.ts +0 -23
- package/cli/repl/core.js +0 -5
- package/cli/repl/parser/slice-query-parser.d.ts +1 -1
- package/cli/repl/parser/slice-query-parser.js +3 -3
- package/data/r-reexports.generated.d.ts +4 -0
- package/data/r-reexports.generated.js +43 -0
- package/dataflow/environments/built-in-props.d.ts +8 -1
- package/dataflow/environments/built-in-props.js +9 -1
- package/dataflow/environments/built-in.d.ts +5 -3
- package/dataflow/environments/built-in.js +5 -4
- package/dataflow/environments/default-builtin-config.d.ts +21 -3
- package/dataflow/environments/default-builtin-config.js +49 -47
- package/dataflow/eval/resolve/resolve-argument.js +11 -6
- package/dataflow/eval/resolve/resolve-numbers.d.ts +1 -178
- package/dataflow/eval/resolve/resolve-numbers.js +2 -13
- package/dataflow/eval/resolve/resolve-strings.d.ts +1 -93
- package/dataflow/eval/resolve/resolve-strings.js +2 -17
- package/dataflow/eval/resolve/resolve-working-directory.js +3 -4
- package/dataflow/extractor.js +44 -26
- package/dataflow/graph/df-helper.d.ts +10 -1
- package/dataflow/graph/df-helper.js +27 -3
- package/dataflow/internal/linker.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +8 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +44 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +9 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-new-env.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +0 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +11 -21
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +13 -3
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +15 -5
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +1 -24
- package/dataflow/internal/process/functions/call/known-call-handling.js +8 -34
- package/dataflow/internal/process/functions/call/nse-kind.d.ts +24 -0
- package/dataflow/internal/process/functions/call/nse-kind.js +30 -0
- package/documentation/wiki-dataflow-graph.js +7 -2
- package/documentation/wiki-query.js +3 -2
- package/linter/rules/absolute-path.js +5 -5
- package/linter/rules/cmd-check/dependency-declaration.js +2 -2
- package/linter/rules/cmd-check/package-runtime.js +2 -2
- package/linter/rules/deprecated-functions.js +2 -2
- package/linter/rules/file-path-validity.js +5 -5
- package/linter/rules/function-finder-util.js +2 -2
- package/linter/rules/overwritten-file.js +2 -4
- package/linter/rules/secret-exfiltration.d.ts +3 -2
- package/linter/rules/secret-exfiltration.js +8 -3
- package/linter/rules/unused-import.js +20 -6
- package/package.json +1 -1
- package/project/cache/flowr-analyzer-controlflow-cache.d.ts +0 -6
- package/project/cache/flowr-analyzer-controlflow-cache.js +7 -27
- package/project/context/flowr-analyzer-context.d.ts +2 -2
- package/project/context/flowr-analyzer-context.js +2 -2
- package/project/context/flowr-analyzer-files-context.d.ts +8 -0
- package/project/context/flowr-analyzer-files-context.js +51 -6
- package/project/flowr-analyzer.d.ts +0 -9
- package/project/flowr-analyzer.js +7 -28
- package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +5 -3
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +70 -163
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +2 -3
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +2 -3
- package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.js +3 -3
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +2 -2
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +1 -2
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +25 -3
- package/project/plugins/package-version-plugins/package.js +1 -1
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +2 -3
- package/project/sigdb/build.js +7 -6
- package/project/sigdb/decode.d.ts +2 -0
- package/project/sigdb/decode.js +9 -3
- package/project/sigdb/schema.d.ts +8 -3
- package/queries/catalog/absint-query/absint-query-format.d.ts +1 -1
- package/queries/catalog/config-query/config-query-format.d.ts +1 -1
- package/queries/catalog/config-query/config-query-format.js +4 -4
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +6 -5
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -4
- package/queries/catalog/dependencies-query/dependencies-query-format.js +11 -11
- package/queries/catalog/dependencies-query/dependency-values.d.ts +9 -0
- package/queries/catalog/dependencies-query/dependency-values.js +13 -0
- package/queries/catalog/dependencies-query/function-info/remote-functions.js +2 -2
- package/queries/catalog/dependencies-query/function-info/write-functions.js +8 -7
- package/queries/catalog/dependencies-query/implicit-echo.js +2 -1
- package/queries/catalog/dependencies-query/plot-description.d.ts +1 -1
- package/queries/catalog/dependencies-query/plot-description.js +2 -2
- package/queries/catalog/dice-query/dice-query-format.d.ts +1 -1
- package/queries/catalog/files-query/files-query-format.d.ts +1 -1
- package/queries/catalog/linter-query/linter-query-format.d.ts +2 -2
- package/queries/catalog/linter-query/linter-query-format.js +13 -9
- package/queries/catalog/signature-query/signature-query-executor.d.ts +1 -1
- package/queries/catalog/taint-query/taint-query-format.d.ts +1 -1
- package/queries/query-function-filter.d.ts +1 -1
- package/queries/query.d.ts +2 -2
- package/r-bridge/init.js +1 -1
- package/search/flowr-search-filters.js +2 -2
- package/search/search-executor/search-generators.d.ts +0 -1
- package/search/search-executor/search-generators.js +5 -6
- package/search/search-logger.d.ts +1 -0
- package/search/search-logger.js +6 -0
- package/util/flowr-version.d.ts +1 -1
- package/util/flowr-version.js +2 -2
package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js
CHANGED
|
@@ -56,6 +56,7 @@ const r_version_1 = require("../../../util/r-version");
|
|
|
56
56
|
const r_base_packages_1 = require("../../../util/r-base-packages");
|
|
57
57
|
const defaultmap_1 = require("../../../util/collections/defaultmap");
|
|
58
58
|
const arrays_1 = require("../../../util/collections/arrays");
|
|
59
|
+
const r_reexports_generated_1 = require("../../../data/r-reexports.generated");
|
|
59
60
|
const secure_mode_1 = require("../../../util/secure-mode");
|
|
60
61
|
/** the plugin's instance name (pass to `unregisterPlugins` to disable the default sigdb resolver) */
|
|
61
62
|
exports.SigDbPluginName = 'flowr-analyzer-package-versions-sigdb-plugin';
|
|
@@ -493,16 +494,18 @@ exports.FlowrAnalyzerPackageVersionsSigDbPlugin = FlowrAnalyzerPackageVersionsSi
|
|
|
493
494
|
* for the package (`stated`) is part of its interface, even where the source misses it.
|
|
494
495
|
*/
|
|
495
496
|
function packageFromExports(name, info, stated) {
|
|
496
|
-
|
|
497
|
+
/* a source that records no re-exports lacks them altogether, so R's own answer for the package stands in */
|
|
498
|
+
const reexports = info.reexports ?? knownReexports(name);
|
|
499
|
+
const exported = (0, arrays_1.uniqueArray)([...info.exported, ...reexports?.keys() ?? [], ...[...stated ?? []].map(String)]);
|
|
497
500
|
const namespaceInfo = {
|
|
498
501
|
exportedSymbols: exported,
|
|
499
|
-
exportedFunctions: [],
|
|
500
502
|
exportedS4Methods: [],
|
|
501
503
|
/* the database derives these from the very `exportClasses()` directives the field stands for */
|
|
502
504
|
exportedS4Classes: info.s4Classes.slice(),
|
|
503
505
|
exportS3Generics: reconstructS3Generics(exported),
|
|
504
506
|
exportedPatterns: [],
|
|
505
|
-
|
|
507
|
+
/* a re-export is an `importFrom()` of the name the package exports */
|
|
508
|
+
importedPackages: reexportImports(reexports),
|
|
506
509
|
loadsWithSideEffects: false,
|
|
507
510
|
callable: exported
|
|
508
511
|
};
|
|
@@ -510,4 +513,23 @@ function packageFromExports(name, info, stated) {
|
|
|
510
513
|
carries no version rather than a made-up one */
|
|
511
514
|
return new package_1.Package({ name, namespaceInfo, resolvedVersion: info.version || undefined });
|
|
512
515
|
}
|
|
516
|
+
/** the re-exports R reports for `pkg`, see {@link RReexports} */
|
|
517
|
+
function knownReexports(pkg) {
|
|
518
|
+
const known = Object.hasOwn(r_reexports_generated_1.RReexports, pkg) ? r_reexports_generated_1.RReexports[pkg] : undefined;
|
|
519
|
+
return known === undefined ? undefined : new Map(Object.entries(known.reexports));
|
|
520
|
+
}
|
|
521
|
+
/** the `importFrom(origin, names)` directives behind a source's re-exports, grouped by origin */
|
|
522
|
+
function reexportImports(reexports) {
|
|
523
|
+
const imports = new Map();
|
|
524
|
+
for (const [fn, origin] of reexports ?? []) {
|
|
525
|
+
const names = imports.get(origin);
|
|
526
|
+
if (names === undefined) {
|
|
527
|
+
imports.set(origin, [fn]);
|
|
528
|
+
}
|
|
529
|
+
else {
|
|
530
|
+
names.push(fn);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
return imports;
|
|
534
|
+
}
|
|
513
535
|
//# sourceMappingURL=flowr-analyzer-package-versions-sigdb-plugin.js.map
|
|
@@ -70,7 +70,7 @@ class Package {
|
|
|
70
70
|
}
|
|
71
71
|
// a directly exported symbol/function - this also covers dotted plain exports such as
|
|
72
72
|
// `solve.QP`, `as.Date` or `read.csv` that are not S3 methods
|
|
73
|
-
if (this.namespaceInfo.
|
|
73
|
+
if (this.namespaceInfo.exportedSymbols.includes(name)
|
|
74
74
|
|| this.namespaceInfo.exportedS4Methods.includes(name) || this.namespaceInfo.exportedS4Classes.includes(name)) {
|
|
75
75
|
return true;
|
|
76
76
|
}
|
|
@@ -9,7 +9,6 @@ const flowr_analyzer_plugin_1 = require("../flowr-analyzer-plugin");
|
|
|
9
9
|
const semver_1 = require("semver");
|
|
10
10
|
const flowr_file_1 = require("../../context/flowr-file");
|
|
11
11
|
const files_1 = require("../../../util/files");
|
|
12
|
-
const built_in_source_1 = require("../../../dataflow/internal/process/functions/call/built-in/built-in-source");
|
|
13
12
|
const fs_1 = __importDefault(require("fs"));
|
|
14
13
|
const path_1 = __importDefault(require("path"));
|
|
15
14
|
const classify_project_kind_1 = require("../../context/classify-project-kind");
|
|
@@ -47,9 +46,9 @@ function collectRequests(files, root, opts = {}) {
|
|
|
47
46
|
const requests = [];
|
|
48
47
|
for (const file of files) {
|
|
49
48
|
const relativePath = path_1.default.relative(root, file);
|
|
50
|
-
if (supportedExtensions.test(relativePath) && (!onlyTraversePaths || onlyTraversePaths.test(relativePath)) && !excludePathsRegex.test(
|
|
49
|
+
if (supportedExtensions.test(relativePath) && (!onlyTraversePaths || onlyTraversePaths.test(relativePath)) && !excludePathsRegex.test(files_1.RPath.dirname(relativePath))) {
|
|
51
50
|
requests.push({ content: file, request: 'file' });
|
|
52
|
-
if (flowr_analyzer_rprofile_file_plugin_1.RprofileFilePattern.test(
|
|
51
|
+
if (flowr_analyzer_rprofile_file_plugin_1.RprofileFilePattern.test(files_1.RPath.basename(relativePath))) {
|
|
53
52
|
// parse requests skip the file plugins, so emit a file too to have the profile tagged
|
|
54
53
|
requests.push(new flowr_file_1.FlowrTextFile(file));
|
|
55
54
|
}
|
package/project/sigdb/build.js
CHANGED
|
@@ -127,7 +127,8 @@ function buildBlob(p, strings, tier, feats) {
|
|
|
127
127
|
const fn = (f) => {
|
|
128
128
|
const base = [strings.str(f.name), sig(f.params), cg(f.callees), f.props,
|
|
129
129
|
feats.locations && f.file ? strings.str(f.file) : -1, feats.locations ? f.line ?? -1 : -1];
|
|
130
|
-
const
|
|
130
|
+
const topic = f.topic && f.topic !== f.name ? strings.str(f.topic) : -1;
|
|
131
|
+
const rec = f.reexportOf ? [...base, topic, strings.str(f.reexportOf)] : topic >= 0 ? [...base, topic] : base;
|
|
131
132
|
return fns.intern(rec.join(','), rec);
|
|
132
133
|
};
|
|
133
134
|
const depList = (list) => {
|
|
@@ -388,9 +389,7 @@ function optimizeStringOrder(strings, blobs) {
|
|
|
388
389
|
for (const f of blob.fns) {
|
|
389
390
|
bump(f[0]);
|
|
390
391
|
bump(f[4]);
|
|
391
|
-
|
|
392
|
-
bump(f[6]);
|
|
393
|
-
}
|
|
392
|
+
f.slice(6).forEach(bump);
|
|
394
393
|
}
|
|
395
394
|
for (const list of blob.deps) {
|
|
396
395
|
for (const d of list) {
|
|
@@ -458,8 +457,10 @@ function optimizeStringOrder(strings, blobs) {
|
|
|
458
457
|
if (f[4] >= 0) {
|
|
459
458
|
f[4] = remap[f[4]];
|
|
460
459
|
}
|
|
461
|
-
|
|
462
|
-
f[
|
|
460
|
+
for (let i = 6; i < f.length; i++) {
|
|
461
|
+
if (f[i] >= 0) {
|
|
462
|
+
f[i] = remap[f[i]];
|
|
463
|
+
}
|
|
463
464
|
}
|
|
464
465
|
}
|
|
465
466
|
for (const list of blob.deps) {
|
|
@@ -42,6 +42,8 @@ export interface DecodedFunction {
|
|
|
42
42
|
readonly callees: readonly string[];
|
|
43
43
|
/** the Rd help topic (man-page name) documenting this function, when it differs from {@link name} */
|
|
44
44
|
readonly topic?: string;
|
|
45
|
+
/** the package this name is re-exported from, see {@link SigFunctionInfo.reexportOf} */
|
|
46
|
+
readonly reexportOf?: string;
|
|
45
47
|
}
|
|
46
48
|
/**
|
|
47
49
|
* The transitive callees of `name`. Each local callee that is itself a function of `functions` (one package
|
package/project/sigdb/decode.js
CHANGED
|
@@ -75,7 +75,7 @@ function transitiveCallees(functions, name) {
|
|
|
75
75
|
}
|
|
76
76
|
/** decode one of a blob's function records against the global string dictionary */
|
|
77
77
|
function decodeFunction(strings, blob, fnIdx) {
|
|
78
|
-
const [nameIdx, sigIdx, cgIdx, bits, fileIdx, line, topicIdx] = blob.fns[fnIdx];
|
|
78
|
+
const [nameIdx, sigIdx, cgIdx, bits, fileIdx, line, topicIdx, reexportIdx] = blob.fns[fnIdx];
|
|
79
79
|
const name = strings.at(nameIdx);
|
|
80
80
|
const signature = (sigIdx >= 0 ? blob.sigs[sigIdx] : []).map(p => {
|
|
81
81
|
const [n, props, def] = Array.isArray(p) ? [p[0], p[1], p.length === 3 ? p[2] : -1] : [p, 0, -1];
|
|
@@ -89,6 +89,7 @@ function decodeFunction(strings, blob, fnIdx) {
|
|
|
89
89
|
return (0, objects_1.compactRecord)({
|
|
90
90
|
name,
|
|
91
91
|
topic: topicIdx !== undefined && topicIdx >= 0 ? strings.at(topicIdx) : undefined,
|
|
92
|
+
reexportOf: reexportIdx !== undefined ? strings.at(reexportIdx) : undefined,
|
|
92
93
|
file: fileIdx >= 0 ? strings.at(fileIdx) : undefined,
|
|
93
94
|
line,
|
|
94
95
|
exported: isExportedEntry(bits, name),
|
|
@@ -169,8 +170,9 @@ function deriveLibraryExports(strings, blob, meta, pkg, version, cranBase = sche
|
|
|
169
170
|
const s3Classes = [];
|
|
170
171
|
const s4Classes = [];
|
|
171
172
|
const locations = new Map();
|
|
173
|
+
const reexports = new Map();
|
|
172
174
|
for (const i of idxs) {
|
|
173
|
-
const [nameIdx, , , bits, fileIdx, line] = blob.fns[i];
|
|
175
|
+
const [nameIdx, , , bits, fileIdx, line, , reexportIdx] = blob.fns[i];
|
|
174
176
|
const name = strings.at(nameIdx);
|
|
175
177
|
(isExportedEntry(bits, name) ? exported : internal).push(name);
|
|
176
178
|
if (bits & 32 /* FnProp.Deprecated */) {
|
|
@@ -185,12 +187,16 @@ function deriveLibraryExports(strings, blob, meta, pkg, version, cranBase = sche
|
|
|
185
187
|
if (fileIdx >= 0) {
|
|
186
188
|
locations.set(name, { file: strings.at(fileIdx), line });
|
|
187
189
|
}
|
|
190
|
+
if (reexportIdx !== undefined) {
|
|
191
|
+
reexports.set(name, strings.at(reexportIdx));
|
|
192
|
+
}
|
|
188
193
|
}
|
|
189
194
|
const cran = !blob.noncran?.includes(ver);
|
|
190
195
|
return {
|
|
191
196
|
version: ver, exported, internal, deprecated, s3Classes, s4Classes, cran,
|
|
192
197
|
cranUrl: cranBlobUrl(cranBase, pkg, ver, { latest, archived: archived === 1, cran }),
|
|
193
|
-
...(locations.size > 0 ? { locations } : {})
|
|
198
|
+
...(locations.size > 0 ? { locations } : {}),
|
|
199
|
+
...(reexports.size > 0 ? { reexports } : {})
|
|
194
200
|
};
|
|
195
201
|
}
|
|
196
202
|
//# sourceMappingURL=decode.js.map
|
|
@@ -30,6 +30,8 @@ export interface LibraryExports {
|
|
|
30
30
|
readonly cranUrl?: string;
|
|
31
31
|
/** definition location per identifier, if the database carries them */
|
|
32
32
|
readonly locations?: ReadonlyMap<string, SigDefinitionLocation>;
|
|
33
|
+
/** the package each re-exported name comes from (`importFrom(magrittr, "%>%")` plus `export("%>%")`), if the database carries it */
|
|
34
|
+
readonly reexports?: ReadonlyMap<string, string>;
|
|
33
35
|
}
|
|
34
36
|
export declare const SigDbMagic = "flowr-sigdb";
|
|
35
37
|
export declare const SigDbSchema = 5;
|
|
@@ -92,10 +94,11 @@ export type SigParam = number | [nameIdx: number, props: number] | [nameIdx: num
|
|
|
92
94
|
export type Sig = SigParam[];
|
|
93
95
|
/**
|
|
94
96
|
* One function record `[nameIdx, sigIdx, cgIdx, propBits, fileIdx, line]` (`sigIdx`/`cgIdx`/`fileIdx` are -1 when
|
|
95
|
-
* absent), with an optional trailing `topicIdx` (the Rd help topic,
|
|
96
|
-
*
|
|
97
|
+
* absent), with an optional trailing `topicIdx` (the Rd help topic, -1 when it equals the name) and, after it, an
|
|
98
|
+
* optional `reexportIdx` (the package a re-export comes from).
|
|
99
|
+
* The trailing elements are additive: readers that stop at `line` ignore them, so older bundles stay readable.
|
|
97
100
|
*/
|
|
98
|
-
export type SigFn = [nameIdx: number, sigIdx: number, cgIdx: number, propBits: number, fileIdx: number, line: number] | [nameIdx: number, sigIdx: number, cgIdx: number, propBits: number, fileIdx: number, line: number, topicIdx: number];
|
|
101
|
+
export type SigFn = [nameIdx: number, sigIdx: number, cgIdx: number, propBits: number, fileIdx: number, line: number] | [nameIdx: number, sigIdx: number, cgIdx: number, propBits: number, fileIdx: number, line: number, topicIdx: number] | [nameIdx: number, sigIdx: number, cgIdx: number, propBits: number, fileIdx: number, line: number, topicIdx: number, reexportIdx: number];
|
|
99
102
|
/** the object system a class record belongs to, mirroring {@link ClassSystem} in a single on-disk byte */
|
|
100
103
|
export declare const enum SigClassSystem {
|
|
101
104
|
S4 = 0,
|
|
@@ -236,6 +239,8 @@ export interface SigFunctionInfo {
|
|
|
236
239
|
readonly line?: number;
|
|
237
240
|
/** the Rd help topic (man-page name) documenting this function, when it differs from {@link name} */
|
|
238
241
|
readonly topic?: string;
|
|
242
|
+
/** the package this name is re-exported from: the package defines nothing of the name, it imports and exports it */
|
|
243
|
+
readonly reexportOf?: string;
|
|
239
244
|
}
|
|
240
245
|
/** one declared package dependency, e.g. `{ name: 'testthat', type: Suggests, constraint: '>= 2.1.0' }` */
|
|
241
246
|
export interface SigDependencyInfo {
|
|
@@ -4,7 +4,7 @@ import { DataFrameShapeAnalysis } from '../../../abstract-interpretation/data-fr
|
|
|
4
4
|
import type { MultiValueDomain, MultiValueStateDomain } from '../../../abstract-interpretation/domains/multi-value-state-domain';
|
|
5
5
|
import type { StateDomain } from '../../../abstract-interpretation/domains/state-domain';
|
|
6
6
|
import type { ReplOutput } from '../../../cli/repl/commands/repl-main';
|
|
7
|
-
import type { CommandCompletions } from '../../../cli/repl/
|
|
7
|
+
import type { CommandCompletions } from '../../../cli/repl/completion';
|
|
8
8
|
import type { FlowrConfig } from '../../../config';
|
|
9
9
|
import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
10
10
|
import { SlicingCriterion, type SlicingCriteria } from '../../../slicing/criterion/parse';
|
|
@@ -6,7 +6,7 @@ import { FlowrConfig } from '../../../config';
|
|
|
6
6
|
import type { DeepPartial } from 'ts-essentials';
|
|
7
7
|
import type { ParsedQueryLine, Query } from '../../query';
|
|
8
8
|
import type { ReplOutput } from '../../../cli/repl/commands/repl-main';
|
|
9
|
-
import { type CommandCompletions } from '../../../cli/repl/
|
|
9
|
+
import { type CommandCompletions } from '../../../cli/repl/completion';
|
|
10
10
|
import type { ProjectKind } from '../../../project/context/project-kind';
|
|
11
11
|
export interface ConfigQuery extends BaseQueryFormat {
|
|
12
12
|
readonly type: 'config';
|
|
@@ -11,7 +11,7 @@ const ansi_1 = require("../../../util/text/ansi");
|
|
|
11
11
|
const joi_1 = __importDefault(require("joi"));
|
|
12
12
|
const config_1 = require("../../../config");
|
|
13
13
|
const json_1 = require("../../../util/json");
|
|
14
|
-
const
|
|
14
|
+
const completion_1 = require("../../../cli/repl/completion");
|
|
15
15
|
const schema_1 = require("../../../util/schema");
|
|
16
16
|
const strings_1 = require("../../../util/text/strings");
|
|
17
17
|
function configReplCompleter(partialLine, startingNewArg, _config) {
|
|
@@ -25,7 +25,7 @@ function configReplCompleter(partialLine, startingNewArg, _config) {
|
|
|
25
25
|
const sigil = update ? '+' : '';
|
|
26
26
|
// on the empty token also offer `+` (writes a value) before the inspectable keys (which read); label it like the keys
|
|
27
27
|
const lead = token.length === 0 ? ['+'] : [];
|
|
28
|
-
const leadLabels = token.length === 0 ? [['+', (0,
|
|
28
|
+
const leadLabels = token.length === 0 ? [['+', (0, completion_1.describeCompletion)('+', 'change config values')]] : [];
|
|
29
29
|
// once `+key=` is typed, complete the value (its type), not more keys
|
|
30
30
|
if (update && raw.includes('=')) {
|
|
31
31
|
const eq = raw.indexOf('=');
|
|
@@ -44,7 +44,7 @@ function configReplCompleter(partialLine, startingNewArg, _config) {
|
|
|
44
44
|
if (!update && raw.includes('*')) {
|
|
45
45
|
const matches = configGlobMatcher(raw.endsWith('*') ? raw : `${raw}*`);
|
|
46
46
|
const found = sortConfigPaths(configPaths().filter(matches)).map(p => p.join('.'));
|
|
47
|
-
return { completions: found, labels: new Map(found.map(p => [p, (0,
|
|
47
|
+
return { completions: found, labels: new Map(found.map(p => [p, (0, completion_1.describeCompletion)(p, configSchemaInfo(p.split('.')).type ?? '')])), preFiltered: true };
|
|
48
48
|
}
|
|
49
49
|
const path = raw.split('.').filter(p => p.length > 0);
|
|
50
50
|
const fullPath = path.slice();
|
|
@@ -57,7 +57,7 @@ function configReplCompleter(partialLine, startingNewArg, _config) {
|
|
|
57
57
|
const have = offered.map(k => `${sigil}${[...path, k].join('.')}`);
|
|
58
58
|
if (have.length > 0) {
|
|
59
59
|
// label starts with the full completion (incl. sigil) so readline keeps the sigil on common-prefix insertion
|
|
60
|
-
return { completions: [...lead, ...have], labels: new Map([...leadLabels, ...have.map((c, i) => [c, offered[i] === 'reset' && path.length === 0 ? (0,
|
|
60
|
+
return { completions: [...lead, ...have], labels: new Map([...leadLabels, ...have.map((c, i) => [c, offered[i] === 'reset' && path.length === 0 ? (0, completion_1.describeCompletion)(c, 'discard runtime config updates') : (0, completion_1.describeCompletion)(c, configSchemaInfo([...path, offered[i]]).type ?? '')])]) };
|
|
61
61
|
}
|
|
62
62
|
else if (lastPath.length > 0 && configSchemaKeys(fullPath).length > 0) {
|
|
63
63
|
return { completions: [`${sigil}${fullPath.join('.')}.`] };
|
|
@@ -5,6 +5,7 @@ const query_1 = require("../../query");
|
|
|
5
5
|
const slice_direction_1 = require("../../../util/slice-direction");
|
|
6
6
|
const parse_1 = require("../../../slicing/criterion/parse");
|
|
7
7
|
const dependencies_query_format_1 = require("./dependencies-query-format");
|
|
8
|
+
const dependency_values_1 = require("./dependency-values");
|
|
8
9
|
const vertex_1 = require("../../../dataflow/graph/vertex");
|
|
9
10
|
const identifier_1 = require("../../../dataflow/environments/identifier");
|
|
10
11
|
const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
@@ -94,7 +95,7 @@ async function executeDependenciesQuery({ analyzer, }, queries) {
|
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
97
|
if (query.assumedPackages && (enabled === undefined || enabled.includes('library'))) {
|
|
97
|
-
const explicit = new Set((results.library ?? []).map(r => r.value).filter((v) => v !== undefined && v !==
|
|
98
|
+
const explicit = new Set((results.library ?? []).map(r => r.value).filter((v) => v !== undefined && v !== dependency_values_1.Unknown && v !== dependency_values_1.Constant));
|
|
98
99
|
const assumed = assumedBasePackageEntries(dataflow.graph, ctx.resolvedRVersion, explicit);
|
|
99
100
|
if (assumed.length > 0) {
|
|
100
101
|
results.library = [...(results.library ?? []), ...assumed];
|
|
@@ -124,7 +125,7 @@ const NotPassedOnByCalls = new Set(['library', 'source', 'remote']);
|
|
|
124
125
|
*/
|
|
125
126
|
function callSitesOf(found, graph, ast, revalue) {
|
|
126
127
|
/* a call already found doing this needs no entry for it, but two writes of one file in one body both pass on to the call */
|
|
127
|
-
const named = (value) => value !== undefined && value !==
|
|
128
|
+
const named = (value) => value !== undefined && value !== dependency_values_1.Unknown && value !== dependency_values_1.Constant && !dependency_values_1.ConsoleStreams.has(value);
|
|
128
129
|
const key = (id, value, root) => `${String(id)}\0${value ?? ''}\0${named(value) ? String(root) : ''}`;
|
|
129
130
|
const known = new Set(found.map(f => key(f.nodeId, f.value)));
|
|
130
131
|
const byNode = Map.groupBy(found.filter(f => f.nodeId !== undefined), f => f.nodeId);
|
|
@@ -337,7 +338,7 @@ function getResults(categories, run, results, kind, functions, data, attaching =
|
|
|
337
338
|
lexemeOfArgument: undefined,
|
|
338
339
|
linkedIds: linked?.length ? linked : undefined,
|
|
339
340
|
...flow,
|
|
340
|
-
value: passesInline ?
|
|
341
|
+
value: passesInline ? dependency_values_1.Constant : info.defaultValue ?? defaultValue
|
|
341
342
|
}));
|
|
342
343
|
}
|
|
343
344
|
continue;
|
|
@@ -386,7 +387,7 @@ function getResults(categories, run, results, kind, functions, data, attaching =
|
|
|
386
387
|
}
|
|
387
388
|
return finalResults;
|
|
388
389
|
function unresolvedArgumentCode(argument, id) {
|
|
389
|
-
if ((argument && argument !==
|
|
390
|
+
if ((argument && argument !== dependency_values_1.Unknown && argument !== dependency_values_1.Constant) || !id) {
|
|
390
391
|
return undefined;
|
|
391
392
|
}
|
|
392
393
|
return model_1.RNode.lexeme(r_argument_1.RArgument.valueOf(normalize.idMap.get(id)));
|
|
@@ -396,7 +397,7 @@ function collectValuesFromLinks(args, data, linkedIds, callContext) {
|
|
|
396
397
|
if (!linkedIds || linkedIds.length === 0) {
|
|
397
398
|
return undefined;
|
|
398
399
|
}
|
|
399
|
-
const hasAtLeastAValue = args !== undefined && args.values().flatMap(x => Array.from(x)).toArray().some(v => v !==
|
|
400
|
+
const hasAtLeastAValue = args !== undefined && args.values().flatMap(x => Array.from(x)).toArray().some(v => v !== dependency_values_1.Unknown && v !== dependency_values_1.Constant && v !== undefined);
|
|
400
401
|
const map = new Map();
|
|
401
402
|
for (const linkedId of linkedIds) {
|
|
402
403
|
if (typeof linkedId !== 'object' || !linkedId.info) {
|
|
@@ -12,10 +12,7 @@ import type { AsyncOrSync, MarkOptional } from 'ts-essentials';
|
|
|
12
12
|
import type { NamespaceInfo } from '../../../project/plugins/file-plugins/files/flowr-namespace-file';
|
|
13
13
|
import { Identifier } from '../../../dataflow/environments/identifier';
|
|
14
14
|
import type { ReadOnlyFlowrAnalyzerContext } from '../../../project/context/flowr-analyzer-context';
|
|
15
|
-
|
|
16
|
-
export declare const Unknown = "unknown";
|
|
17
|
-
/** The value resolved, but to data given inline rather than to a path (`matrix(0, 2, 2)`, `data.frame(a = 1)`). */
|
|
18
|
-
export declare const Constant = "constant";
|
|
15
|
+
export { Constant, Unknown } from './dependency-values';
|
|
19
16
|
/** {@link DependencyInfo#functionName} for an assumed base package: nothing in the code names it, so there is no call to report as `functionName`. */
|
|
20
17
|
export declare const Attached = "<attached>";
|
|
21
18
|
export interface DependencyCategorySettings {
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DependenciesQueryDefinition = exports.defaultDependencyCategories = exports.DefaultDependencyCategoryNames = exports.Attached = exports.
|
|
6
|
+
exports.DependenciesQueryDefinition = exports.defaultDependencyCategories = exports.DefaultDependencyCategoryNames = exports.Attached = exports.Unknown = exports.Constant = void 0;
|
|
7
7
|
exports.getAllCategories = getAllCategories;
|
|
8
8
|
exports.getAllCategoryNames = getAllCategoryNames;
|
|
9
9
|
const base_query_format_1 = require("../../base-query-format");
|
|
@@ -37,10 +37,10 @@ const implicit_echo_1 = require("./implicit-echo");
|
|
|
37
37
|
const arrays_1 = require("../../../util/collections/arrays");
|
|
38
38
|
const defaultmap_1 = require("../../../util/collections/defaultmap");
|
|
39
39
|
const range_1 = require("../../../util/range");
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
exports.
|
|
40
|
+
const dependency_values_1 = require("./dependency-values");
|
|
41
|
+
var dependency_values_2 = require("./dependency-values");
|
|
42
|
+
Object.defineProperty(exports, "Constant", { enumerable: true, get: function () { return dependency_values_2.Constant; } });
|
|
43
|
+
Object.defineProperty(exports, "Unknown", { enumerable: true, get: function () { return dependency_values_2.Unknown; } });
|
|
44
44
|
/** {@link DependencyInfo#functionName} for an assumed base package: nothing in the code names it, so there is no call to report as `functionName`. */
|
|
45
45
|
exports.Attached = '<attached>';
|
|
46
46
|
/** the built-in categories; what each searches for is derived per configuration, see {@link defaultDependencyCategories} */
|
|
@@ -135,7 +135,7 @@ const dependencyCategoriesOf = (env) => ({
|
|
|
135
135
|
'library': {
|
|
136
136
|
queryDisplayName: 'Libraries',
|
|
137
137
|
functions: library_functions_1.LibraryFunctions,
|
|
138
|
-
defaultValue:
|
|
138
|
+
defaultValue: dependency_values_1.Unknown,
|
|
139
139
|
/* for libraries, we have to additionally track all uses of `::` and `:::`, for this we currently simply traverse all uses */
|
|
140
140
|
additionalAnalysis: async (data, ignoreDefault, _functions, _queryResults, result) => {
|
|
141
141
|
if (!ignoreDefault) {
|
|
@@ -160,7 +160,7 @@ const dependencyCategoriesOf = (env) => ({
|
|
|
160
160
|
'remote': {
|
|
161
161
|
queryDisplayName: 'Remote Installs',
|
|
162
162
|
functions: remote_functions_1.RemoteFunctions,
|
|
163
|
-
defaultValue:
|
|
163
|
+
defaultValue: dependency_values_1.Unknown,
|
|
164
164
|
/* the value is the reference as written, which names the package only implicitly */
|
|
165
165
|
additionalAnalysis: (_data, _ignoreDefault, _functions, _queryResults, result) => {
|
|
166
166
|
for (const [at, info] of result.entries()) {
|
|
@@ -174,17 +174,17 @@ const dependencyCategoriesOf = (env) => ({
|
|
|
174
174
|
'source': {
|
|
175
175
|
queryDisplayName: 'Sourced Files',
|
|
176
176
|
functions: source_functions_1.SourceFunctions,
|
|
177
|
-
defaultValue:
|
|
177
|
+
defaultValue: dependency_values_1.Unknown
|
|
178
178
|
},
|
|
179
179
|
'read': {
|
|
180
180
|
queryDisplayName: 'Read Data',
|
|
181
181
|
functions: env.deriveFromDefinitions(read_functions_1.computeReadFunctions),
|
|
182
|
-
defaultValue:
|
|
182
|
+
defaultValue: dependency_values_1.Unknown
|
|
183
183
|
},
|
|
184
184
|
'write': {
|
|
185
185
|
queryDisplayName: 'Outputs',
|
|
186
186
|
functions: env.derive(write_functions_1.writeFunctionsOf),
|
|
187
|
-
defaultValue:
|
|
187
|
+
defaultValue: dependency_values_1.StdOut,
|
|
188
188
|
/* what the top level prints on its own is an output like any other, marked {@link DependencyInfo#implicit} */
|
|
189
189
|
additionalAnalysis: async (data, ignoreDefault, _functions, queryResults, result) => {
|
|
190
190
|
/* without implicit echo (e.g. in a package, whose top-level code runs at install time) nothing is auto-printed */
|
|
@@ -228,7 +228,7 @@ function printResultSection(title, infos, result, formatter) {
|
|
|
228
228
|
// one line per dependency: the value (package/file) up front, its function + node as a faint provenance suffix
|
|
229
229
|
for (const i of infos) {
|
|
230
230
|
/* neither names a resource: inline data is resolved but no path, `unknown` is a path we could not resolve */
|
|
231
|
-
const stands = i.value ===
|
|
231
|
+
const stands = i.value === dependency_values_1.Constant ? '<inline data>' : i.value === dependency_values_1.Unknown || i.value === undefined ? '<unresolved>' : undefined;
|
|
232
232
|
const value = stands !== undefined ? (0, ansi_1.faint)(stands, formatter) : (0, ansi_1.bold)(i.value, formatter);
|
|
233
233
|
const version = i.derivedRange !== undefined ? ` ${(0, ansi_1.faint)(i.derivedRange.format(), formatter)}` : '';
|
|
234
234
|
if (i.nodeId === undefined) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** The value could not be resolved, e.g. a path assembled at runtime. Such a dependency may be missing or fetchable. */
|
|
2
|
+
export declare const Unknown = "unknown";
|
|
3
|
+
/** The value resolved, but to data given inline rather than to a path (`matrix(0, 2, 2)`, `data.frame(a = 1)`). */
|
|
4
|
+
export declare const Constant = "constant";
|
|
5
|
+
/** What goes to the console rather than to a file: the standard output, and the standard error stream. */
|
|
6
|
+
export declare const StdOut = "stdout";
|
|
7
|
+
export declare const StdErr = "stderr";
|
|
8
|
+
/** The values naming a console stream rather than a file, see {@link StdOut} and {@link StdErr}. */
|
|
9
|
+
export declare const ConsoleStreams: ReadonlySet<string>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConsoleStreams = exports.StdErr = exports.StdOut = exports.Constant = exports.Unknown = void 0;
|
|
4
|
+
/** The value could not be resolved, e.g. a path assembled at runtime. Such a dependency may be missing or fetchable. */
|
|
5
|
+
exports.Unknown = 'unknown';
|
|
6
|
+
/** The value resolved, but to data given inline rather than to a path (`matrix(0, 2, 2)`, `data.frame(a = 1)`). */
|
|
7
|
+
exports.Constant = 'constant';
|
|
8
|
+
/** What goes to the console rather than to a file: the standard output, and the standard error stream. */
|
|
9
|
+
exports.StdOut = 'stdout';
|
|
10
|
+
exports.StdErr = 'stderr';
|
|
11
|
+
/** The values naming a console stream rather than a file, see {@link StdOut} and {@link StdErr}. */
|
|
12
|
+
exports.ConsoleStreams = new Set([exports.StdOut, exports.StdErr]);
|
|
13
|
+
//# sourceMappingURL=dependency-values.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RemoteFunctions = void 0;
|
|
4
4
|
exports.remoteTarget = remoteTarget;
|
|
5
|
-
const
|
|
5
|
+
const dependency_values_1 = require("../dependency-values");
|
|
6
6
|
/**
|
|
7
7
|
* The installers that fetch a package from somewhere other than a configured CRAN-like repository, with the
|
|
8
8
|
* argument naming what they fetch: a `user/repo` slug for the forge installers, a url or path for the rest.
|
|
@@ -31,7 +31,7 @@ const RemoteRevision = /[@#](?<revision>[^/]+)$/;
|
|
|
31
31
|
* `undefined` for a value that never resolved, which names nothing.
|
|
32
32
|
*/
|
|
33
33
|
function remoteTarget(value) {
|
|
34
|
-
if (value === undefined || value ===
|
|
34
|
+
if (value === undefined || value === dependency_values_1.Unknown || value === dependency_values_1.Constant || value.length === 0) {
|
|
35
35
|
return undefined;
|
|
36
36
|
}
|
|
37
37
|
const revision = RemoteRevision.exec(value)?.groups?.revision;
|
|
@@ -4,6 +4,7 @@ exports.writeFunctions = void 0;
|
|
|
4
4
|
exports.computeWriteFunctions = computeWriteFunctions;
|
|
5
5
|
exports.writeFunctionsOf = writeFunctionsOf;
|
|
6
6
|
const function_info_1 = require("./function-info");
|
|
7
|
+
const dependency_values_1 = require("../dependency-values");
|
|
7
8
|
const built_in_props_1 = require("../../../../dataflow/environments/built-in-props");
|
|
8
9
|
const derived_functions_1 = require("./derived-functions");
|
|
9
10
|
const other_path_functions_1 = require("./other-path-functions");
|
|
@@ -26,7 +27,7 @@ const WriteFunctionsWithMore = [
|
|
|
26
27
|
argIdx: 2,
|
|
27
28
|
argName: 'outFile',
|
|
28
29
|
resolveValue: true,
|
|
29
|
-
defaultValue:
|
|
30
|
+
defaultValue: dependency_values_1.StdErr,
|
|
30
31
|
ignoreIf: 'arg-true',
|
|
31
32
|
additionalArgs: {
|
|
32
33
|
val: { argIdx: 1, argName: 'silent' }
|
|
@@ -38,12 +39,12 @@ const WriteFunctionsWithMore = [
|
|
|
38
39
|
{ package: 'graphics', name: 'stem', linkTo: OutputRedirects, resolveValue: false },
|
|
39
40
|
{ package: 'base', name: 'cat', linkTo: OutputRedirects, argName: 'file', resolveValue: true },
|
|
40
41
|
/* conditions and messages go to the message stream, which is stderr */
|
|
41
|
-
{ package: 'base', name: 'message', linkTo: OutputRedirects, resolveValue: false, defaultValue:
|
|
42
|
-
{ package: 'base', name: 'warning', linkTo: OutputRedirects, resolveValue: false, defaultValue:
|
|
43
|
-
{ package: 'rlang', name: 'warn', linkTo: OutputRedirects, resolveValue: false, defaultValue:
|
|
44
|
-
{ package: 'rlang', name: 'inform', linkTo: OutputRedirects, resolveValue: false, defaultValue:
|
|
45
|
-
{ package: 'cli', name: 'cli_warn', linkTo: OutputRedirects, resolveValue: false, defaultValue:
|
|
46
|
-
{ package: 'cli', name: 'cli_abort', linkTo: OutputRedirects, resolveValue: false, defaultValue:
|
|
42
|
+
{ package: 'base', name: 'message', linkTo: OutputRedirects, resolveValue: false, defaultValue: dependency_values_1.StdErr },
|
|
43
|
+
{ package: 'base', name: 'warning', linkTo: OutputRedirects, resolveValue: false, defaultValue: dependency_values_1.StdErr },
|
|
44
|
+
{ package: 'rlang', name: 'warn', linkTo: OutputRedirects, resolveValue: false, defaultValue: dependency_values_1.StdErr },
|
|
45
|
+
{ package: 'rlang', name: 'inform', linkTo: OutputRedirects, resolveValue: false, defaultValue: dependency_values_1.StdErr },
|
|
46
|
+
{ package: 'cli', name: 'cli_warn', linkTo: OutputRedirects, resolveValue: false, defaultValue: dependency_values_1.StdErr },
|
|
47
|
+
{ package: 'cli', name: 'cli_abort', linkTo: OutputRedirects, resolveValue: false, defaultValue: dependency_values_1.StdErr },
|
|
47
48
|
/* `output = "default"` shows the table where R prints */
|
|
48
49
|
{ package: 'modelsummary', name: 'modelsummary', argIdx: 1, argName: 'output', resolveValue: true, stringReplacements: { default: 'stdout' } },
|
|
49
50
|
{ package: 'modelsummary', name: 'msummary', argIdx: 1, argName: 'output', resolveValue: true, stringReplacements: { default: 'stdout' } },
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.collectImplicitEchoes = collectImplicitEchoes;
|
|
4
4
|
const r_function_call_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
5
5
|
const function_semantics_1 = require("../../../dataflow/fn/function-semantics");
|
|
6
|
+
const dependency_values_1 = require("./dependency-values");
|
|
6
7
|
const identifier_1 = require("../../../dataflow/environments/identifier");
|
|
7
8
|
const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
|
|
8
9
|
const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
|
|
@@ -161,7 +162,7 @@ function collectImplicitEchoes(ast, dataflow, accountedFor, invisible, result) {
|
|
|
161
162
|
continue;
|
|
162
163
|
}
|
|
163
164
|
const inputs = (0, data_flow_1.inputVariablesAt)(dataflow, ast, echoed.info.id);
|
|
164
|
-
result.push({ nodeId: echoed.info.id, functionName: echoName(echoed, dataflow), value:
|
|
165
|
+
result.push({ nodeId: echoed.info.id, functionName: echoName(echoed, dataflow), value: dependency_values_1.StdOut, implicit: true, inputVariables: inputs.length > 0 ? inputs : undefined });
|
|
165
166
|
}
|
|
166
167
|
}
|
|
167
168
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { DependencyInfo } from './dependencies-query-format';
|
|
2
2
|
import type { ReadOnlyFlowrAnalyzerContext } from '../../../project/context/flowr-analyzer-context';
|
|
3
3
|
import type { QueryRun } from './dependencies-query-executor';
|
|
4
4
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.describePlots = describePlots;
|
|
4
|
-
const
|
|
4
|
+
const dependency_values_1 = require("./dependency-values");
|
|
5
5
|
const vertex_1 = require("../../../dataflow/graph/vertex");
|
|
6
6
|
const edge_1 = require("../../../dataflow/graph/edge");
|
|
7
7
|
const identifier_1 = require("../../../dataflow/environments/identifier");
|
|
@@ -16,7 +16,7 @@ const TitleArguments = {
|
|
|
16
16
|
};
|
|
17
17
|
const DefaultTitleArgument = { argName: 'main' };
|
|
18
18
|
function isResolved(value) {
|
|
19
|
-
return value !== undefined && value !==
|
|
19
|
+
return value !== undefined && value !== dependency_values_1.Unknown && value !== dependency_values_1.Constant;
|
|
20
20
|
}
|
|
21
21
|
function titleOf(call, { dataflow, config, formals }, ctx) {
|
|
22
22
|
/* a call handed nothing states no title */
|
|
@@ -5,7 +5,7 @@ import type { ParsedQueryLine } from '../../query';
|
|
|
5
5
|
import Joi from 'joi';
|
|
6
6
|
import { executeDiceQuery } from './dice-query-executor';
|
|
7
7
|
import type { ReplOutput } from '../../../cli/repl/commands/repl-main';
|
|
8
|
-
import type { CommandCompletions } from '../../../cli/repl/
|
|
8
|
+
import type { CommandCompletions } from '../../../cli/repl/completion';
|
|
9
9
|
import type { FlowrConfig } from '../../../config';
|
|
10
10
|
import { type SliceQueryOptions } from '../slice-query-options';
|
|
11
11
|
/**
|
|
@@ -6,7 +6,7 @@ import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/nod
|
|
|
6
6
|
import { FileRole } from '../../../project/context/flowr-file';
|
|
7
7
|
import type { ReplOutput } from '../../../cli/repl/commands/repl-main';
|
|
8
8
|
import type { FlowrConfig } from '../../../config';
|
|
9
|
-
import type { CommandCompletions } from '../../../cli/repl/
|
|
9
|
+
import type { CommandCompletions } from '../../../cli/repl/completion';
|
|
10
10
|
/**
|
|
11
11
|
* Returns the content(s) of all files matching the given pattern.
|
|
12
12
|
*/
|
|
@@ -8,7 +8,7 @@ import { type ConfiguredLintingRule, LintingResultCertainty } from '../../../lin
|
|
|
8
8
|
import { type OutputFormatter } from '../../../util/text/ansi';
|
|
9
9
|
import type { FlowrConfig } from '../../../config';
|
|
10
10
|
import type { ReplOutput } from '../../../cli/repl/commands/repl-main';
|
|
11
|
-
import type { CommandCompletions } from '../../../cli/repl/
|
|
11
|
+
import type { CommandCompletions } from '../../../cli/repl/completion';
|
|
12
12
|
import { type LintResultsByRule, LinterOutputFormat } from '../../../linter/linter-output';
|
|
13
13
|
export interface LinterQuery extends BaseQueryFormat {
|
|
14
14
|
readonly type: 'linter';
|
|
@@ -39,7 +39,7 @@ export declare const LinterQueryDefinition: {
|
|
|
39
39
|
readonly completer: typeof linterQueryCompleter;
|
|
40
40
|
readonly fromLine: typeof linterQueryLineParser;
|
|
41
41
|
readonly syntax: "@linter [rules:<r1>,<r2>,...] [tags:<t1>,...] [format:<fmt>] <code | file://path>";
|
|
42
|
-
readonly schema: Joi.ObjectSchema
|
|
42
|
+
readonly schema: Joi.ObjectSchema;
|
|
43
43
|
readonly flattenInvolvedNodes: (queryResults: BaseQueryResult, _queries: readonly import("../../query").Query[], certainty: LintingResultCertainty | undefined) => ((string & {
|
|
44
44
|
__brand?: "node-id";
|
|
45
45
|
}) | (number & {
|
|
@@ -104,6 +104,7 @@ function linterQueryCompleter(line, startingNewArg, _config) {
|
|
|
104
104
|
retriever_1.fileProtocol
|
|
105
105
|
] };
|
|
106
106
|
}
|
|
107
|
+
let linterQuerySchema;
|
|
107
108
|
exports.LinterQueryDefinition = {
|
|
108
109
|
title: 'Linter Query',
|
|
109
110
|
executor: linter_query_executor_1.executeLinterQuery,
|
|
@@ -146,15 +147,18 @@ exports.LinterQueryDefinition = {
|
|
|
146
147
|
completer: linterQueryCompleter,
|
|
147
148
|
fromLine: linterQueryLineParser,
|
|
148
149
|
syntax: '@linter [rules:<r1>,<r2>,...] [tags:<t1>,...] [format:<fmt>] <code | file://path>',
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
150
|
+
/* built on first use, as the rules are not yet known while this module loads */
|
|
151
|
+
get schema() {
|
|
152
|
+
return linterQuerySchema ??= joi_1.default.object({
|
|
153
|
+
type: joi_1.default.string().valid('linter').required().description('The type of the query.'),
|
|
154
|
+
format: joi_1.default.string().valid(...Object.values(linter_output_1.LinterOutputFormat)).optional().description('Print the findings in a machine-readable format instead of the human-readable summary.'),
|
|
155
|
+
rules: joi_1.default.array().items(joi_1.default.string().valid(...Object.keys(linter_rules_1.LintingRules)), joi_1.default.object({
|
|
156
|
+
name: joi_1.default.string().valid(...Object.keys(linter_rules_1.LintingRules)).required(),
|
|
157
|
+
config: joi_1.default.object()
|
|
158
|
+
})).description('The rules to lint for. If unset, all rules will be included.'),
|
|
159
|
+
tags: joi_1.default.array().items(joi_1.default.string().valid(...Object.values(linter_tags_1.LintingRuleTag))).optional().description('Lint for every rule carrying one of these tags, e.g. cmd-check for the R CMD check rules.')
|
|
160
|
+
}).description('The linter query lints for the given set of rules and returns the result.');
|
|
161
|
+
},
|
|
158
162
|
flattenInvolvedNodes: (queryResults, _queries, certainty) => {
|
|
159
163
|
const out = queryResults;
|
|
160
164
|
return Object.values(out.results).flatMap(v => {
|