@eagleoutice/flowr 2.4.8 → 2.6.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/README.md +66 -45
- package/benchmark/slicer.js +1 -1
- package/benchmark/summarizer/second-phase/graph.js +2 -2
- package/cli/flowr.js +3 -29
- package/cli/repl/commands/repl-cfg.d.ts +5 -5
- package/cli/repl/commands/repl-cfg.js +21 -22
- package/cli/repl/commands/repl-commands.d.ts +3 -3
- package/cli/repl/commands/repl-commands.js +2 -0
- package/cli/repl/commands/repl-dataflow.d.ts +5 -5
- package/cli/repl/commands/repl-dataflow.js +27 -30
- package/cli/repl/commands/repl-execute.js +1 -0
- package/cli/repl/commands/repl-lineage.js +1 -0
- package/cli/repl/commands/repl-main.d.ts +34 -3
- package/cli/repl/commands/repl-normalize.d.ts +3 -3
- package/cli/repl/commands/repl-normalize.js +15 -19
- package/cli/repl/commands/repl-parse.d.ts +2 -2
- package/cli/repl/commands/repl-parse.js +13 -8
- package/cli/repl/commands/repl-query.d.ts +3 -3
- package/cli/repl/commands/repl-query.js +29 -19
- package/cli/repl/commands/repl-quit.js +1 -0
- package/cli/repl/commands/repl-version.js +1 -0
- package/cli/repl/core.d.ts +4 -1
- package/cli/repl/core.js +21 -1
- package/cli/repl/server/connection.d.ts +7 -3
- package/cli/repl/server/connection.js +40 -48
- package/cli/repl/server/messages/message-slice.d.ts +1 -1
- package/cli/slicer-app.js +8 -3
- package/config.d.ts +1 -1
- package/config.js +4 -1
- package/control-flow/extract-cfg.d.ts +1 -1
- package/control-flow/extract-cfg.js +1 -1
- package/core/pipeline-executor.d.ts +5 -0
- package/core/pipeline-executor.js +5 -0
- package/core/steps/pipeline/create-pipeline.js +1 -1
- package/core/steps/pipeline/default-pipelines.d.ts +42 -42
- package/core/steps/pipeline/default-pipelines.js +4 -1
- package/dataflow/graph/dataflowgraph-builder.d.ts +11 -12
- package/dataflow/graph/dataflowgraph-builder.js +6 -6
- package/documentation/doc-util/doc-query.d.ts +3 -6
- package/documentation/doc-util/doc-query.js +5 -17
- package/documentation/doc-util/doc-search.js +7 -10
- package/documentation/doc-util/doc-structure.d.ts +4 -0
- package/documentation/doc-util/doc-structure.js +28 -0
- package/documentation/doc-util/doc-types.d.ts +5 -1
- package/documentation/doc-util/doc-types.js +29 -3
- package/documentation/print-analyzer-wiki.d.ts +1 -0
- package/documentation/print-analyzer-wiki.js +137 -0
- package/documentation/print-core-wiki.d.ts +2 -1
- package/documentation/print-core-wiki.js +58 -4
- package/documentation/print-dataflow-graph-wiki.js +15 -22
- package/documentation/print-interface-wiki.js +18 -1
- package/documentation/print-linter-wiki.js +5 -1
- package/documentation/print-linting-and-testing-wiki.js +4 -0
- package/documentation/print-normalized-ast-wiki.js +6 -8
- package/documentation/print-readme.js +6 -0
- package/engines.d.ts +9 -0
- package/engines.js +38 -0
- package/linter/linter-executor.d.ts +2 -8
- package/linter/linter-executor.js +9 -4
- package/linter/linter-format.d.ts +8 -9
- package/linter/linter-rules.d.ts +57 -15
- package/linter/linter-rules.js +2 -0
- package/linter/rules/absolute-path.d.ts +1 -0
- package/linter/rules/dataframe-access-validation.d.ts +4 -3
- package/linter/rules/dataframe-access-validation.js +7 -4
- package/linter/rules/dead-code.d.ts +2 -1
- package/linter/rules/deprecated-functions.d.ts +15 -28
- package/linter/rules/deprecated-functions.js +5 -43
- package/linter/rules/file-path-validity.d.ts +2 -1
- package/linter/rules/file-path-validity.js +1 -1
- package/linter/rules/function-finder-util.d.ts +51 -0
- package/linter/rules/function-finder-util.js +77 -0
- package/linter/rules/naming-convention.d.ts +2 -1
- package/linter/rules/network-functions.d.ts +40 -0
- package/linter/rules/network-functions.js +24 -0
- package/linter/rules/seeded-randomness.d.ts +2 -1
- package/linter/rules/unused-definition.d.ts +2 -1
- package/linter/rules/useless-loop.d.ts +3 -2
- package/linter/rules/useless-loop.js +4 -6
- package/package.json +5 -1
- package/project/cache/flowr-analyzer-cache.d.ts +93 -0
- package/project/cache/flowr-analyzer-cache.js +156 -0
- package/project/cache/flowr-cache.d.ts +28 -0
- package/project/cache/flowr-cache.js +49 -0
- package/project/context/abstract-flowr-analyzer-context.d.ts +35 -0
- package/project/context/abstract-flowr-analyzer-context.js +46 -0
- package/project/context/flowr-analyzer-context.d.ts +48 -0
- package/project/context/flowr-analyzer-context.js +47 -0
- package/project/context/flowr-analyzer-dependencies-context.d.ts +38 -0
- package/project/context/flowr-analyzer-dependencies-context.js +39 -0
- package/project/context/flowr-analyzer-files-context.d.ts +86 -0
- package/project/context/flowr-analyzer-files-context.js +130 -0
- package/project/context/flowr-analyzer-loading-order-context.d.ts +76 -0
- package/project/context/flowr-analyzer-loading-order-context.js +90 -0
- package/project/context/flowr-file.d.ts +89 -0
- package/project/context/flowr-file.js +78 -0
- package/project/flowr-analyzer-builder.d.ts +106 -0
- package/project/flowr-analyzer-builder.js +197 -0
- package/project/flowr-analyzer.d.ts +125 -0
- package/project/flowr-analyzer.js +81 -0
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +17 -0
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +28 -0
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +21 -0
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +34 -0
- package/project/plugins/file-plugins/flowr-description-file.d.ts +24 -0
- package/project/plugins/file-plugins/flowr-description-file.js +38 -0
- package/project/plugins/flowr-analyzer-plugin.d.ts +90 -0
- package/project/plugins/flowr-analyzer-plugin.js +82 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.d.ts +14 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +56 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.d.ts +13 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.js +33 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +14 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +41 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +10 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +29 -0
- package/project/plugins/package-version-plugins/package.d.ts +15 -0
- package/project/plugins/package-version-plugins/package.js +56 -0
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.d.ts +15 -0
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +44 -0
- package/queries/base-query-format.d.ts +2 -8
- package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -1
- package/queries/catalog/call-context-query/call-context-query-executor.js +20 -13
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +2 -3
- package/queries/catalog/call-context-query/call-context-query-format.js +2 -2
- package/queries/catalog/cluster-query/cluster-query-executor.d.ts +1 -1
- package/queries/catalog/cluster-query/cluster-query-executor.js +2 -2
- package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -54
- package/queries/catalog/cluster-query/cluster-query-format.js +2 -2
- package/queries/catalog/config-query/config-query-executor.d.ts +1 -1
- package/queries/catalog/config-query/config-query-executor.js +5 -5
- package/queries/catalog/config-query/config-query-format.d.ts +1 -1
- package/queries/catalog/config-query/config-query-format.js +1 -1
- package/queries/catalog/control-flow-query/control-flow-query-executor.d.ts +1 -1
- package/queries/catalog/control-flow-query/control-flow-query-executor.js +2 -3
- package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -54
- package/queries/catalog/control-flow-query/control-flow-query-format.js +2 -2
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.d.ts +1 -1
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +2 -2
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -54
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +1 -1
- package/queries/catalog/dataflow-query/dataflow-query-executor.d.ts +1 -1
- package/queries/catalog/dataflow-query/dataflow-query-executor.js +2 -2
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -54
- package/queries/catalog/dataflow-query/dataflow-query-format.js +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +19 -12
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +7 -56
- package/queries/catalog/dependencies-query/dependencies-query-format.js +7 -4
- package/queries/catalog/df-shape-query/df-shape-query-executor.d.ts +1 -1
- package/queries/catalog/df-shape-query/df-shape-query-executor.js +4 -4
- package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +1 -54
- package/queries/catalog/df-shape-query/df-shape-query-format.js +1 -1
- package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +1 -1
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -1
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -54
- package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -1
- package/queries/catalog/id-map-query/id-map-query-executor.d.ts +1 -1
- package/queries/catalog/id-map-query/id-map-query-executor.js +2 -2
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -54
- package/queries/catalog/id-map-query/id-map-query-format.js +2 -2
- package/queries/catalog/lineage-query/lineage-query-executor.d.ts +1 -1
- package/queries/catalog/lineage-query/lineage-query-executor.js +2 -2
- package/queries/catalog/lineage-query/lineage-query-format.d.ts +1 -54
- package/queries/catalog/lineage-query/lineage-query-format.js +1 -1
- package/queries/catalog/linter-query/linter-query-executor.d.ts +1 -1
- package/queries/catalog/linter-query/linter-query-executor.js +2 -3
- package/queries/catalog/linter-query/linter-query-format.d.ts +1 -54
- package/queries/catalog/linter-query/linter-query-format.js +1 -1
- package/queries/catalog/location-map-query/location-map-query-executor.d.ts +1 -1
- package/queries/catalog/location-map-query/location-map-query-executor.js +3 -2
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
- package/queries/catalog/location-map-query/location-map-query-format.js +1 -1
- package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.d.ts +1 -1
- package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +2 -2
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -54
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +1 -1
- package/queries/catalog/origin-query/origin-query-executor.d.ts +2 -2
- package/queries/catalog/origin-query/origin-query-executor.js +3 -3
- package/queries/catalog/origin-query/origin-query-format.d.ts +1 -54
- package/queries/catalog/origin-query/origin-query-format.js +1 -1
- package/queries/catalog/project-query/project-query-executor.d.ts +1 -1
- package/queries/catalog/project-query/project-query-executor.js +2 -2
- package/queries/catalog/project-query/project-query-format.d.ts +1 -54
- package/queries/catalog/project-query/project-query-format.js +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.d.ts +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +4 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -54
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -1
- package/queries/catalog/search-query/search-query-executor.d.ts +1 -1
- package/queries/catalog/search-query/search-query-executor.js +3 -3
- package/queries/catalog/search-query/search-query-format.d.ts +1 -54
- package/queries/catalog/search-query/search-query-format.js +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +3 -3
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -54
- package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -1
- package/queries/query-print.d.ts +4 -4
- package/queries/query-print.js +12 -12
- package/queries/query.d.ts +29 -885
- package/queries/query.js +1 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +1 -1
- package/r-bridge/retriever.d.ts +15 -2
- package/r-bridge/retriever.js +15 -5
- package/search/flowr-search-executor.d.ts +3 -5
- package/search/flowr-search-executor.js +6 -4
- package/search/flowr-search-filters.d.ts +12 -6
- package/search/flowr-search-filters.js +1 -1
- package/search/flowr-search.d.ts +5 -16
- package/search/flowr-search.js +14 -5
- package/search/search-executor/search-enrichers.d.ts +37 -36
- package/search/search-executor/search-enrichers.js +4 -4
- package/search/search-executor/search-generators.d.ts +12 -12
- package/search/search-executor/search-generators.js +27 -19
- package/search/search-executor/search-mappers.d.ts +5 -5
- package/search/search-executor/search-transformer.d.ts +17 -17
- package/search/search-executor/search-transformer.js +14 -7
- package/util/collections/arrays.d.ts +1 -0
- package/util/collections/arrays.js +15 -0
- package/util/collections/objectmap.d.ts +17 -0
- package/util/collections/objectmap.js +28 -0
- package/util/containers.d.ts +0 -1
- package/util/containers.js +0 -1
- package/util/files.d.ts +17 -0
- package/util/files.js +65 -0
- package/util/formats/adapter-format.d.ts +6 -0
- package/util/formats/adapter-format.js +3 -0
- package/util/formats/adapter.d.ts +18 -0
- package/util/formats/adapter.js +49 -0
- package/util/formats/adapters/r-adapter.d.ts +4 -0
- package/util/formats/adapters/r-adapter.js +7 -0
- package/util/formats/adapters/rmd-adapter.d.ts +26 -0
- package/util/formats/adapters/rmd-adapter.js +91 -0
- package/util/version.js +1 -1
|
@@ -201,6 +201,10 @@ To get started, install the [vitest Extension](https://marketplace.visualstudio.
|
|
|
201
201
|
#### Webstorm
|
|
202
202
|
|
|
203
203
|
Please follow the official guide [here](https://www.jetbrains.com/help/webstorm/vitest.html).
|
|
204
|
+
Note that the working directory has to be set to the project root directory, not the test subdirectory!
|
|
205
|
+
Otherwise, the tests will not be instantiated.
|
|
206
|
+
|
|
207
|
+

|
|
204
208
|
|
|
205
209
|
<a id='ci-pipeline'></a>
|
|
206
210
|
## 🪈 CI Pipeline
|
|
@@ -20,6 +20,7 @@ const visitor_1 = require("../r-bridge/lang-4.x/ast/model/processing/visitor");
|
|
|
20
20
|
const collect_1 = require("../r-bridge/lang-4.x/ast/model/collect");
|
|
21
21
|
const normalized_ast_fold_1 = require("../abstract-interpretation/normalized-ast-fold");
|
|
22
22
|
const default_pipelines_1 = require("../core/steps/pipeline/default-pipelines");
|
|
23
|
+
const flowr_analyzer_1 = require("../project/flowr-analyzer");
|
|
23
24
|
async function getText(shell) {
|
|
24
25
|
const rversion = (await shell.usedRVersion())?.format() ?? 'unknown';
|
|
25
26
|
const now = performance.now();
|
|
@@ -91,17 +92,14 @@ The following segments intend to give you an overview of how to work with the no
|
|
|
91
92
|
|
|
92
93
|
## How to Get a Normalized AST
|
|
93
94
|
|
|
94
|
-
As explained alongside the [Interface](${doc_files_1.FlowrWikiBaseRef}/Interface#
|
|
95
|
-
${(0, doc_types_1.shortLink)(
|
|
96
|
-
a pipeline like the ${(0, doc_types_1.shortLink)('DEFAULT_NORMALIZE_PIPELINE', types.info)} suffices:
|
|
95
|
+
As explained alongside the [Interface](${doc_files_1.FlowrWikiBaseRef}/Interface#creating-flowr-analyses) wiki page, you can use an instance of
|
|
96
|
+
${(0, doc_types_1.shortLink)(flowr_analyzer_1.FlowrAnalyzer.name, types.info)} to get the ${(0, doc_types_1.shortLink)('NormalizedAst', types.info)}:
|
|
97
97
|
|
|
98
98
|
${(0, doc_code_1.codeBlock)('ts', `
|
|
99
99
|
async function getAst(code: string): Promise<RNode> {
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}).allRemainingSteps();
|
|
104
|
-
return result.normalize.ast;
|
|
100
|
+
const analyzer = await new FlowrAnalyzerBuilder(${retriever_1.requestFromInput.name}(code.trim())).build();
|
|
101
|
+
const result = analyzer.normalizedAst();
|
|
102
|
+
return result.ast;
|
|
105
103
|
}`)}
|
|
106
104
|
|
|
107
105
|
From the REPL, you can use the ${(0, doc_cli_option_1.getReplCommand)('normalize')} command.
|
|
@@ -142,6 +142,12 @@ You can enter ${(0, doc_cli_option_1.getReplCommand)('help')} to gain more infor
|
|
|
142
142
|
|
|
143
143
|

|
|
144
144
|
|
|
145
|
+
If you want to use the same commands:
|
|
146
|
+
|
|
147
|
+
1. First this runs \`docker run -it --rm eagleoutice/flowr\` in a terminal to start the REPL.
|
|
148
|
+
2. In the REPL, it runs \`:slicer -c '11@prod' demo.R --diff\` to slice the example file \`demo.R\` for the print statement in line 11.
|
|
149
|
+
Please note that the \`11\` refers to the 11th line number to slice for!
|
|
150
|
+
|
|
145
151
|
</details>
|
|
146
152
|
|
|
147
153
|
## 📜 More Information
|
package/engines.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FlowrConfigOptions, KnownEngines } from './config';
|
|
2
|
+
/**
|
|
3
|
+
* Retrieve all requested engine instance.
|
|
4
|
+
* Please make sure that if this includes the R engine, that you properly shut it down again!
|
|
5
|
+
*/
|
|
6
|
+
export declare function retrieveEngineInstances(config: FlowrConfigOptions, defaultOnly?: boolean): Promise<{
|
|
7
|
+
engines: KnownEngines;
|
|
8
|
+
default: keyof KnownEngines;
|
|
9
|
+
}>;
|
package/engines.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.retrieveEngineInstances = retrieveEngineInstances;
|
|
4
|
+
const config_1 = require("./config");
|
|
5
|
+
const shell_1 = require("./r-bridge/shell");
|
|
6
|
+
const ansi_1 = require("./util/text/ansi");
|
|
7
|
+
const tree_sitter_executor_1 = require("./r-bridge/lang-4.x/tree-sitter/tree-sitter-executor");
|
|
8
|
+
const log_1 = require("./util/log");
|
|
9
|
+
/**
|
|
10
|
+
* Retrieve all requested engine instance.
|
|
11
|
+
* Please make sure that if this includes the R engine, that you properly shut it down again!
|
|
12
|
+
*/
|
|
13
|
+
async function retrieveEngineInstances(config, defaultOnly = false) {
|
|
14
|
+
const engines = {};
|
|
15
|
+
if ((0, config_1.getEngineConfig)(config, 'r-shell') && (!defaultOnly || config.defaultEngine === 'r-shell')) {
|
|
16
|
+
// we keep an active shell session to allow other parse investigations :)
|
|
17
|
+
engines['r-shell'] = new shell_1.RShell((0, config_1.getEngineConfig)(config, 'r-shell'), {
|
|
18
|
+
revive: 2 /* RShellReviveOptions.Always */,
|
|
19
|
+
onRevive: (code, signal) => {
|
|
20
|
+
const signalText = signal == null ? '' : ` and signal ${signal}`;
|
|
21
|
+
console.log(ansi_1.formatter.format(`R process exited with code ${code}${signalText}. Restarting...`, { color: 5 /* Colors.Magenta */, effect: ansi_1.ColorEffect.Foreground }));
|
|
22
|
+
console.log((0, ansi_1.italic)(`If you want to exit, press either Ctrl+C twice, or enter ${(0, ansi_1.bold)(':quit')}`));
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
if ((0, config_1.getEngineConfig)(config, 'tree-sitter') && (!defaultOnly || config.defaultEngine === 'tree-sitter')) {
|
|
27
|
+
await tree_sitter_executor_1.TreeSitterExecutor.initTreeSitter((0, config_1.getEngineConfig)(config, 'tree-sitter'));
|
|
28
|
+
engines['tree-sitter'] = new tree_sitter_executor_1.TreeSitterExecutor();
|
|
29
|
+
}
|
|
30
|
+
let defaultEngine = config.defaultEngine;
|
|
31
|
+
if (!defaultEngine || !engines[defaultEngine]) {
|
|
32
|
+
// if a default engine isn't specified, we just take the first one we have
|
|
33
|
+
defaultEngine = Object.keys(engines)[0];
|
|
34
|
+
}
|
|
35
|
+
log_1.log.info(`Using engines ${Object.keys(engines).join(', ')} with default ${defaultEngine}`);
|
|
36
|
+
return { engines, default: defaultEngine };
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=engines.js.map
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import type { LintingRuleConfig, LintingRuleNames } from './linter-rules';
|
|
2
|
-
import type { NormalizedAst } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
3
|
-
import type { DataflowInformation } from '../dataflow/info';
|
|
4
2
|
import type { LintingResults } from './linter-format';
|
|
5
3
|
import type { DeepPartial } from 'ts-essentials';
|
|
6
|
-
import type {
|
|
7
|
-
export declare function executeLintingRule<Name extends LintingRuleNames>(ruleName: Name, input:
|
|
8
|
-
normalize: NormalizedAst;
|
|
9
|
-
dataflow: DataflowInformation;
|
|
10
|
-
config: FlowrConfigOptions;
|
|
11
|
-
}, lintingRuleConfig?: DeepPartial<LintingRuleConfig<Name>>): LintingResults<Name>;
|
|
4
|
+
import type { FlowrAnalysisProvider } from '../project/flowr-analyzer';
|
|
5
|
+
export declare function executeLintingRule<Name extends LintingRuleNames>(ruleName: Name, input: FlowrAnalysisProvider, lintingRuleConfig?: DeepPartial<LintingRuleConfig<Name>>): Promise<LintingResults<Name>>;
|
|
@@ -4,16 +4,21 @@ exports.executeLintingRule = executeLintingRule;
|
|
|
4
4
|
const linter_rules_1 = require("./linter-rules");
|
|
5
5
|
const flowr_search_executor_1 = require("../search/flowr-search-executor");
|
|
6
6
|
const objects_1 = require("../util/objects");
|
|
7
|
-
function executeLintingRule(ruleName, input, lintingRuleConfig) {
|
|
7
|
+
async function executeLintingRule(ruleName, input, lintingRuleConfig) {
|
|
8
8
|
try {
|
|
9
9
|
const rule = linter_rules_1.LintingRules[ruleName];
|
|
10
10
|
const fullConfig = (0, objects_1.deepMergeObject)(rule.info.defaultConfig, lintingRuleConfig);
|
|
11
|
-
const ruleSearch = rule.createSearch(fullConfig
|
|
11
|
+
const ruleSearch = rule.createSearch(fullConfig);
|
|
12
12
|
const searchStart = Date.now();
|
|
13
|
-
const searchResult = (0, flowr_search_executor_1.runSearch)(ruleSearch, input);
|
|
13
|
+
const searchResult = await (0, flowr_search_executor_1.runSearch)(ruleSearch, input);
|
|
14
14
|
const searchTime = Date.now() - searchStart;
|
|
15
15
|
const processStart = Date.now();
|
|
16
|
-
const result = rule.processSearchResult(searchResult, fullConfig,
|
|
16
|
+
const result = await rule.processSearchResult(searchResult, fullConfig, {
|
|
17
|
+
normalize: await input.normalize(),
|
|
18
|
+
dataflow: await input.dataflow(),
|
|
19
|
+
cfg: await input.controlflow(),
|
|
20
|
+
config: input.flowrConfig,
|
|
21
|
+
});
|
|
17
22
|
const processTime = Date.now() - processStart;
|
|
18
23
|
return {
|
|
19
24
|
...result,
|
|
@@ -5,11 +5,12 @@ import type { GeneratorNames } from '../search/search-executor/search-generators
|
|
|
5
5
|
import type { TransformerNames } from '../search/search-executor/search-transformer';
|
|
6
6
|
import type { NormalizedAst, ParentInformation } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
7
7
|
import type { LintingRuleConfig, LintingRuleMetadata, LintingRuleNames, LintingRuleResult } from './linter-rules';
|
|
8
|
-
import type {
|
|
9
|
-
import type { FlowrConfigOptions } from '../config';
|
|
10
|
-
import type { DeepPartial, DeepReadonly } from 'ts-essentials';
|
|
8
|
+
import type { AsyncOrSync, DeepPartial, DeepReadonly } from 'ts-essentials';
|
|
11
9
|
import type { LintingRuleTag } from './linter-tags';
|
|
12
10
|
import type { SourceRange } from '../util/range';
|
|
11
|
+
import type { DataflowInformation } from '../dataflow/info';
|
|
12
|
+
import type { FlowrConfigOptions } from '../config';
|
|
13
|
+
import type { ControlFlowInformation } from '../control-flow/control-flow-graph';
|
|
13
14
|
export interface LinterRuleInformation<Config extends MergeableRecord = never> {
|
|
14
15
|
/** Human-Readable name of the linting rule. */
|
|
15
16
|
readonly name: string;
|
|
@@ -41,10 +42,7 @@ export interface LintingRule<Result extends LintingResult, Metadata extends Merg
|
|
|
41
42
|
* Creates a flowR search that will then be executed and whose results will be passed to {@link processSearchResult}.
|
|
42
43
|
* In the future, additional optimizations and transformations may be applied to the search between this function and {@link processSearchResult}.
|
|
43
44
|
*/
|
|
44
|
-
readonly createSearch: (config: Config,
|
|
45
|
-
normalize: NormalizedAst;
|
|
46
|
-
dataflow: DataflowInformation;
|
|
47
|
-
}) => FlowrSearchLike<Info, GeneratorNames, TransformerNames[], FlowrSearchElements<Info, Elements>>;
|
|
45
|
+
readonly createSearch: (config: Config) => FlowrSearchLike<Info, GeneratorNames, TransformerNames[], FlowrSearchElements<Info, Elements>>;
|
|
48
46
|
/**
|
|
49
47
|
* Processes the search results of the search created through {@link createSearch}.
|
|
50
48
|
* This function is expected to return the linting results from this rule for the given search, ie usually the given script file.
|
|
@@ -52,11 +50,12 @@ export interface LintingRule<Result extends LintingResult, Metadata extends Merg
|
|
|
52
50
|
readonly processSearchResult: (elements: FlowrSearchElements<Info, Elements>, config: Config, data: {
|
|
53
51
|
normalize: NormalizedAst;
|
|
54
52
|
dataflow: DataflowInformation;
|
|
53
|
+
cfg: ControlFlowInformation;
|
|
55
54
|
config: FlowrConfigOptions;
|
|
56
|
-
}) => {
|
|
55
|
+
}) => AsyncOrSync<{
|
|
57
56
|
results: Result[];
|
|
58
57
|
'.meta': Metadata;
|
|
59
|
-
}
|
|
58
|
+
}>;
|
|
60
59
|
/**
|
|
61
60
|
* A set of functions used to pretty-print the given linting result.
|
|
62
61
|
* By default, the {@link LintingResult#certainty} and whether any {@link LintingResult#quickFix} values are available is automatically printed alongside this information.
|
package/linter/linter-rules.d.ts
CHANGED
|
@@ -5,18 +5,22 @@ import type { LintingRule } from './linter-format';
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const LintingRules: {
|
|
7
7
|
readonly 'deprecated-functions': {
|
|
8
|
-
readonly createSearch: (config: import("./rules/
|
|
9
|
-
readonly processSearchResult:
|
|
8
|
+
readonly createSearch: (config: import("./rules/function-finder-util").FunctionsToDetectConfig) => import("../search/flowr-search-builder").FlowrSearchBuilder<"all", ["with", "filter"], import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, Promise<import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, [] | import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>>;
|
|
9
|
+
readonly processSearchResult: <T extends import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>(elements: import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, T>, _config: import("./rules/function-finder-util").FunctionsToDetectConfig, _data: {
|
|
10
|
+
normalize: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
11
|
+
dataflow: import("../dataflow/info").DataflowInformation;
|
|
12
|
+
config: import("../config").FlowrConfigOptions;
|
|
13
|
+
}, refineSearch?: (elements: T) => T) => {
|
|
10
14
|
results: {
|
|
11
|
-
certainty: import("./linter-format").LintingResultCertainty
|
|
15
|
+
certainty: import("./linter-format").LintingResultCertainty;
|
|
12
16
|
function: import("../dataflow/environments/identifier").Identifier;
|
|
13
17
|
range: import("../util/range").SourceRange;
|
|
14
18
|
}[];
|
|
15
|
-
'.meta': import("./rules/
|
|
19
|
+
'.meta': import("./rules/function-finder-util").FunctionsMetadata;
|
|
16
20
|
};
|
|
17
21
|
readonly prettyPrint: {
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
query: (result: import("./rules/function-finder-util").FunctionsResult) => string;
|
|
23
|
+
full: (result: import("./rules/function-finder-util").FunctionsResult) => string;
|
|
20
24
|
};
|
|
21
25
|
readonly info: {
|
|
22
26
|
readonly name: "Deprecated Functions";
|
|
@@ -24,15 +28,16 @@ export declare const LintingRules: {
|
|
|
24
28
|
readonly certainty: import("./linter-format").LintingRuleCertainty.BestEffort;
|
|
25
29
|
readonly description: "Marks deprecated functions that should not be used anymore.";
|
|
26
30
|
readonly defaultConfig: {
|
|
27
|
-
readonly
|
|
31
|
+
readonly fns: readonly ["all_equal", "arrange_all", "distinct_all", "filter_all", "group_by_all", "summarise_all", "mutate_all", "select_all", "vars", "all_vars", "id", "failwith", "select_vars", "rename_vars", "select_var", "current_vars", "bench_tbls", "compare_tbls", "compare_tbls2", "eval_tbls", "eval_tbls2", "location", "changes", "combine", "do", "funs", "add_count_", "add_tally_", "arrange_", "count_", "distinct_", "do_", "filter_", "funs_", "group_by_", "group_indices_", "mutate_", "tally_", "transmute_", "rename_", "rename_vars_", "select_", "select_vars_", "slice_", "summarise_", "summarize_", "summarise_each", "src_local", "tbl_df", "add_rownames", "group_nest", "group_split", "with_groups", "nest_by", "progress_estimated", "recode", "sample_n", "top_n", "transmute", "fct_explicit_na", "aes_", "aes_auto", "annotation_logticks", "is.Coord", "coord_flip", "coord_map", "is.facet", "fortify", "is.ggproto", "guide_train", "is.ggplot", "qplot", "is.theme", "gg_dep", "liply", "isplit2", "list_along", "cross", "invoke", "at_depth", "prepend", "rerun", "splice", "`%@%`", "rbernoulli", "rdunif", "when", "update_list", "map_raw", "accumulate", "reduce_right", "flatten", "map_dfr", "as_vector", "transpose", "melt_delim", "melt_fwf", "melt_table", "read_table2", "str_interp", "as_tibble", "data_frame", "tibble_", "data_frame_", "lst_", "as_data_frame", "as.tibble", "frame_data", "trunc_mat", "is.tibble", "tidy_names", "set_tidy_names", "repair_names", "extract_numeric", "complete_", "drop_na_", "expand_", "crossing_", "nesting_", "extract_", "fill_", "gather_", "nest_", "separate_rows_", "separate_", "spread_", "unite_", "unnest_", "extract", "gather", "nest_legacy", "separate_rows", "separate", "spread"];
|
|
28
32
|
};
|
|
29
33
|
};
|
|
30
34
|
};
|
|
31
35
|
readonly 'file-path-validity': {
|
|
32
|
-
readonly createSearch: (config: import("./rules/file-path-validity").FilePathValidityConfig) => import("../search/flowr-search-builder").FlowrSearchBuilder<"from-query", ["with"], import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]
|
|
36
|
+
readonly createSearch: (config: import("./rules/file-path-validity").FilePathValidityConfig) => import("../search/flowr-search-builder").FlowrSearchBuilder<"from-query", ["with"], import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, Promise<import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>>;
|
|
33
37
|
readonly processSearchResult: (elements: import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, config: import("./rules/file-path-validity").FilePathValidityConfig, data: {
|
|
34
38
|
normalize: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
35
39
|
dataflow: import("../dataflow/info").DataflowInformation;
|
|
40
|
+
cfg: import("../control-flow/control-flow-graph").ControlFlowInformation;
|
|
36
41
|
config: import("../config").FlowrConfigOptions;
|
|
37
42
|
}) => {
|
|
38
43
|
results: import("./rules/file-path-validity").FilePathValidityResult[];
|
|
@@ -55,10 +60,11 @@ export declare const LintingRules: {
|
|
|
55
60
|
};
|
|
56
61
|
};
|
|
57
62
|
readonly 'seeded-randomness': {
|
|
58
|
-
readonly createSearch: (config: import("./rules/seeded-randomness").SeededRandomnessConfig) => import("../search/flowr-search-builder").FlowrSearchBuilder<"all", ["with", "filter", "with"], import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]
|
|
63
|
+
readonly createSearch: (config: import("./rules/seeded-randomness").SeededRandomnessConfig) => import("../search/flowr-search-builder").FlowrSearchBuilder<"all", ["with", "filter", "with"], import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, Promise<import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>>;
|
|
59
64
|
readonly processSearchResult: (elements: import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, config: import("./rules/seeded-randomness").SeededRandomnessConfig, { dataflow }: {
|
|
60
65
|
normalize: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
61
66
|
dataflow: import("../dataflow/info").DataflowInformation;
|
|
67
|
+
cfg: import("../control-flow/control-flow-graph").ControlFlowInformation;
|
|
62
68
|
config: import("../config").FlowrConfigOptions;
|
|
63
69
|
}) => {
|
|
64
70
|
results: {
|
|
@@ -94,6 +100,7 @@ export declare const LintingRules: {
|
|
|
94
100
|
readonly processSearchResult: (elements: import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, config: import("./rules/absolute-path").AbsoluteFilePathConfig, data: {
|
|
95
101
|
normalize: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
96
102
|
dataflow: import("../dataflow/info").DataflowInformation;
|
|
103
|
+
cfg: import("../control-flow/control-flow-graph").ControlFlowInformation;
|
|
97
104
|
config: import("../config").FlowrConfigOptions;
|
|
98
105
|
}) => {
|
|
99
106
|
results: import("./rules/absolute-path").AbsoluteFilePathResult[];
|
|
@@ -120,10 +127,11 @@ export declare const LintingRules: {
|
|
|
120
127
|
};
|
|
121
128
|
};
|
|
122
129
|
readonly 'unused-definitions': {
|
|
123
|
-
readonly createSearch: (config: import("./rules/unused-definition").UnusedDefinitionConfig) => import("../search/flowr-search-builder").FlowrSearchBuilder<"all", ["filter"], import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, [] | import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]
|
|
130
|
+
readonly createSearch: (config: import("./rules/unused-definition").UnusedDefinitionConfig) => import("../search/flowr-search-builder").FlowrSearchBuilder<"all", ["filter"], import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, Promise<import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, [] | import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>>;
|
|
124
131
|
readonly processSearchResult: (elements: import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, config: import("./rules/unused-definition").UnusedDefinitionConfig, data: {
|
|
125
132
|
normalize: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
126
133
|
dataflow: import("../dataflow/info").DataflowInformation;
|
|
134
|
+
cfg: import("../control-flow/control-flow-graph").ControlFlowInformation;
|
|
127
135
|
config: import("../config").FlowrConfigOptions;
|
|
128
136
|
}) => {
|
|
129
137
|
results: import("./rules/unused-definition").UnusedDefinitionResult[];
|
|
@@ -144,10 +152,11 @@ export declare const LintingRules: {
|
|
|
144
152
|
};
|
|
145
153
|
};
|
|
146
154
|
readonly 'naming-convention': {
|
|
147
|
-
readonly createSearch: (_config: import("./rules/naming-convention").NamingConventionConfig) => import("../search/flowr-search-builder").FlowrSearchBuilder<"all", ["filter"], import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, [] | import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]
|
|
155
|
+
readonly createSearch: (_config: import("./rules/naming-convention").NamingConventionConfig) => import("../search/flowr-search-builder").FlowrSearchBuilder<"all", ["filter"], import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, Promise<import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, [] | import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>>;
|
|
148
156
|
readonly processSearchResult: (elements: import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, config: import("./rules/naming-convention").NamingConventionConfig, data: {
|
|
149
157
|
normalize: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
150
158
|
dataflow: import("../dataflow/info").DataflowInformation;
|
|
159
|
+
cfg: import("../control-flow/control-flow-graph").ControlFlowInformation;
|
|
151
160
|
config: import("../config").FlowrConfigOptions;
|
|
152
161
|
}) => {
|
|
153
162
|
results: {
|
|
@@ -177,11 +186,42 @@ export declare const LintingRules: {
|
|
|
177
186
|
};
|
|
178
187
|
};
|
|
179
188
|
};
|
|
189
|
+
readonly 'network-functions': {
|
|
190
|
+
readonly createSearch: (config: import("./rules/network-functions").NetworkFunctionsConfig) => import("../search/flowr-search-builder").FlowrSearchBuilder<"all", ["with", "filter"], import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, Promise<import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, [] | import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>>;
|
|
191
|
+
readonly processSearchResult: (e: import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, c: import("./rules/network-functions").NetworkFunctionsConfig, d: {
|
|
192
|
+
normalize: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
193
|
+
dataflow: import("../dataflow/info").DataflowInformation;
|
|
194
|
+
cfg: import("../control-flow/control-flow-graph").ControlFlowInformation;
|
|
195
|
+
config: import("../config").FlowrConfigOptions;
|
|
196
|
+
}) => {
|
|
197
|
+
results: {
|
|
198
|
+
certainty: import("./linter-format").LintingResultCertainty;
|
|
199
|
+
function: import("../dataflow/environments/identifier").Identifier;
|
|
200
|
+
range: import("../util/range").SourceRange;
|
|
201
|
+
}[];
|
|
202
|
+
'.meta': import("./rules/function-finder-util").FunctionsMetadata;
|
|
203
|
+
};
|
|
204
|
+
readonly prettyPrint: {
|
|
205
|
+
query: (result: import("./rules/function-finder-util").FunctionsResult) => string;
|
|
206
|
+
full: (result: import("./rules/function-finder-util").FunctionsResult) => string;
|
|
207
|
+
};
|
|
208
|
+
readonly info: {
|
|
209
|
+
readonly name: "Network Functions";
|
|
210
|
+
readonly tags: readonly [import("./linter-tags").LintingRuleTag.Reproducibility, import("./linter-tags").LintingRuleTag.Security, import("./linter-tags").LintingRuleTag.Performance, import("./linter-tags").LintingRuleTag.Smell];
|
|
211
|
+
readonly certainty: import("./linter-format").LintingRuleCertainty.BestEffort;
|
|
212
|
+
readonly description: "Marks network functions that execute network operations, such as downloading files or making HTTP requests.";
|
|
213
|
+
readonly defaultConfig: {
|
|
214
|
+
readonly fns: readonly ["read.table", "read.csv", "read.csv2", "read.delim", "read.delim2", "readRDS", "download.file", "url", "GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "content", "handle", "get_callback", "VERB", "fread", "gzcon", "readlines", "source", "load", "curl_download", "curl_fetch_memory", "getURL", "getForm", "read_html", "html_nodes", "html_text", "fromJSON", "read.xlsx", "drive_download", "drive_get", "s3read_using", "s3write_using", "storage_download", "AnnotationHub", "ExperimentHub"];
|
|
215
|
+
readonly onlyTriggerWithArgument: RegExp;
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
};
|
|
180
219
|
readonly 'dataframe-access-validation': {
|
|
181
|
-
readonly createSearch: () => import("../search/flowr-search-builder").FlowrSearchBuilder<"all", ["with"], import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]
|
|
220
|
+
readonly createSearch: () => import("../search/flowr-search-builder").FlowrSearchBuilder<"all", ["with"], import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, Promise<import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>>;
|
|
182
221
|
readonly processSearchResult: (elements: import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, config: import("./rules/dataframe-access-validation").DataFrameAccessValidationConfig, data: {
|
|
183
222
|
normalize: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
184
223
|
dataflow: import("../dataflow/info").DataflowInformation;
|
|
224
|
+
cfg: import("../control-flow/control-flow-graph").ControlFlowInformation;
|
|
185
225
|
config: import("../config").FlowrConfigOptions;
|
|
186
226
|
}) => {
|
|
187
227
|
results: import("./rules/dataframe-access-validation").DataFrameAccessValidationResult[];
|
|
@@ -202,10 +242,11 @@ export declare const LintingRules: {
|
|
|
202
242
|
};
|
|
203
243
|
};
|
|
204
244
|
readonly 'dead-code': {
|
|
205
|
-
readonly createSearch: (config: import("./rules/dead-code").DeadCodeConfig) => import("../search/flowr-search-builder").FlowrSearchBuilder<"all", ["with"], import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]
|
|
245
|
+
readonly createSearch: (config: import("./rules/dead-code").DeadCodeConfig) => import("../search/flowr-search-builder").FlowrSearchBuilder<"all", ["with"], import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, Promise<import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>>;
|
|
206
246
|
readonly processSearchResult: (elements: import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, _config: import("./rules/dead-code").DeadCodeConfig, _data: {
|
|
207
247
|
normalize: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
208
248
|
dataflow: import("../dataflow/info").DataflowInformation;
|
|
249
|
+
cfg: import("../control-flow/control-flow-graph").ControlFlowInformation;
|
|
209
250
|
config: import("../config").FlowrConfigOptions;
|
|
210
251
|
}) => {
|
|
211
252
|
results: {
|
|
@@ -227,10 +268,11 @@ export declare const LintingRules: {
|
|
|
227
268
|
};
|
|
228
269
|
};
|
|
229
270
|
readonly 'useless-loop': {
|
|
230
|
-
readonly createSearch: () => import("../search/flowr-search-builder").FlowrSearchBuilder<"all", ["filter"], import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, [] | import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]
|
|
231
|
-
readonly processSearchResult: (elements: import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>,
|
|
271
|
+
readonly createSearch: () => import("../search/flowr-search-builder").FlowrSearchBuilder<"all", ["filter"], import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, Promise<import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, [] | import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>>;
|
|
272
|
+
readonly processSearchResult: (elements: import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, useLessLoopConfig: import("./rules/useless-loop").UselessLoopConfig, { config, dataflow, normalize, cfg }: {
|
|
232
273
|
normalize: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
233
274
|
dataflow: import("../dataflow/info").DataflowInformation;
|
|
275
|
+
cfg: import("../control-flow/control-flow-graph").ControlFlowInformation;
|
|
234
276
|
config: import("../config").FlowrConfigOptions;
|
|
235
277
|
}) => {
|
|
236
278
|
results: {
|
package/linter/linter-rules.js
CHANGED
|
@@ -10,6 +10,7 @@ const seeded_randomness_1 = require("./rules/seeded-randomness");
|
|
|
10
10
|
const naming_convention_1 = require("./rules/naming-convention");
|
|
11
11
|
const dataframe_access_validation_1 = require("./rules/dataframe-access-validation");
|
|
12
12
|
const useless_loop_1 = require("./rules/useless-loop");
|
|
13
|
+
const network_functions_1 = require("./rules/network-functions");
|
|
13
14
|
/**
|
|
14
15
|
* The registry of currently supported linting rules.
|
|
15
16
|
* A linting rule can be executed on a dataflow pipeline result using {@link executeLintingRule}.
|
|
@@ -21,6 +22,7 @@ exports.LintingRules = {
|
|
|
21
22
|
'absolute-file-paths': absolute_path_1.ABSOLUTE_PATH,
|
|
22
23
|
'unused-definitions': unused_definition_1.UNUSED_DEFINITION,
|
|
23
24
|
'naming-convention': naming_convention_1.NAMING_CONVENTION,
|
|
25
|
+
'network-functions': network_functions_1.NETWORK_FUNCTIONS,
|
|
24
26
|
'dataframe-access-validation': dataframe_access_validation_1.DATA_FRAME_ACCESS_VALIDATION,
|
|
25
27
|
'dead-code': dead_code_1.DEAD_CODE,
|
|
26
28
|
'useless-loop': useless_loop_1.USELESS_LOOP
|
|
@@ -40,6 +40,7 @@ export declare const ABSOLUTE_PATH: {
|
|
|
40
40
|
readonly processSearchResult: (elements: import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, config: AbsoluteFilePathConfig, data: {
|
|
41
41
|
normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
42
42
|
dataflow: import("../../dataflow/info").DataflowInformation;
|
|
43
|
+
cfg: import("../../control-flow/control-flow-graph").ControlFlowInformation;
|
|
43
44
|
config: FlowrConfigOptions;
|
|
44
45
|
}) => {
|
|
45
46
|
results: AbsoluteFilePathResult[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
1
|
+
import type { NormalizedAst, ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
2
2
|
import type { FlowrSearchElements } from '../../search/flowr-search';
|
|
3
3
|
import { type MergeableRecord } from '../../util/objects';
|
|
4
4
|
import { type SourceRange } from '../../util/range';
|
|
@@ -30,10 +30,11 @@ export interface DataFrameAccessValidationMetadata extends MergeableRecord {
|
|
|
30
30
|
totalAccessed: number;
|
|
31
31
|
}
|
|
32
32
|
export declare const DATA_FRAME_ACCESS_VALIDATION: {
|
|
33
|
-
readonly createSearch: () => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["with"], ParentInformation, FlowrSearchElements<ParentInformation, import("../../search/flowr-search").FlowrSearchElement<ParentInformation>[]
|
|
33
|
+
readonly createSearch: () => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["with"], ParentInformation, Promise<FlowrSearchElements<ParentInformation, import("../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>>>;
|
|
34
34
|
readonly processSearchResult: (elements: FlowrSearchElements<ParentInformation, import("../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>, config: DataFrameAccessValidationConfig, data: {
|
|
35
|
-
normalize:
|
|
35
|
+
normalize: NormalizedAst;
|
|
36
36
|
dataflow: import("../../dataflow/info").DataflowInformation;
|
|
37
|
+
cfg: import("../../control-flow/control-flow-graph").ControlFlowInformation;
|
|
37
38
|
config: import("../../config").FlowrConfigOptions;
|
|
38
39
|
}) => {
|
|
39
40
|
results: DataFrameAccessValidationResult[];
|
|
@@ -24,7 +24,7 @@ exports.DATA_FRAME_ACCESS_VALIDATION = {
|
|
|
24
24
|
});
|
|
25
25
|
const cfg = (0, extract_cfg_1.extractCfg)(data.normalize, flowrConfig, data.dataflow.graph);
|
|
26
26
|
(0, shape_inference_1.inferDataFrameShapes)(cfg, data.dataflow.graph, data.normalize, flowrConfig);
|
|
27
|
-
const accessOperations = getAccessOperations(elements);
|
|
27
|
+
const accessOperations = getAccessOperations(elements, data.normalize);
|
|
28
28
|
const accesses = [];
|
|
29
29
|
for (const [nodeId, operations] of accessOperations) {
|
|
30
30
|
const access = { nodeId };
|
|
@@ -84,9 +84,12 @@ exports.DATA_FRAME_ACCESS_VALIDATION = {
|
|
|
84
84
|
defaultConfig: { readLoadedData: false }
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
|
-
function getAccessOperations(elements) {
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
function getAccessOperations(elements, normalize) {
|
|
88
|
+
const nodes = elements.getElements().map(element => {
|
|
89
|
+
const id = element.node.info.id;
|
|
90
|
+
return normalize.idMap.get(id);
|
|
91
|
+
}).filter(n => n !== undefined);
|
|
92
|
+
return new Map(nodes
|
|
90
93
|
.filter(absint_info_1.hasDataFrameExpressionInfo)
|
|
91
94
|
.map(node => [node.info.id, node.info.dataFrame.operations
|
|
92
95
|
.filter(({ operation }) => operation === 'accessCols' || operation === 'accessRows')
|
|
@@ -17,10 +17,11 @@ export interface DeadCodeMetadata extends MergeableRecord {
|
|
|
17
17
|
consideredNodes: number;
|
|
18
18
|
}
|
|
19
19
|
export declare const DEAD_CODE: {
|
|
20
|
-
readonly createSearch: (config: DeadCodeConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["with"], import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]
|
|
20
|
+
readonly createSearch: (config: DeadCodeConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["with"], import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, Promise<import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>>;
|
|
21
21
|
readonly processSearchResult: (elements: import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, _config: DeadCodeConfig, _data: {
|
|
22
22
|
normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
23
23
|
dataflow: import("../../dataflow/info").DataflowInformation;
|
|
24
|
+
cfg: import("../../control-flow/control-flow-graph").ControlFlowInformation;
|
|
24
25
|
config: import("../../config").FlowrConfigOptions;
|
|
25
26
|
}) => {
|
|
26
27
|
results: {
|
|
@@ -1,36 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { LintingResultCertainty, LintingRuleCertainty } from '../linter-format';
|
|
3
|
-
import type { MergeableRecord } from '../../util/objects';
|
|
4
|
-
import type { SourceRange } from '../../util/range';
|
|
5
|
-
import type { Identifier } from '../../dataflow/environments/identifier';
|
|
1
|
+
import { LintingRuleCertainty } from '../linter-format';
|
|
6
2
|
import { LintingRuleTag } from '../linter-tags';
|
|
7
|
-
|
|
8
|
-
function: string;
|
|
9
|
-
range: SourceRange;
|
|
10
|
-
}
|
|
11
|
-
export interface DeprecatedFunctionsConfig extends MergeableRecord {
|
|
12
|
-
/**
|
|
13
|
-
* The list of function names that should be marked as deprecated.
|
|
14
|
-
*/
|
|
15
|
-
deprecatedFunctions: string[];
|
|
16
|
-
}
|
|
17
|
-
export interface DeprecatedFunctionsMetadata extends MergeableRecord {
|
|
18
|
-
totalDeprecatedCalls: number;
|
|
19
|
-
totalDeprecatedFunctionDefinitions: number;
|
|
20
|
-
}
|
|
3
|
+
import type { FunctionsMetadata, FunctionsResult, FunctionsToDetectConfig } from './function-finder-util';
|
|
21
4
|
export declare const DEPRECATED_FUNCTIONS: {
|
|
22
|
-
readonly createSearch: (config:
|
|
23
|
-
readonly processSearchResult:
|
|
5
|
+
readonly createSearch: (config: FunctionsToDetectConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["with", "filter"], import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, Promise<import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, [] | import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>>;
|
|
6
|
+
readonly processSearchResult: <T extends import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>(elements: import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, T>, _config: FunctionsToDetectConfig, _data: {
|
|
7
|
+
normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
8
|
+
dataflow: import("../../dataflow/info").DataflowInformation;
|
|
9
|
+
config: import("../../config").FlowrConfigOptions;
|
|
10
|
+
}, refineSearch?: (elements: T) => T) => {
|
|
24
11
|
results: {
|
|
25
|
-
certainty: LintingResultCertainty
|
|
26
|
-
function: Identifier;
|
|
27
|
-
range: SourceRange;
|
|
12
|
+
certainty: import("../linter-format").LintingResultCertainty;
|
|
13
|
+
function: import("../../dataflow/environments/identifier").Identifier;
|
|
14
|
+
range: import("../../util/range").SourceRange;
|
|
28
15
|
}[];
|
|
29
|
-
'.meta':
|
|
16
|
+
'.meta': FunctionsMetadata;
|
|
30
17
|
};
|
|
31
18
|
readonly prettyPrint: {
|
|
32
|
-
|
|
33
|
-
|
|
19
|
+
query: (result: FunctionsResult) => string;
|
|
20
|
+
full: (result: FunctionsResult) => string;
|
|
34
21
|
};
|
|
35
22
|
readonly info: {
|
|
36
23
|
readonly name: "Deprecated Functions";
|
|
@@ -38,7 +25,7 @@ export declare const DEPRECATED_FUNCTIONS: {
|
|
|
38
25
|
readonly certainty: LintingRuleCertainty.BestEffort;
|
|
39
26
|
readonly description: "Marks deprecated functions that should not be used anymore.";
|
|
40
27
|
readonly defaultConfig: {
|
|
41
|
-
readonly
|
|
28
|
+
readonly fns: readonly ["all_equal", "arrange_all", "distinct_all", "filter_all", "group_by_all", "summarise_all", "mutate_all", "select_all", "vars", "all_vars", "id", "failwith", "select_vars", "rename_vars", "select_var", "current_vars", "bench_tbls", "compare_tbls", "compare_tbls2", "eval_tbls", "eval_tbls2", "location", "changes", "combine", "do", "funs", "add_count_", "add_tally_", "arrange_", "count_", "distinct_", "do_", "filter_", "funs_", "group_by_", "group_indices_", "mutate_", "tally_", "transmute_", "rename_", "rename_vars_", "select_", "select_vars_", "slice_", "summarise_", "summarize_", "summarise_each", "src_local", "tbl_df", "add_rownames", "group_nest", "group_split", "with_groups", "nest_by", "progress_estimated", "recode", "sample_n", "top_n", "transmute", "fct_explicit_na", "aes_", "aes_auto", "annotation_logticks", "is.Coord", "coord_flip", "coord_map", "is.facet", "fortify", "is.ggproto", "guide_train", "is.ggplot", "qplot", "is.theme", "gg_dep", "liply", "isplit2", "list_along", "cross", "invoke", "at_depth", "prepend", "rerun", "splice", "`%@%`", "rbernoulli", "rdunif", "when", "update_list", "map_raw", "accumulate", "reduce_right", "flatten", "map_dfr", "as_vector", "transpose", "melt_delim", "melt_fwf", "melt_table", "read_table2", "str_interp", "as_tibble", "data_frame", "tibble_", "data_frame_", "lst_", "as_data_frame", "as.tibble", "frame_data", "trunc_mat", "is.tibble", "tidy_names", "set_tidy_names", "repair_names", "extract_numeric", "complete_", "drop_na_", "expand_", "crossing_", "nesting_", "extract_", "fill_", "gather_", "nest_", "separate_rows_", "separate_", "spread_", "unite_", "unnest_", "extract", "gather", "nest_legacy", "separate_rows", "separate", "spread"];
|
|
42
29
|
};
|
|
43
30
|
};
|
|
44
31
|
};
|