@eagleoutice/flowr 2.16.3 → 2.16.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 +14 -14
- package/dataflow/environments/query-fn-props.js +2 -1
- package/dataflow/eval/resolve/resolve.js +2 -6
- package/documentation/doc-util/doc-query.d.ts +1 -1
- package/documentation/doc-util/doc-query.js +3 -1
- package/documentation/doc-util/doc-timings.js +3 -2
- package/documentation/wiki-create-linting-rules.js +1 -1
- package/documentation/wiki-linter.d.ts +14 -0
- package/documentation/wiki-linter.js +341 -126
- package/linter/linter-rules.d.ts +47 -47
- package/linter/rules/absolute-path.d.ts +1 -1
- package/linter/rules/absolute-path.js +6 -4
- package/linter/rules/cmd-check/call-arguments.d.ts +1 -1
- package/linter/rules/cmd-check/call-arguments.js +10 -5
- package/linter/rules/cmd-check/compiled-code.d.ts +1 -1
- package/linter/rules/cmd-check/compiled-code.js +1 -1
- package/linter/rules/cmd-check/conformance.d.ts +5 -1
- package/linter/rules/cmd-check/conformance.js +64 -64
- package/linter/rules/cmd-check/description-metadata.d.ts +1 -1
- package/linter/rules/cmd-check/description-metadata.js +1 -1
- package/linter/rules/cmd-check/documentation-mismatch.d.ts +6 -0
- package/linter/rules/cmd-check/foreign-function-calls.d.ts +1 -1
- package/linter/rules/cmd-check/foreign-function-calls.js +1 -1
- package/linter/rules/cmd-check/namespace-tampering.d.ts +1 -1
- package/linter/rules/cmd-check/namespace-tampering.js +1 -1
- package/linter/rules/cmd-check/non-ascii-code.d.ts +1 -1
- package/linter/rules/cmd-check/non-ascii-code.js +1 -1
- package/linter/rules/cmd-check/package-data.d.ts +3 -1
- package/linter/rules/cmd-check/package-data.js +1 -1
- package/linter/rules/cmd-check/package-hooks.d.ts +2 -2
- package/linter/rules/cmd-check/package-hooks.js +13 -5
- package/linter/rules/cmd-check/package-metafiles.d.ts +1 -1
- package/linter/rules/cmd-check/package-metafiles.js +1 -1
- package/linter/rules/cmd-check/package-structure.d.ts +1 -1
- package/linter/rules/cmd-check/package-structure.js +1 -1
- package/linter/rules/cmd-check/rd-files.d.ts +17 -1
- package/linter/rules/cmd-check/rd-files.js +1 -1
- package/linter/rules/cmd-check/true-false-abbreviation.d.ts +1 -1
- package/linter/rules/cmd-check/true-false-abbreviation.js +1 -1
- package/linter/rules/dataframe-access-validation.d.ts +1 -1
- package/linter/rules/dataframe-access-validation.js +1 -1
- package/linter/rules/dead-code.d.ts +4 -4
- package/linter/rules/dead-code.js +19 -4
- package/linter/rules/deprecated-functions.d.ts +1 -1
- package/linter/rules/deprecated-functions.js +1 -1
- package/linter/rules/file-path-validity.d.ts +6 -2
- package/linter/rules/file-path-validity.js +7 -3
- package/linter/rules/namespace-access.d.ts +3 -3
- package/linter/rules/namespace-access.js +12 -3
- package/linter/rules/naming-convention.d.ts +1 -1
- package/linter/rules/naming-convention.js +1 -1
- package/linter/rules/network-functions.d.ts +1 -1
- package/linter/rules/network-functions.js +1 -1
- package/linter/rules/no-leaked-credentials.d.ts +1 -1
- package/linter/rules/no-leaked-credentials.js +1 -1
- package/linter/rules/problematic-inputs.d.ts +2 -2
- package/linter/rules/problematic-inputs.js +2 -2
- package/linter/rules/roxygen-arguments.d.ts +2 -2
- package/linter/rules/roxygen-arguments.js +2 -2
- package/linter/rules/seeded-randomness.d.ts +2 -2
- package/linter/rules/seeded-randomness.js +2 -2
- package/linter/rules/software-has-license.d.ts +2 -2
- package/linter/rules/software-has-license.js +2 -2
- package/linter/rules/software-has-tests.d.ts +2 -2
- package/linter/rules/software-has-tests.js +2 -2
- package/linter/rules/stop-with-call-arg.d.ts +3 -3
- package/linter/rules/stop-with-call-arg.js +21 -4
- package/linter/rules/syntactically-valid.d.ts +1 -1
- package/linter/rules/syntactically-valid.js +1 -1
- package/linter/rules/unclosed-connection.d.ts +2 -2
- package/linter/rules/unclosed-connection.js +2 -2
- package/linter/rules/undefined-symbol.d.ts +1 -1
- package/linter/rules/undefined-symbol.js +1 -1
- package/linter/rules/unescaped-arguments.d.ts +1 -1
- package/linter/rules/unescaped-arguments.js +1 -1
- package/linter/rules/unused-definition.d.ts +1 -1
- package/linter/rules/unused-definition.js +1 -1
- package/linter/rules/unused-import.d.ts +1 -1
- package/linter/rules/unused-import.js +1 -1
- package/linter/rules/useless-loop.d.ts +1 -1
- package/linter/rules/useless-loop.js +1 -1
- package/package.json +1 -1
- package/project/context/flowr-analyzer-environment-context.d.ts +1 -1
- package/project/context/flowr-analyzer-environment-context.js +2 -1
- package/project/context/flowr-analyzer-files-context.js +12 -11
- package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.js +1 -1
- package/queries/catalog/dependencies-query/data-flow.d.ts +2 -0
- package/queries/catalog/dependencies-query/data-flow.js +6 -0
- package/queries/catalog/dependencies-query/implicit-echo.js +3 -1
- package/util/version.js +2 -2
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ It offers a wide variety of features, for example:
|
|
|
38
38
|
|
|
39
39
|
```shell
|
|
40
40
|
$ docker run -it --rm eagleoutice/flowr # or npm run flowr
|
|
41
|
-
flowR repl v2.16.
|
|
41
|
+
flowR repl v2.16.3, R grammar v14 (tree-sitter engine)
|
|
42
42
|
R> :query @linter "read.csv(\"/root/x.txt\")"
|
|
43
43
|
```
|
|
44
44
|
|
|
@@ -46,7 +46,7 @@ It offers a wide variety of features, for example:
|
|
|
46
46
|
<summary style='color:gray'>Output</summary>
|
|
47
47
|
|
|
48
48
|
```text
|
|
49
|
-
Query: linter (
|
|
49
|
+
Query: linter (18 ms)
|
|
50
50
|
╰ Deprecated Functions (deprecated-functions): no findings
|
|
51
51
|
╰ File Path Validity (file-path-validity): no findings
|
|
52
52
|
╰ Seeded Randomness (seeded-randomness): no findings
|
|
@@ -56,8 +56,8 @@ It offers a wide variety of features, for example:
|
|
|
56
56
|
╰ Dataframe Access Validation (dataframe-access-validation): no findings
|
|
57
57
|
╰ Dead Code (dead-code): no findings
|
|
58
58
|
╰ Useless Loops (useless-loop): no findings
|
|
59
|
-
╰ Problematic
|
|
60
|
-
╰ Stop
|
|
59
|
+
╰ Problematic Inputs (problematic-inputs): no findings
|
|
60
|
+
╰ Stop Without Call (stop-call): no findings
|
|
61
61
|
╰ Roxygen Arguments (roxygen-arguments): no findings
|
|
62
62
|
╰ No Leaked Credentials (no-leaked-credentials): no findings
|
|
63
63
|
╰ Undefined Symbol (undefined-symbol): no findings
|
|
@@ -65,7 +65,7 @@ It offers a wide variety of features, for example:
|
|
|
65
65
|
╰ Unclosed Connection (unclosed-connection): no findings
|
|
66
66
|
╰ Unescaped Arguments (unescaped-arguments): no findings
|
|
67
67
|
╰ Namespace Access Validity (namespace-access): no findings
|
|
68
|
-
All queries together required ≈
|
|
68
|
+
All queries together required ≈18 ms (1ms accuracy, total 18 ms)
|
|
69
69
|
```
|
|
70
70
|
|
|
71
71
|
The linter will analyze the code and return any issues found.
|
|
@@ -79,7 +79,7 @@ It offers a wide variety of features, for example:
|
|
|
79
79
|
|
|
80
80
|
_Results (prettified and summarized):_
|
|
81
81
|
|
|
82
|
-
Query: **linter** (
|
|
82
|
+
Query: **linter** (30 ms)\
|
|
83
83
|
╰ **Deprecated Functions** (deprecated-functions): _no findings_\
|
|
84
84
|
╰ **File Path Validity** (file-path-validity):\
|
|
85
85
|
╰ certain:\
|
|
@@ -93,8 +93,8 @@ It offers a wide variety of features, for example:
|
|
|
93
93
|
╰ **Dataframe Access Validation** (dataframe-access-validation): _no findings_\
|
|
94
94
|
╰ **Dead Code** (dead-code): _no findings_\
|
|
95
95
|
╰ **Useless Loops** (useless-loop): _no findings_\
|
|
96
|
-
╰ **Problematic
|
|
97
|
-
╰ **Stop
|
|
96
|
+
╰ **Problematic Inputs** (problematic-inputs): _no findings_\
|
|
97
|
+
╰ **Stop Without Call** (stop-call): _no findings_\
|
|
98
98
|
╰ **Roxygen Arguments** (roxygen-arguments): _no findings_\
|
|
99
99
|
╰ **No Leaked Credentials** (no-leaked-credentials): _no findings_\
|
|
100
100
|
╰ **Undefined Symbol** (undefined-symbol): _no findings_\
|
|
@@ -102,7 +102,7 @@ It offers a wide variety of features, for example:
|
|
|
102
102
|
╰ **Unclosed Connection** (unclosed-connection): _no findings_\
|
|
103
103
|
╰ **Unescaped Arguments** (unescaped-arguments): _no findings_\
|
|
104
104
|
╰ **Namespace Access Validity** (namespace-access): _no findings_\
|
|
105
|
-
_All queries together required ≈
|
|
105
|
+
_All queries together required ≈30 ms (1ms accuracy, total 30 ms)_
|
|
106
106
|
|
|
107
107
|
<details> <summary style="color:gray">Show Detailed Results as Json</summary>
|
|
108
108
|
|
|
@@ -139,7 +139,7 @@ It offers a wide variety of features, for example:
|
|
|
139
139
|
".meta": {
|
|
140
140
|
"totalFunctionCalls": 1,
|
|
141
141
|
"totalVariableUses": 0,
|
|
142
|
-
"suppressed": {"installed":0,"loadedPackage":0,"enclosingScope":0,"nonStandardEval":0,"subscript":0,"unresolvedLibrary":0}
|
|
142
|
+
"suppressed": {"installed":0,"loadedPackage":0,"enclosingScope":0,"nonStandardEval":0,"subscript":0,"unresolvedLibrary":0,"declaredGlobal":0}
|
|
143
143
|
}
|
|
144
144
|
},
|
|
145
145
|
"unused-import": {"results":[],".meta":{"totalConsidered":0,"totalUnresolved":0,"totalMultiPackage":0,"totalUnused":0}},
|
|
@@ -193,7 +193,7 @@ It offers a wide variety of features, for example:
|
|
|
193
193
|
|
|
194
194
|
```shell
|
|
195
195
|
$ docker run -it --rm eagleoutice/flowr # or npm run flowr
|
|
196
|
-
flowR repl v2.16.
|
|
196
|
+
flowR repl v2.16.3, R grammar v14 (tree-sitter engine)
|
|
197
197
|
R> :query @static-slice (11@sum) file://test/testfiles/example.R
|
|
198
198
|
```
|
|
199
199
|
|
|
@@ -206,7 +206,7 @@ It offers a wide variety of features, for example:
|
|
|
206
206
|
N <- 10
|
|
207
207
|
for(i in 1:(N-1)) sum <- sum + i + w
|
|
208
208
|
sum
|
|
209
|
-
All queries together required ≈
|
|
209
|
+
All queries together required ≈6 ms (1ms accuracy, total 6 ms)
|
|
210
210
|
```
|
|
211
211
|
|
|
212
212
|
</details>
|
|
@@ -214,7 +214,7 @@ It offers a wide variety of features, for example:
|
|
|
214
214
|
</details>
|
|
215
215
|
|
|
216
216
|
* 🚀 **fast call-graph, data-, and control-flow graphs**\
|
|
217
|
-
Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">
|
|
217
|
+
Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">137.3 ms</span></i> (as of Oct 19, 2026)](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark),
|
|
218
218
|
_flowR_ can analyze the data- and control-flow of the average real-world R script. See the [benchmarks](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark) for more information,
|
|
219
219
|
and consult the [wiki pages](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph) for more details on the [dataflow graphs](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph) as well as [call graphs](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph#perspectives-cg).
|
|
220
220
|
( [▶ Explore in Browser](https://flowr-analysis.github.io/flowr/wiki/playground/#c=zDYSwRgTghhCeAUATADsWECUAoLBnAxlMAKYD6ALgPakC2UAHgAQA8AtIwGYCuAdvuSEo949DIyYB6RnXojsWaAHdGKlW0aIo5KADoO0GsXghEjALyMAjAC4AbABpGANyJdi5xvngBmRwA5HAHZHACZHAE5HABYMbHwSKB5VdQ4QYHJiCHglRxdgN0YAPkYQuISeABICImJTdWqSCmoZeHjiRIq8t3lcLho6OFJcbXJcFnZe-pgQXCM2xMdDRI8l4Qba2KxeLlnEJu1gNQm%2B7KhFTtdieUUIEAydfFwneEmB2CGR3EcAIleYWAeT2%2B2FQlHIrXKVUIJEQIMoIB4owh7UqJgwQA&p=13:1 "run this script in flowR's playground, no setup") )
|
|
@@ -245,7 +245,7 @@ It offers a wide variety of features, for example:
|
|
|
245
245
|
|
|
246
246
|
```shell
|
|
247
247
|
$ docker run -it --rm eagleoutice/flowr # or npm run flowr
|
|
248
|
-
flowR repl v2.16.
|
|
248
|
+
flowR repl v2.16.3, R grammar v14 (tree-sitter engine)
|
|
249
249
|
R> :dataflow* test/testfiles/example.R
|
|
250
250
|
```
|
|
251
251
|
|
|
@@ -35,7 +35,8 @@ function statedBuiltIn(definition, environment) {
|
|
|
35
35
|
return undefined;
|
|
36
36
|
}
|
|
37
37
|
const [pkg, fn] = pkgFn;
|
|
38
|
-
const
|
|
38
|
+
const builtIn = environment_1.REnvironment.findBuiltIn(environment.current);
|
|
39
|
+
const known = (builtIn.namespaces?.get(pkg)?.get(fn) ?? builtIn.memory.get(fn))
|
|
39
40
|
?.filter(d => d.type === identifier_1.ReferenceType.BuiltInFunction && identifier_1.Identifier.getNamespace(d.name ?? '') === pkg);
|
|
40
41
|
return known?.length ? known : undefined;
|
|
41
42
|
}
|
|
@@ -30,16 +30,12 @@ const r_expression_list_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/
|
|
|
30
30
|
*/
|
|
31
31
|
function evalHandlerOf(name, environment, ctx) {
|
|
32
32
|
/* without an environment the search path is unknown, so what a package states about the name has its say */
|
|
33
|
-
const defs = environment ? resolve_helper_1.Resolve.byNameAndType(name, environment, identifier_1.ReferenceType.BuiltInFunction) : builtInDefinitionsOf(name
|
|
33
|
+
const defs = environment ? resolve_helper_1.Resolve.byNameAndType(name, environment, identifier_1.ReferenceType.BuiltInFunction) : ctx.env.builtInDefinitionsOf(name);
|
|
34
34
|
const def = defs?.length === 1 ? defs[0] : undefined;
|
|
35
35
|
return def?.type === identifier_1.ReferenceType.BuiltInFunction ? def.evalHandler : undefined;
|
|
36
36
|
}
|
|
37
|
-
function builtInDefinitionsOf(name, ctx) {
|
|
38
|
-
return ctx.env.builtInEnvironment.memory.get(identifier_1.Identifier.getName(name))
|
|
39
|
-
?? ctx.env.statedDefinitionsOf(name);
|
|
40
|
-
}
|
|
41
37
|
function foldsThroughBuiltIn(name, ctx) {
|
|
42
|
-
return builtInDefinitionsOf(name
|
|
38
|
+
return ctx.env.builtInDefinitionsOf(name).some(d => d.type === identifier_1.ReferenceType.BuiltInFunction && d.evalHandler !== undefined);
|
|
43
39
|
}
|
|
44
40
|
/** the node types that may fold through a built-in: calls, operators, and the `(`/`{` groupings */
|
|
45
41
|
const EvalNodeTypes = [type_1.RType.FunctionCall, type_1.RType.BinaryOp, type_1.RType.UnaryOp, type_1.RType.ExpressionList];
|
|
@@ -12,7 +12,7 @@ export interface ShowQueryOptions {
|
|
|
12
12
|
readonly collapseQuery?: boolean;
|
|
13
13
|
readonly shorthand?: string;
|
|
14
14
|
readonly ctx?: GeneralDocContext;
|
|
15
|
-
/** additional in-memory files registered before the request, e.g. the targets of `source(...)` calls */
|
|
15
|
+
/** additional in-memory files registered before the request, e.g. the targets of `source(...)` calls; a `code` of `file://<name>` analyzes one of them */
|
|
16
16
|
readonly files?: readonly {
|
|
17
17
|
readonly name: string;
|
|
18
18
|
readonly content: string;
|
|
@@ -29,6 +29,7 @@ const query_print_1 = require("../../queries/query-print");
|
|
|
29
29
|
const flowr_analyzer_builder_1 = require("../../project/flowr-analyzer-builder");
|
|
30
30
|
const flowr_file_1 = require("../../project/context/flowr-file");
|
|
31
31
|
const doc_cli_option_1 = require("./doc-cli-option");
|
|
32
|
+
const retriever_1 = require("../../r-bridge/retriever");
|
|
32
33
|
const QueryDocFile = 'src/documentation/wiki-query.ts';
|
|
33
34
|
/**
|
|
34
35
|
* Visualizes a query and its results in markdown format.
|
|
@@ -41,7 +42,8 @@ async function showQuery(parser, code, queries, { showCode, collapseResult, coll
|
|
|
41
42
|
for (const file of files ?? []) {
|
|
42
43
|
analyzer.addFile(new flowr_file_1.FlowrInlineTextFile(file.name, file.content));
|
|
43
44
|
}
|
|
44
|
-
|
|
45
|
+
/* code naming one of the files above analyzes that file, as a package's code is analyzed */
|
|
46
|
+
analyzer.addRequest(files?.some(f => `${retriever_1.fileProtocol}${f.name}` === code) ? (0, retriever_1.requestFromInput)(code) : code);
|
|
45
47
|
const results = await analyzer.query(queries);
|
|
46
48
|
const duration = performance.now() - now;
|
|
47
49
|
const metaInfo = `
|
|
@@ -22,7 +22,7 @@ function docTook(ms) {
|
|
|
22
22
|
return exports.ShowDocTimings ? ` required _${(0, time_1.printAsMs)(ms)}_ and` : '';
|
|
23
23
|
}
|
|
24
24
|
const TimingPatterns = [
|
|
25
|
-
[/^(Query: [^\n(]*?) \([\d.]+ ?[a-zµ]+\)$/gm, '$1'],
|
|
25
|
+
[/^(Query: [^\n(]*?) \([\d.]+ ?[a-zµ]+\)(\\?)$/gm, '$1$2'],
|
|
26
26
|
[/^[^\n]*\bTook [\d.]+ ?[a-zµ]+[^\n]*\n?/gm, ''],
|
|
27
27
|
[/^_?All queries together required [^\n]*\n?/gm, ''],
|
|
28
28
|
[/^[^\n]*(?:searchTimeMs|processTimeMs): [\d.]+[^\n]*\n?/gm, ''],
|
|
@@ -39,6 +39,7 @@ function withoutTimings(text) {
|
|
|
39
39
|
if (exports.ShowDocTimings) {
|
|
40
40
|
return text;
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
/* a removed line leaves the markdown line break before it with no line to break to */
|
|
43
|
+
return TimingPatterns.reduce((t, [pattern, replacement]) => t.replace(pattern, replacement), text).replace(/\\(?=\n[ \t]*(?:\n|$))/g, '');
|
|
43
44
|
}
|
|
44
45
|
//# sourceMappingURL=doc-timings.js.map
|
|
@@ -80,7 +80,7 @@ After implementing the rule, register it by adding it to ${ctx.link('LintingRule
|
|
|
80
80
|
|
|
81
81
|
## Step 5: Add the rule to the linter wiki generation
|
|
82
82
|
|
|
83
|
-
After registering the rule, add
|
|
83
|
+
After registering the rule, add its entry to ${ctx.link('LintingRuleExamples')}: the names of its configuration and implementation types, its test file, and an example that produces a finding (and a quick fix, if the rule offers one). The compiler asks for an entry for every rule, and a test runs every example to check that it shows what it should. These entries generate the linter overview and the individual wiki pages for linting rules, which can then be inspected through ${ctx.linkPage('wiki/Linter')}.
|
|
84
84
|
|
|
85
85
|
## Step 6: Add tests for the rule
|
|
86
86
|
|
|
@@ -1,5 +1,19 @@
|
|
|
1
|
+
import { type LintingRuleNames } from '../linter/linter-rules';
|
|
1
2
|
import type { DocMakerArgs } from './wiki-mk/doc-maker';
|
|
2
3
|
import { DocMaker } from './wiki-mk/doc-maker';
|
|
4
|
+
/** an example that needs files besides its code shows them as a project, its code in `R/code.R` */
|
|
5
|
+
export interface PackageExample {
|
|
6
|
+
readonly code: string;
|
|
7
|
+
readonly files: Readonly<Record<string, string>>;
|
|
8
|
+
}
|
|
9
|
+
/** what the wiki shows for each linting rule: its configuration and implementation types, its tests, and an example with findings */
|
|
10
|
+
export declare const LintingRuleExamples: Readonly<Record<LintingRuleNames, {
|
|
11
|
+
readonly configType: string;
|
|
12
|
+
readonly ruleType: string;
|
|
13
|
+
readonly testfile: string;
|
|
14
|
+
readonly example: string | PackageExample;
|
|
15
|
+
readonly config?: object;
|
|
16
|
+
}>>;
|
|
3
17
|
/**
|
|
4
18
|
* https://github.com/flowr-analysis/flowr/wiki/Linter
|
|
5
19
|
*/
|