@eagleoutice/flowr 2.2.16 → 2.4.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 +48 -20
- package/abstract-interpretation/data-frame/absint-info.d.ts +109 -0
- package/abstract-interpretation/data-frame/absint-info.js +31 -0
- package/abstract-interpretation/data-frame/absint-visitor.d.ts +58 -0
- package/abstract-interpretation/data-frame/absint-visitor.js +171 -0
- package/abstract-interpretation/data-frame/domain.d.ts +107 -0
- package/abstract-interpretation/data-frame/domain.js +315 -0
- package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +17 -0
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +166 -0
- package/abstract-interpretation/data-frame/mappers/arguments.d.ts +117 -0
- package/abstract-interpretation/data-frame/mappers/arguments.js +188 -0
- package/abstract-interpretation/data-frame/mappers/assignment-mapper.d.ts +20 -0
- package/abstract-interpretation/data-frame/mappers/assignment-mapper.js +34 -0
- package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +261 -0
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +1219 -0
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.d.ts +12 -0
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +206 -0
- package/abstract-interpretation/data-frame/resolve-args.d.ts +42 -0
- package/abstract-interpretation/data-frame/resolve-args.js +118 -0
- package/abstract-interpretation/data-frame/semantics.d.ts +213 -0
- package/abstract-interpretation/data-frame/semantics.js +363 -0
- package/abstract-interpretation/data-frame/shape-inference.d.ts +38 -0
- package/abstract-interpretation/data-frame/shape-inference.js +111 -0
- package/benchmark/slicer.d.ts +15 -1
- package/benchmark/slicer.js +137 -0
- package/benchmark/stats/print.js +123 -45
- package/benchmark/stats/size-of.d.ts +7 -0
- package/benchmark/stats/size-of.js +1 -0
- package/benchmark/stats/stats.d.ts +30 -1
- package/benchmark/stats/stats.js +4 -2
- package/benchmark/summarizer/data.d.ts +33 -2
- package/benchmark/summarizer/first-phase/input.js +5 -1
- package/benchmark/summarizer/first-phase/process.js +47 -1
- package/benchmark/summarizer/second-phase/graph.js +1 -1
- package/benchmark/summarizer/second-phase/process.js +102 -4
- package/cli/benchmark-app.d.ts +2 -0
- package/cli/benchmark-app.js +2 -0
- package/cli/benchmark-helper-app.d.ts +2 -0
- package/cli/benchmark-helper-app.js +10 -3
- package/cli/common/options.js +4 -0
- package/cli/repl/commands/repl-query.js +1 -1
- package/cli/repl/server/connection.js +14 -5
- package/config.d.ts +31 -0
- package/config.js +21 -1
- package/control-flow/basic-cfg-guided-visitor.d.ts +1 -2
- package/control-flow/basic-cfg-guided-visitor.js +0 -6
- package/control-flow/cfg-simplification.d.ts +6 -0
- package/control-flow/cfg-simplification.js +18 -9
- package/control-flow/control-flow-graph.d.ts +3 -8
- package/control-flow/control-flow-graph.js +5 -6
- package/control-flow/dfg-cfg-guided-visitor.js +1 -1
- package/control-flow/extract-cfg.d.ts +2 -2
- package/control-flow/extract-cfg.js +52 -63
- package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
- package/control-flow/semantic-cfg-guided-visitor.js +1 -1
- package/core/steps/all/static-slicing/00-slice.d.ts +7 -1
- package/core/steps/all/static-slicing/00-slice.js +9 -3
- package/core/steps/pipeline/default-pipelines.d.ts +74 -74
- package/dataflow/environments/built-in.d.ts +7 -5
- package/dataflow/environments/built-in.js +16 -13
- package/dataflow/eval/resolve/alias-tracking.js +2 -2
- package/dataflow/eval/resolve/resolve.d.ts +53 -9
- package/dataflow/eval/resolve/resolve.js +132 -38
- package/dataflow/graph/dataflowgraph-builder.js +2 -2
- package/dataflow/graph/graph.js +1 -1
- package/dataflow/graph/invert-dfg.d.ts +2 -0
- package/dataflow/graph/invert-dfg.js +17 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +1 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +4 -0
- package/documentation/doc-util/doc-query.js +11 -1
- package/documentation/doc-util/doc-search.js +2 -2
- package/documentation/print-cfg-wiki.js +3 -4
- package/documentation/print-core-wiki.js +2 -2
- package/documentation/print-dataflow-graph-wiki.js +7 -0
- package/documentation/print-faq-wiki.js +4 -0
- package/documentation/print-interface-wiki.js +11 -0
- package/documentation/print-linter-wiki.js +36 -4
- package/documentation/print-linting-and-testing-wiki.js +13 -1
- package/documentation/print-onboarding-wiki.js +4 -0
- package/documentation/print-query-wiki.js +29 -3
- package/linter/linter-executor.js +1 -2
- package/linter/linter-format.d.ts +26 -4
- package/linter/linter-format.js +25 -6
- package/linter/linter-rules.d.ts +63 -12
- package/linter/linter-rules.js +5 -1
- package/linter/rules/absolute-path.d.ts +4 -7
- package/linter/rules/absolute-path.js +9 -6
- package/linter/rules/dataframe-access-validation.d.ts +55 -0
- package/linter/rules/dataframe-access-validation.js +118 -0
- package/linter/rules/dead-code.d.ts +43 -0
- package/linter/rules/dead-code.js +50 -0
- package/linter/rules/deprecated-functions.d.ts +3 -2
- package/linter/rules/deprecated-functions.js +3 -1
- package/linter/rules/file-path-validity.d.ts +4 -4
- package/linter/rules/file-path-validity.js +8 -6
- package/linter/rules/naming-convention.d.ts +5 -4
- package/linter/rules/naming-convention.js +8 -2
- package/linter/rules/seeded-randomness.d.ts +4 -3
- package/linter/rules/seeded-randomness.js +3 -1
- package/linter/rules/unused-definition.d.ts +2 -0
- package/linter/rules/unused-definition.js +3 -1
- package/package.json +2 -2
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +6 -1
- package/queries/catalog/dependencies-query/function-info/read-functions.js +1 -0
- package/queries/catalog/dependencies-query/function-info/write-functions.js +1 -0
- package/queries/catalog/df-shape-query/df-shape-query-executor.d.ts +3 -0
- package/queries/catalog/df-shape-query/df-shape-query-executor.js +46 -0
- package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +72 -0
- package/queries/catalog/df-shape-query/df-shape-query-format.js +31 -0
- package/queries/catalog/linter-query/linter-query-format.js +1 -1
- package/queries/catalog/location-map-query/location-map-query-executor.js +7 -5
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +3 -0
- package/queries/catalog/location-map-query/location-map-query-format.js +1 -0
- package/queries/catalog/search-query/search-query-executor.js +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +2 -1
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +3 -0
- package/queries/catalog/static-slice-query/static-slice-query-format.js +3 -1
- package/queries/query-print.d.ts +1 -1
- package/queries/query-print.js +0 -1
- package/queries/query.d.ts +77 -6
- package/queries/query.js +26 -11
- package/search/flowr-search-builder.d.ts +6 -6
- package/search/flowr-search-executor.d.ts +2 -2
- package/search/flowr-search-executor.js +1 -1
- package/search/flowr-search.d.ts +13 -8
- package/search/flowr-search.js +21 -0
- package/search/search-executor/search-enrichers.d.ts +87 -20
- package/search/search-executor/search-enrichers.js +44 -5
- package/search/search-executor/search-generators.d.ts +4 -4
- package/search/search-executor/search-generators.js +12 -7
- package/search/search-executor/search-mappers.js +3 -2
- package/search/search-executor/search-transformer.d.ts +3 -3
- package/search/search-executor/search-transformer.js +2 -2
- package/slicing/static/static-slicer.d.ts +4 -2
- package/slicing/static/static-slicer.js +10 -4
- package/util/collections/arrays.d.ts +2 -0
- package/util/collections/arrays.js +9 -0
- package/util/files.d.ts +8 -2
- package/util/files.js +22 -4
- package/util/mermaid/dfg.js +4 -2
- package/util/r-value.d.ts +23 -0
- package/util/r-value.js +113 -0
- package/util/range.d.ts +1 -0
- package/util/range.js +5 -1
- package/util/version.js +1 -1
- package/util/cfg/cfg.d.ts +0 -0
- package/util/cfg/cfg.js +0 -2
|
@@ -20,11 +20,12 @@ const strings_1 = require("../util/text/strings");
|
|
|
20
20
|
const assert_1 = require("../util/assert");
|
|
21
21
|
const doc_print_1 = require("./doc-util/doc-print");
|
|
22
22
|
const doc_functions_1 = require("./doc-util/doc-functions");
|
|
23
|
+
const linter_format_1 = require("../linter/linter-format");
|
|
23
24
|
const SpecialTagColors = {
|
|
24
25
|
[linter_tags_1.LintingRuleTag.Bug]: 'red',
|
|
25
26
|
[linter_tags_1.LintingRuleTag.Security]: 'orange',
|
|
26
27
|
[linter_tags_1.LintingRuleTag.Smell]: 'yellow',
|
|
27
|
-
[linter_tags_1.LintingRuleTag.QuickFix]: 'lightgray'
|
|
28
|
+
[linter_tags_1.LintingRuleTag.QuickFix]: 'lightgray'
|
|
28
29
|
};
|
|
29
30
|
function makeTagBadge(name, info) {
|
|
30
31
|
const doc = (0, doc_types_1.getDocumentationForType)('LintingRuleTag::' + name, info, '', true).replaceAll('\n', ' ');
|
|
@@ -108,6 +109,11 @@ print(x)
|
|
|
108
109
|
myVar <- 42
|
|
109
110
|
print(myVar)
|
|
110
111
|
`, tagTypes);
|
|
112
|
+
rule(shell, 'dataframe-access-validation', 'DataFrameAccessValidationConfig', 'DATA_FRAME_ACCESS_VALIDATION', 'lint-dataframe-access-validation', `
|
|
113
|
+
df <- data.frame(id = 1:5, name = 6:10)
|
|
114
|
+
df[6, "value"]
|
|
115
|
+
`, tagTypes);
|
|
116
|
+
rule(shell, 'dead-code', 'DeadCodeConfig', 'DEAD_CODE', 'lint-dead-code', 'if(TRUE) 1 else 2', tagTypes);
|
|
111
117
|
function rule(shell, name, configType, ruleType, testfile, example, types) {
|
|
112
118
|
const rule = linter_rules_1.LintingRules[name];
|
|
113
119
|
const tags = rule.info.tags.toSorted((a, b) => {
|
|
@@ -126,6 +132,8 @@ print(myVar)
|
|
|
126
132
|
}
|
|
127
133
|
return a.localeCompare(b);
|
|
128
134
|
}).map(t => makeTagBadge(t, types)).join(' ');
|
|
135
|
+
const certaintyDoc = (0, doc_types_1.getDocumentationForType)(`LintingRuleCertainty::${rule.info.certainty}`, types, '', true).replaceAll('\n', ' ');
|
|
136
|
+
const certaintyText = `\`${(0, html_hover_over_1.textWithTooltip)(rule.info.certainty, certaintyDoc)}\``;
|
|
129
137
|
if (format === 'short') {
|
|
130
138
|
ruleExplanations.set(name, () => Promise.resolve(`
|
|
131
139
|
**[${rule.info.name}](${doc_files_1.FlowrWikiBaseRef}/lint-${name}):** ${rule.info.description} [see ${(0, doc_types_1.shortLinkFile)(ruleType, types)}]\\
|
|
@@ -140,6 +148,9 @@ ${(0, doc_auto_gen_1.autoGenHeader)({ filename: module.filename, purpose: 'linte
|
|
|
140
148
|
${(0, doc_structure_1.section)(rule.info.name + ` <sup>[<a href="${doc_files_1.FlowrWikiBaseRef}/Linter">overview</a>]</sup>`, 2, name)}
|
|
141
149
|
|
|
142
150
|
${tags}
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
This rule is a ${certaintyText} rule.
|
|
143
154
|
|
|
144
155
|
${rule.info.description}\\
|
|
145
156
|
_This linting rule is implemented in ${(0, doc_types_1.shortLinkFile)(ruleType, types)}._
|
|
@@ -167,9 +178,12 @@ ${buildSamplesFromLinterTestCases(shell, `${testfile}.test.ts`)}
|
|
|
167
178
|
}
|
|
168
179
|
return ruleExplanations;
|
|
169
180
|
}
|
|
170
|
-
function
|
|
181
|
+
function getAllLintingRulesWithTag(tag) {
|
|
171
182
|
return Object.entries(linter_rules_1.LintingRules).filter(([_, rule]) => rule.info.tags.includes(tag)).map(([name]) => name);
|
|
172
183
|
}
|
|
184
|
+
function getAllLintingRulesWitCertainty(certainty) {
|
|
185
|
+
return Object.entries(linter_rules_1.LintingRules).filter(([_, rule]) => rule.info.certainty === certainty).map(([name]) => name);
|
|
186
|
+
}
|
|
173
187
|
function linkToRule(name) {
|
|
174
188
|
return `[${name}](${doc_files_1.FlowrWikiBaseRef}/lint-${name})`;
|
|
175
189
|
}
|
|
@@ -210,14 +224,32 @@ ${await (async () => {
|
|
|
210
224
|
|
|
211
225
|
${(0, doc_structure_1.section)('Tags', 2, 'tags')}
|
|
212
226
|
|
|
213
|
-
We use tags to categorize linting rules. The following tags are available:
|
|
227
|
+
We use tags to categorize linting rules for users. The following tags are available:
|
|
214
228
|
|
|
215
229
|
| Tag/Badge   | Description |
|
|
216
230
|
| --- | :-- |
|
|
217
231
|
${Object.entries(linter_tags_1.LintingRuleTag).map(([name, tag]) => {
|
|
218
|
-
return `| <a id="${tag}"></a> ${makeTagBadge(tag, tagTypes.info)} | ${(0, doc_types_1.getDocumentationForType)('LintingRuleTag::' + name, tagTypes.info).replaceAll(/\n/g, ' ')} (rule${
|
|
232
|
+
return `| <a id="${tag}"></a> ${(makeTagBadge(tag, tagTypes.info))} | ${(0, doc_types_1.getDocumentationForType)('LintingRuleTag::' + name, tagTypes.info).replaceAll(/\n/g, ' ')} (rule${getAllLintingRulesWithTag(tag).length === 1 ? '' : 's'}: ${(0, strings_1.joinWithLast)(getAllLintingRulesWithTag(tag).map(l => linkToRule(l))) || '_none_'}) | `;
|
|
233
|
+
}).join('\n')}
|
|
234
|
+
|
|
235
|
+
${(0, doc_structure_1.section)('Certainty', 2, 'certainty')}
|
|
236
|
+
|
|
237
|
+
Both linting rules and their individual results are additionally categorized by how certain the linter is that the results it is returning are valid.
|
|
238
|
+
|
|
239
|
+
${(0, doc_structure_1.section)('Rule Certainty', 3, 'rule-certainty')}
|
|
240
|
+
|
|
241
|
+
| Rule Certainty | Description |
|
|
242
|
+
| -------------- | :---------- |
|
|
243
|
+
${Object.entries(linter_format_1.LintingRuleCertainty).map(([name, certainty]) => {
|
|
244
|
+
return `| <a id="${certainty}"></a> \`${certainty}\` | ${(0, doc_types_1.getDocumentationForType)('LintingRuleCertainty::' + name, tagTypes.info).replaceAll(/\n/g, ' ')} (rule${getAllLintingRulesWitCertainty(certainty).length === 1 ? '' : 's'}: ${(0, strings_1.joinWithLast)(getAllLintingRulesWitCertainty(certainty).map(l => linkToRule(l))) || '_none_'}) |`;
|
|
219
245
|
}).join('\n')}
|
|
220
246
|
|
|
247
|
+
${(0, doc_structure_1.section)('Result Certainty', 3, 'result-certainty')}
|
|
248
|
+
|
|
249
|
+
| Result Certainty | Description |
|
|
250
|
+
| ---------------- | :---------- |
|
|
251
|
+
${Object.entries(linter_format_1.LintingResultCertainty).map(([name, certainty]) => `| <a id="${certainty}"></a> \`${certainty}\` | ${(0, doc_types_1.getDocumentationForType)('LintingResultCertainty::' + name, tagTypes.info).replaceAll(/\n/g, ' ')} |`).join('\n')}
|
|
252
|
+
|
|
221
253
|
`.trim();
|
|
222
254
|
}
|
|
223
255
|
async function getRulesPages(shell, tagTypes, rVersion) {
|
|
@@ -4,16 +4,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const log_1 = require("../../test/functionality/_helper/log");
|
|
7
|
+
const log_2 = require("../util/log");
|
|
7
8
|
const doc_code_1 = require("./doc-util/doc-code");
|
|
8
9
|
const doc_files_1 = require("./doc-util/doc-files");
|
|
9
10
|
const doc_structure_1 = require("./doc-util/doc-structure");
|
|
10
11
|
const doc_types_1 = require("./doc-util/doc-types");
|
|
11
12
|
const path_1 = __importDefault(require("path"));
|
|
12
13
|
const doc_auto_gen_1 = require("./doc-util/doc-auto-gen");
|
|
14
|
+
const doc_cli_option_1 = require("./doc-util/doc-cli-option");
|
|
13
15
|
function getText() {
|
|
14
16
|
const { info } = (0, doc_types_1.getTypesFromFolder)({
|
|
15
17
|
rootFolder: path_1.default.resolve('./test'),
|
|
16
|
-
files: [path_1.default.resolve('./src/dataflow/graph/dataflowgraph-builder.ts')],
|
|
18
|
+
files: [path_1.default.resolve('./src/dataflow/graph/dataflowgraph-builder.ts'), path_1.default.resolve('./src/util/log.ts'), path_1.default.resolve('./src/slicing/static/static-slicer.ts')],
|
|
17
19
|
typeNameForMermaid: 'parameter',
|
|
18
20
|
inlineTypes: doc_types_1.mermaidHide
|
|
19
21
|
});
|
|
@@ -39,6 +41,7 @@ for the latest benchmark results, see the [benchmark results](${doc_files_1.Flow
|
|
|
39
41
|
- [License Checker](#license-checker)
|
|
40
42
|
- [🐛 Debugging](#debugging)
|
|
41
43
|
- [VS Code](#vs-code-1)
|
|
44
|
+
- [Logging](#logging)
|
|
42
45
|
|
|
43
46
|
<a id='testing-suites'></a>
|
|
44
47
|
## 🏨 Testing Suites
|
|
@@ -254,6 +257,15 @@ However, in case you think that the linter is wrong, please do not hesitate to o
|
|
|
254
257
|
### VS Code
|
|
255
258
|
When working with VS Code, you can attach a debugger to the REPL. This works automatically by running the \`Start Debugging\` command (\`F5\` by default).
|
|
256
259
|
You can also set the \`Auto Attach Filter\` setting to automatically attach the debugger, when running \`npm run flowr\`.
|
|
260
|
+
|
|
261
|
+
### Logging
|
|
262
|
+
|
|
263
|
+
*flowR* uses a wrapper around [tslog](https://www.npmjs.com/package/tslog) using a class named
|
|
264
|
+
${(0, doc_types_1.shortLink)(log_2.FlowrLogger.name, info)}. They obey to, for example, the ${(0, doc_cli_option_1.getCliLongOptionOf)('flowr', 'verbose')}
|
|
265
|
+
option. Throughout *flowR*, we use the \`log\` object (or subloggers of it) for logging.
|
|
266
|
+
To create your own logger, you can use ${(0, doc_types_1.shortLink)(log_2.FlowrLogger.name + '::' + (new log_2.FlowrLogger().getSubLogger.name), info, true, 'i')}.
|
|
267
|
+
For example, check out the ${(0, doc_types_1.shortLink)('slicerLogger', info)} for the static slicer.
|
|
268
|
+
|
|
257
269
|
`;
|
|
258
270
|
}
|
|
259
271
|
if (require.main === module) {
|
|
@@ -13,6 +13,10 @@ To get started developing on *flowR*, we recommend carefully reading the followi
|
|
|
13
13
|
- 💖 [Contributing guidelines](${doc_files_1.FlowrGithubBaseRef}/flowr/tree/main/.github/CONTRIBUTING.md).\
|
|
14
14
|
This page also includes information about how to set up **git-lfs** and several **git hooks**.
|
|
15
15
|
|
|
16
|
+
If you have any questions, please check out the [FAQ](${doc_files_1.FlowrWikiBaseRef}/FAQ) first, but if the question
|
|
17
|
+
is not answered there (or in the wiki in general), feel free to ask a question.
|
|
18
|
+
|
|
19
|
+
|
|
16
20
|
## ⌛ TL;DR
|
|
17
21
|
|
|
18
22
|
The most important steps to get the *flowR* development environment set up (after installing **R** and **Node.js**) can be seen below. For convenience, they can be executed all at once using the following command:
|
|
@@ -36,6 +36,8 @@ const doc_types_1 = require("./doc-util/doc-types");
|
|
|
36
36
|
const path_1 = __importDefault(require("path"));
|
|
37
37
|
const control_flow_query_executor_1 = require("../queries/catalog/control-flow-query/control-flow-query-executor");
|
|
38
38
|
const doc_cfg_1 = require("./doc-util/doc-cfg");
|
|
39
|
+
const df_shape_query_executor_1 = require("../queries/catalog/df-shape-query/df-shape-query-executor");
|
|
40
|
+
const _00_slice_1 = require("../core/steps/all/static-slicing/00-slice");
|
|
39
41
|
(0, doc_query_1.registerQueryDocumentation)('call-context', {
|
|
40
42
|
name: 'Call-Context Query',
|
|
41
43
|
type: 'active',
|
|
@@ -333,6 +335,22 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
|
333
335
|
This query provides access to the current configuration of the flowR instance. See the [Interface](${doc_files_1.FlowrWikiBaseRef}/Interface) wiki page for more information on what the configuration represents.`;
|
|
334
336
|
}
|
|
335
337
|
});
|
|
338
|
+
(0, doc_query_1.registerQueryDocumentation)('df-shape', {
|
|
339
|
+
name: 'Dataframe Shape Inference Query',
|
|
340
|
+
type: 'active',
|
|
341
|
+
shortDescription: 'Returns the shapes inferred for all dataframes in the code.',
|
|
342
|
+
functionName: df_shape_query_executor_1.executeDfShapeQuery.name,
|
|
343
|
+
functionFile: '../queries/catalog/df-shape-query/df-shape-query-format.ts',
|
|
344
|
+
buildExplanation: async (shell) => {
|
|
345
|
+
const exampleCode = 'x <- data.frame(a=1:3)\nfilter(x, FALSE)';
|
|
346
|
+
return `
|
|
347
|
+
This query infers all shapes of dataframes within the code. For example, you can use:
|
|
348
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
349
|
+
type: 'df-shape'
|
|
350
|
+
}], { showCode: true, collapseQuery: true })}
|
|
351
|
+
`;
|
|
352
|
+
}
|
|
353
|
+
});
|
|
336
354
|
(0, doc_query_1.registerQueryDocumentation)('compound', {
|
|
337
355
|
name: 'Compound Query',
|
|
338
356
|
type: 'virtual',
|
|
@@ -390,15 +408,15 @@ Now, the results no longer contain calls to \`plot\` that are not defined locall
|
|
|
390
408
|
(0, doc_query_1.registerQueryDocumentation)('static-slice', {
|
|
391
409
|
name: 'Static Slice Query',
|
|
392
410
|
type: 'active',
|
|
393
|
-
shortDescription: 'Slice the dataflow graph reducing the code to just the parts relevant for the given criteria.',
|
|
411
|
+
shortDescription: 'Slice the dataflow graph reducing the code to just the parts relevant for the given criteria (backward and forward).',
|
|
394
412
|
functionName: static_slice_query_executor_1.executeStaticSliceQuery.name,
|
|
395
413
|
functionFile: '../queries/catalog/static-slice-query/static-slice-query-executor.ts',
|
|
396
414
|
buildExplanation: async (shell) => {
|
|
397
415
|
const exampleCode = 'x <- 1\ny <- 2\nx';
|
|
398
416
|
return `
|
|
399
417
|
To slice, _flowR_ needs one thing from you: a variable or a list of variables (function calls are supported to, referring to the anonymous
|
|
400
|
-
return of the call) that you want to slice the dataflow graph for.
|
|
401
|
-
Given this, the slice is essentially the subpart of the program that may influence the value of the variables you are interested in.
|
|
418
|
+
return of the call) that you want to slice the dataflow graph for (additionally, you have to tell flowR if you want to have a forward slice).
|
|
419
|
+
Given this, the backward slice is essentially the subpart of the program that may influence the value of the variables you are interested in.
|
|
402
420
|
To specify a variable of interest, you have to present flowR with a [slicing criterion](${doc_files_1.FlowrWikiBaseRef}/Terminology#slicing-criterion) (or, respectively, an array of them).
|
|
403
421
|
|
|
404
422
|
To exemplify the capabilities, consider the following code:
|
|
@@ -419,6 +437,14 @@ ${(0, doc_structure_1.details)('No Reconstruction Example', await (0, doc_query_
|
|
|
419
437
|
noReconstruction: true
|
|
420
438
|
}], { showCode: false }))}
|
|
421
439
|
|
|
440
|
+
Likewise, if you want the forward slice for the first use of \`x\`, you can do it like this:
|
|
441
|
+
|
|
442
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
443
|
+
type: 'static-slice',
|
|
444
|
+
criteria: ['1@x'],
|
|
445
|
+
direction: _00_slice_1.SliceDirection.Forward
|
|
446
|
+
}], { showCode: false })}
|
|
447
|
+
|
|
422
448
|
You can disable [magic comments](${doc_files_1.FlowrWikiBaseRef}/Interface#slice-magic-comments) using the \`noMagicComments\` flag.
|
|
423
449
|
This query replaces the old [\`request-slice\`](${doc_files_1.FlowrWikiBaseRef}/Interface#message-request-slice) message.
|
|
424
450
|
`;
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
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
|
-
const flowr_search_1 = require("../search/flowr-search");
|
|
7
6
|
const objects_1 = require("../util/objects");
|
|
8
7
|
function executeLintingRule(ruleName, input, lintingRuleConfig) {
|
|
9
8
|
const rule = linter_rules_1.LintingRules[ruleName];
|
|
@@ -13,7 +12,7 @@ function executeLintingRule(ruleName, input, lintingRuleConfig) {
|
|
|
13
12
|
const searchResult = (0, flowr_search_executor_1.runSearch)(ruleSearch, input);
|
|
14
13
|
const searchTime = Date.now() - searchStart;
|
|
15
14
|
const processStart = Date.now();
|
|
16
|
-
const result = rule.processSearchResult(
|
|
15
|
+
const result = rule.processSearchResult(searchResult, fullConfig, input);
|
|
17
16
|
const processTime = Date.now() - processStart;
|
|
18
17
|
return {
|
|
19
18
|
...result,
|
|
@@ -22,6 +22,10 @@ export interface LinterRuleInformation<Config extends MergeableRecord = never> {
|
|
|
22
22
|
* A short list of tags that describe and categorize the linting rule.
|
|
23
23
|
*/
|
|
24
24
|
readonly tags: readonly LintingRuleTag[];
|
|
25
|
+
/**
|
|
26
|
+
* The linting rule's certainty in terms of the rule's calculations' precision and recall.
|
|
27
|
+
*/
|
|
28
|
+
readonly certainty: LintingRuleCertainty;
|
|
25
29
|
/**
|
|
26
30
|
* A short description of the linting rule.
|
|
27
31
|
* This is used to display the rule in the UI and to provide a brief overview of what the rule does.
|
|
@@ -91,7 +95,7 @@ export type LintQuickFix = LintQuickFixReplacement | LintQuickFixRemove;
|
|
|
91
95
|
* A linting result for a single linting rule match.
|
|
92
96
|
*/
|
|
93
97
|
export interface LintingResult {
|
|
94
|
-
readonly certainty:
|
|
98
|
+
readonly certainty: LintingResultCertainty;
|
|
95
99
|
/**
|
|
96
100
|
* If available, what to do to fix the linting result.
|
|
97
101
|
*/
|
|
@@ -108,15 +112,33 @@ export interface LintingResults<Name extends LintingRuleNames> {
|
|
|
108
112
|
readonly processTimeMs: number;
|
|
109
113
|
};
|
|
110
114
|
}
|
|
111
|
-
export declare enum
|
|
115
|
+
export declare enum LintingResultCertainty {
|
|
112
116
|
/**
|
|
113
117
|
* The linting rule cannot say for sure whether the result is correct or not.
|
|
118
|
+
* This linting certainty should be used for linting results whose calculations are based on estimations involving unknown side-effects, reflection, etc.
|
|
114
119
|
*/
|
|
115
|
-
|
|
120
|
+
Uncertain = "uncertain",
|
|
116
121
|
/**
|
|
117
122
|
* The linting rule is certain that the reported lint is real.
|
|
123
|
+
* This linting certainty should be used for linting results whose calculations do not involve estimates or other unknown factors.
|
|
124
|
+
*/
|
|
125
|
+
Certain = "certain"
|
|
126
|
+
}
|
|
127
|
+
export declare enum LintingRuleCertainty {
|
|
128
|
+
/**
|
|
129
|
+
* Linting rules that are expected to have both high precision and high recall.
|
|
130
|
+
*/
|
|
131
|
+
Exact = "exact",
|
|
132
|
+
/**
|
|
133
|
+
* Linting rules that are expected to have high precision, but not necessarily high recall.
|
|
134
|
+
* Rules with this certainty generally ensure that the results they return are correct, but may not return all results.
|
|
135
|
+
*/
|
|
136
|
+
BestEffort = "best-effort",
|
|
137
|
+
/**
|
|
138
|
+
* Linting rules that are expected to have high recall, but not necessarily high precision.
|
|
139
|
+
* Rules with this certainty generally return all relevant results, but may also include some incorrect matches.
|
|
118
140
|
*/
|
|
119
|
-
|
|
141
|
+
OverApproximative = "over-approximative"
|
|
120
142
|
}
|
|
121
143
|
export declare enum LintingPrettyPrintContext {
|
|
122
144
|
Query = "query",
|
package/linter/linter-format.js
CHANGED
|
@@ -1,17 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LintingPrettyPrintContext = exports.
|
|
4
|
-
var
|
|
5
|
-
(function (
|
|
3
|
+
exports.LintingPrettyPrintContext = exports.LintingRuleCertainty = exports.LintingResultCertainty = void 0;
|
|
4
|
+
var LintingResultCertainty;
|
|
5
|
+
(function (LintingResultCertainty) {
|
|
6
6
|
/**
|
|
7
7
|
* The linting rule cannot say for sure whether the result is correct or not.
|
|
8
|
+
* This linting certainty should be used for linting results whose calculations are based on estimations involving unknown side-effects, reflection, etc.
|
|
8
9
|
*/
|
|
9
|
-
|
|
10
|
+
LintingResultCertainty["Uncertain"] = "uncertain";
|
|
10
11
|
/**
|
|
11
12
|
* The linting rule is certain that the reported lint is real.
|
|
13
|
+
* This linting certainty should be used for linting results whose calculations do not involve estimates or other unknown factors.
|
|
12
14
|
*/
|
|
13
|
-
|
|
14
|
-
})(
|
|
15
|
+
LintingResultCertainty["Certain"] = "certain";
|
|
16
|
+
})(LintingResultCertainty || (exports.LintingResultCertainty = LintingResultCertainty = {}));
|
|
17
|
+
var LintingRuleCertainty;
|
|
18
|
+
(function (LintingRuleCertainty) {
|
|
19
|
+
/**
|
|
20
|
+
* Linting rules that are expected to have both high precision and high recall.
|
|
21
|
+
*/
|
|
22
|
+
LintingRuleCertainty["Exact"] = "exact";
|
|
23
|
+
/**
|
|
24
|
+
* Linting rules that are expected to have high precision, but not necessarily high recall.
|
|
25
|
+
* Rules with this certainty generally ensure that the results they return are correct, but may not return all results.
|
|
26
|
+
*/
|
|
27
|
+
LintingRuleCertainty["BestEffort"] = "best-effort";
|
|
28
|
+
/**
|
|
29
|
+
* Linting rules that are expected to have high recall, but not necessarily high precision.
|
|
30
|
+
* Rules with this certainty generally return all relevant results, but may also include some incorrect matches.
|
|
31
|
+
*/
|
|
32
|
+
LintingRuleCertainty["OverApproximative"] = "over-approximative";
|
|
33
|
+
})(LintingRuleCertainty || (exports.LintingRuleCertainty = LintingRuleCertainty = {}));
|
|
15
34
|
var LintingPrettyPrintContext;
|
|
16
35
|
(function (LintingPrettyPrintContext) {
|
|
17
36
|
LintingPrettyPrintContext["Query"] = "query";
|
package/linter/linter-rules.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare const LintingRules: {
|
|
|
8
8
|
readonly createSearch: (config: import("./rules/deprecated-functions").DeprecatedFunctionsConfig) => import("../search/flowr-search-builder").FlowrSearchBuilder<"all", ["with", "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>[]>>;
|
|
9
9
|
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>[]>) => {
|
|
10
10
|
results: {
|
|
11
|
-
certainty: import("./linter-format").
|
|
11
|
+
certainty: import("./linter-format").LintingResultCertainty.Certain;
|
|
12
12
|
function: import("../dataflow/environments/identifier").Identifier;
|
|
13
13
|
range: import("../util/range").SourceRange;
|
|
14
14
|
}[];
|
|
@@ -21,6 +21,7 @@ export declare const LintingRules: {
|
|
|
21
21
|
readonly info: {
|
|
22
22
|
readonly name: "Deprecated Functions";
|
|
23
23
|
readonly tags: readonly [import("./linter-tags").LintingRuleTag.Deprecated, import("./linter-tags").LintingRuleTag.Smell, import("./linter-tags").LintingRuleTag.Usability, import("./linter-tags").LintingRuleTag.Reproducibility];
|
|
24
|
+
readonly certainty: import("./linter-format").LintingRuleCertainty.BestEffort;
|
|
24
25
|
readonly description: "Marks deprecated functions that should not be used anymore.";
|
|
25
26
|
readonly defaultConfig: {
|
|
26
27
|
readonly deprecatedFunctions: 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,8 +29,8 @@ export declare const LintingRules: {
|
|
|
28
29
|
};
|
|
29
30
|
};
|
|
30
31
|
readonly 'file-path-validity': {
|
|
31
|
-
readonly createSearch: (config: import("./rules/file-path-validity").FilePathValidityConfig) => import("../search/flowr-search-builder").FlowrSearchBuilder<"from-query", [], 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").
|
|
32
|
-
readonly processSearchResult: (elements: import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").
|
|
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>[]>>;
|
|
33
|
+
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: {
|
|
33
34
|
normalize: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
34
35
|
dataflow: import("../dataflow/info").DataflowInformation;
|
|
35
36
|
config: import("../config").FlowrConfigOptions;
|
|
@@ -40,6 +41,7 @@ export declare const LintingRules: {
|
|
|
40
41
|
readonly info: {
|
|
41
42
|
readonly name: "File Path Validity";
|
|
42
43
|
readonly description: "Checks whether file paths used in read and write operations are valid and point to existing files.";
|
|
44
|
+
readonly certainty: import("./linter-format").LintingRuleCertainty.BestEffort;
|
|
43
45
|
readonly tags: readonly [import("./linter-tags").LintingRuleTag.Robustness, import("./linter-tags").LintingRuleTag.Reproducibility, import("./linter-tags").LintingRuleTag.Bug];
|
|
44
46
|
readonly defaultConfig: {
|
|
45
47
|
readonly additionalReadFunctions: readonly [];
|
|
@@ -53,14 +55,14 @@ export declare const LintingRules: {
|
|
|
53
55
|
};
|
|
54
56
|
};
|
|
55
57
|
readonly 'seeded-randomness': {
|
|
56
|
-
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/
|
|
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>[]>>;
|
|
57
59
|
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 }: {
|
|
58
60
|
normalize: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
59
61
|
dataflow: import("../dataflow/info").DataflowInformation;
|
|
60
62
|
config: import("../config").FlowrConfigOptions;
|
|
61
63
|
}) => {
|
|
62
64
|
results: {
|
|
63
|
-
certainty: import("./linter-format").
|
|
65
|
+
certainty: import("./linter-format").LintingResultCertainty.Certain;
|
|
64
66
|
function: import("../dataflow/environments/identifier").Identifier;
|
|
65
67
|
range: import("../util/range").SourceRange;
|
|
66
68
|
}[];
|
|
@@ -78,6 +80,7 @@ export declare const LintingRules: {
|
|
|
78
80
|
readonly randomnessConsumers: readonly ["jitter", "sample", "sample.int", "arima.sim", "kmeans", "princomp", "rcauchy", "rchisq", "rexp", "rgamma", "rgeom", "rlnorm", "rlogis", "rmultinom", "rnbinom", "rnorm", "rpois", "runif", "pointLabel", "some", "rbernoulli", "rdunif", "generateSeedVectors"];
|
|
79
81
|
};
|
|
80
82
|
readonly tags: readonly [import("./linter-tags").LintingRuleTag.Robustness, import("./linter-tags").LintingRuleTag.Reproducibility];
|
|
83
|
+
readonly certainty: import("./linter-format").LintingRuleCertainty.BestEffort;
|
|
81
84
|
readonly name: "Seeded Randomness";
|
|
82
85
|
readonly description: "Checks whether randomness-based function calls are preceded by a random seed generation function. For consistent reproducibility, functions that use randomness should only be called after a constant random seed is set using a function like `set.seed`.";
|
|
83
86
|
};
|
|
@@ -88,11 +91,7 @@ export declare const LintingRules: {
|
|
|
88
91
|
};
|
|
89
92
|
readonly 'absolute-file-paths': {
|
|
90
93
|
readonly createSearch: (config: import("./rules/absolute-path").AbsoluteFilePathConfig) => import("../search/flowr-search-builder").FlowrSearchBuilder<"from-query", ["unique"], 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>[]>>;
|
|
91
|
-
readonly processSearchResult: (elements: import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, {
|
|
92
|
-
readonly query?: "config" | "origin" | "dataflow" | "search" | "call-context" | "control-flow" | "dataflow-lens" | "normalized-ast" | "id-map" | "dataflow-cluster" | "static-slice" | "lineage" | "dependencies" | "location-map" | "happens-before" | "resolve-value" | "project" | "linter" | undefined;
|
|
93
|
-
readonly queryResult?: import("../queries/base-query-format").BaseQueryResult | undefined;
|
|
94
|
-
readonly node: import("../r-bridge/lang-4.x/ast/model/nodes/r-expression-list").RExpressionList<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation> | import("../r-bridge/lang-4.x/ast/model/nodes/r-function-definition").RFunctionDefinition<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation> | import("../r-bridge/lang-4.x/ast/model/nodes/r-function-call").RNamedFunctionCall<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation> | import("../r-bridge/lang-4.x/ast/model/nodes/r-function-call").RUnnamedFunctionCall<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation> | import("../r-bridge/lang-4.x/ast/model/nodes/r-parameter").RParameter<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation> | import("../r-bridge/lang-4.x/ast/model/nodes/r-argument").RArgument<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation> | import("../r-bridge/lang-4.x/ast/model/nodes/r-comment").RComment<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation> | import("../r-bridge/lang-4.x/ast/model/nodes/r-line-directive").RLineDirective<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation> | import("../r-bridge/lang-4.x/ast/model/nodes/r-for-loop").RForLoop<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation> | import("../r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop").RRepeatLoop<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation> | import("../r-bridge/lang-4.x/ast/model/nodes/r-while-loop").RWhileLoop<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation> | import("../r-bridge/lang-4.x/ast/model/nodes/r-if-then-else").RIfThenElse<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation> | import("../r-bridge/lang-4.x/ast/model/nodes/r-access").RNamedAccess<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation> | import("../r-bridge/lang-4.x/ast/model/nodes/r-access").RIndexAccess<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation> | import("../r-bridge/lang-4.x/ast/model/nodes/r-unary-op").RUnaryOp<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation> | import("../r-bridge/lang-4.x/ast/model/nodes/r-binary-op").RBinaryOp<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation> | import("../r-bridge/lang-4.x/ast/model/nodes/r-symbol").RSymbol<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, string> | import("../r-bridge/lang-4.x/ast/model/nodes/r-number").RNumber<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation> | import("../r-bridge/lang-4.x/ast/model/nodes/r-string").RString<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation> | import("../r-bridge/lang-4.x/ast/model/nodes/r-logical").RLogical<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation> | import("../r-bridge/lang-4.x/ast/model/nodes/r-break").RBreak<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation> | import("../r-bridge/lang-4.x/ast/model/nodes/r-next").RNext<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation> | import("../r-bridge/lang-4.x/ast/model/nodes/r-pipe").RPipe<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>;
|
|
95
|
-
}[]>, config: import("./rules/absolute-path").AbsoluteFilePathConfig, data: {
|
|
94
|
+
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: {
|
|
96
95
|
normalize: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
97
96
|
dataflow: import("../dataflow/info").DataflowInformation;
|
|
98
97
|
config: import("../config").FlowrConfigOptions;
|
|
@@ -108,6 +107,7 @@ export declare const LintingRules: {
|
|
|
108
107
|
readonly name: "Absolute Paths";
|
|
109
108
|
readonly description: "Checks whether file paths are absolute.";
|
|
110
109
|
readonly tags: readonly [import("./linter-tags").LintingRuleTag.Robustness, import("./linter-tags").LintingRuleTag.Reproducibility, import("./linter-tags").LintingRuleTag.Smell, import("./linter-tags").LintingRuleTag.QuickFix];
|
|
110
|
+
readonly certainty: import("./linter-format").LintingRuleCertainty.BestEffort;
|
|
111
111
|
readonly defaultConfig: {
|
|
112
112
|
readonly include: {
|
|
113
113
|
readonly constructed: true;
|
|
@@ -137,6 +137,7 @@ export declare const LintingRules: {
|
|
|
137
137
|
readonly name: "Unused Definitions";
|
|
138
138
|
readonly description: "Checks for unused definitions.";
|
|
139
139
|
readonly tags: readonly [import("./linter-tags").LintingRuleTag.Readability, import("./linter-tags").LintingRuleTag.Smell, import("./linter-tags").LintingRuleTag.QuickFix];
|
|
140
|
+
readonly certainty: import("./linter-format").LintingRuleCertainty.BestEffort;
|
|
140
141
|
readonly defaultConfig: {
|
|
141
142
|
readonly includeFunctionDefinitions: true;
|
|
142
143
|
};
|
|
@@ -151,7 +152,7 @@ export declare const LintingRules: {
|
|
|
151
152
|
}) => {
|
|
152
153
|
results: {
|
|
153
154
|
quickFix: import("./linter-format").LintQuickFixReplacement[] | undefined;
|
|
154
|
-
certainty: import("./linter-format").
|
|
155
|
+
certainty: import("./linter-format").LintingResultCertainty;
|
|
155
156
|
detectedCasing: import("./rules/naming-convention").CasingConvention;
|
|
156
157
|
name: string;
|
|
157
158
|
range: import("../util/range").SourceRange;
|
|
@@ -167,13 +168,63 @@ export declare const LintingRules: {
|
|
|
167
168
|
};
|
|
168
169
|
readonly info: {
|
|
169
170
|
readonly name: "Naming Convention";
|
|
171
|
+
readonly certainty: import("./linter-format").LintingRuleCertainty.OverApproximative;
|
|
170
172
|
readonly description: "Checks wether the symbols conform to a certain naming convention";
|
|
171
173
|
readonly tags: readonly [import("./linter-tags").LintingRuleTag.Style, import("./linter-tags").LintingRuleTag.QuickFix];
|
|
172
174
|
readonly defaultConfig: {
|
|
173
|
-
readonly caseing:
|
|
175
|
+
readonly caseing: "auto";
|
|
174
176
|
};
|
|
175
177
|
};
|
|
176
178
|
};
|
|
179
|
+
readonly 'dataframe-access-validation': {
|
|
180
|
+
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>[]>>;
|
|
181
|
+
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: {
|
|
182
|
+
normalize: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
183
|
+
dataflow: import("../dataflow/info").DataflowInformation;
|
|
184
|
+
config: import("../config").FlowrConfigOptions;
|
|
185
|
+
}) => {
|
|
186
|
+
results: import("./rules/dataframe-access-validation").DataFrameAccessValidationResult[];
|
|
187
|
+
'.meta': import("./rules/dataframe-access-validation").DataFrameAccessValidationMetadata;
|
|
188
|
+
};
|
|
189
|
+
readonly prettyPrint: {
|
|
190
|
+
readonly query: (result: import("./rules/dataframe-access-validation").DataFrameAccessValidationResult) => string;
|
|
191
|
+
readonly full: (result: import("./rules/dataframe-access-validation").DataFrameAccessValidationResult) => string;
|
|
192
|
+
};
|
|
193
|
+
readonly info: {
|
|
194
|
+
readonly name: "Dataframe Access Validation";
|
|
195
|
+
readonly tags: readonly [import("./linter-tags").LintingRuleTag.Bug, import("./linter-tags").LintingRuleTag.Usability, import("./linter-tags").LintingRuleTag.Reproducibility];
|
|
196
|
+
readonly certainty: import("./linter-format").LintingRuleCertainty.BestEffort;
|
|
197
|
+
readonly description: "Validates the existance of accessed columns and rows of dataframes.";
|
|
198
|
+
readonly defaultConfig: {
|
|
199
|
+
readonly readLoadedData: false;
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
readonly 'dead-code': {
|
|
204
|
+
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>[]>>;
|
|
205
|
+
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: {
|
|
206
|
+
normalize: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
207
|
+
dataflow: import("../dataflow/info").DataflowInformation;
|
|
208
|
+
config: import("../config").FlowrConfigOptions;
|
|
209
|
+
}) => {
|
|
210
|
+
results: {
|
|
211
|
+
certainty: import("./linter-format").LintingResultCertainty.Certain;
|
|
212
|
+
range: import("../util/range").SourceRange;
|
|
213
|
+
}[];
|
|
214
|
+
'.meta': import("./rules/dead-code").DeadCodeMetadata;
|
|
215
|
+
};
|
|
216
|
+
readonly prettyPrint: {
|
|
217
|
+
readonly query: (result: import("./rules/dead-code").DeadCodeResult) => string;
|
|
218
|
+
readonly full: (result: import("./rules/dead-code").DeadCodeResult) => string;
|
|
219
|
+
};
|
|
220
|
+
readonly info: {
|
|
221
|
+
readonly name: "Dead Code";
|
|
222
|
+
readonly tags: readonly [import("./linter-tags").LintingRuleTag.Smell, import("./linter-tags").LintingRuleTag.Usability, import("./linter-tags").LintingRuleTag.Reproducibility];
|
|
223
|
+
readonly certainty: import("./linter-format").LintingRuleCertainty.BestEffort;
|
|
224
|
+
readonly description: "Marks areas of code that are never reached during execution.";
|
|
225
|
+
readonly defaultConfig: {};
|
|
226
|
+
};
|
|
227
|
+
};
|
|
177
228
|
};
|
|
178
229
|
export type LintingRuleNames = keyof typeof LintingRules;
|
|
179
230
|
export type LintingRuleMetadata<Name extends LintingRuleNames> = typeof LintingRules[Name] extends LintingRule<infer _Result, infer Metadata, infer _Config, infer _Info, infer _Elements> ? Metadata : never;
|
package/linter/linter-rules.js
CHANGED
|
@@ -5,8 +5,10 @@ const deprecated_functions_1 = require("./rules/deprecated-functions");
|
|
|
5
5
|
const file_path_validity_1 = require("./rules/file-path-validity");
|
|
6
6
|
const absolute_path_1 = require("./rules/absolute-path");
|
|
7
7
|
const unused_definition_1 = require("./rules/unused-definition");
|
|
8
|
+
const dead_code_1 = require("./rules/dead-code");
|
|
8
9
|
const seeded_randomness_1 = require("./rules/seeded-randomness");
|
|
9
10
|
const naming_convention_1 = require("./rules/naming-convention");
|
|
11
|
+
const dataframe_access_validation_1 = require("./rules/dataframe-access-validation");
|
|
10
12
|
/**
|
|
11
13
|
* The registry of currently supported linting rules.
|
|
12
14
|
* A linting rule can be executed on a dataflow pipeline result using {@link executeLintingRule}.
|
|
@@ -17,6 +19,8 @@ exports.LintingRules = {
|
|
|
17
19
|
'seeded-randomness': seeded_randomness_1.SEEDED_RANDOMNESS,
|
|
18
20
|
'absolute-file-paths': absolute_path_1.ABSOLUTE_PATH,
|
|
19
21
|
'unused-definitions': unused_definition_1.UNUSED_DEFINITION,
|
|
20
|
-
'naming-convention': naming_convention_1.NAMING_CONVENTION
|
|
22
|
+
'naming-convention': naming_convention_1.NAMING_CONVENTION,
|
|
23
|
+
'dataframe-access-validation': dataframe_access_validation_1.DATA_FRAME_ACCESS_VALIDATION,
|
|
24
|
+
'dead-code': dead_code_1.DEAD_CODE,
|
|
21
25
|
};
|
|
22
26
|
//# sourceMappingURL=linter-rules.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { LintingResult } from '../linter-format';
|
|
2
|
+
import { LintingRuleCertainty } from '../linter-format';
|
|
2
3
|
import type { MergeableRecord } from '../../util/objects';
|
|
3
4
|
import type { SourceRange } from '../../util/range';
|
|
4
5
|
import { LintingRuleTag } from '../linter-tags';
|
|
5
6
|
import type { FunctionInfo } from '../../queries/catalog/dependencies-query/function-info/function-info';
|
|
6
|
-
import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
7
7
|
import type { FlowrConfigOptions } from '../../config';
|
|
8
8
|
export interface AbsoluteFilePathResult extends LintingResult {
|
|
9
9
|
filePath: string;
|
|
@@ -36,12 +36,8 @@ export interface AbsoluteFilePathMetadata extends MergeableRecord {
|
|
|
36
36
|
totalUnknown: number;
|
|
37
37
|
}
|
|
38
38
|
export declare const ABSOLUTE_PATH: {
|
|
39
|
-
readonly createSearch: (config: AbsoluteFilePathConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"from-query", ["unique"], ParentInformation, import("../../search/flowr-search").FlowrSearchElements<ParentInformation, import("../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>>;
|
|
40
|
-
readonly processSearchResult: (elements: import("../../search/flowr-search").FlowrSearchElements<ParentInformation, {
|
|
41
|
-
readonly query?: "config" | "origin" | "dataflow" | "search" | "call-context" | "control-flow" | "dataflow-lens" | "normalized-ast" | "id-map" | "dataflow-cluster" | "static-slice" | "lineage" | "dependencies" | "location-map" | "happens-before" | "resolve-value" | "project" | "linter" | undefined;
|
|
42
|
-
readonly queryResult?: import("../../queries/base-query-format").BaseQueryResult | undefined;
|
|
43
|
-
readonly node: import("../../r-bridge/lang-4.x/ast/model/nodes/r-expression-list").RExpressionList<ParentInformation> | import("../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition").RFunctionDefinition<ParentInformation> | import("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call").RNamedFunctionCall<ParentInformation> | import("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call").RUnnamedFunctionCall<ParentInformation> | import("../../r-bridge/lang-4.x/ast/model/nodes/r-parameter").RParameter<ParentInformation> | import("../../r-bridge/lang-4.x/ast/model/nodes/r-argument").RArgument<ParentInformation> | import("../../r-bridge/lang-4.x/ast/model/nodes/r-comment").RComment<ParentInformation> | import("../../r-bridge/lang-4.x/ast/model/nodes/r-line-directive").RLineDirective<ParentInformation> | import("../../r-bridge/lang-4.x/ast/model/nodes/r-for-loop").RForLoop<ParentInformation> | import("../../r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop").RRepeatLoop<ParentInformation> | import("../../r-bridge/lang-4.x/ast/model/nodes/r-while-loop").RWhileLoop<ParentInformation> | import("../../r-bridge/lang-4.x/ast/model/nodes/r-if-then-else").RIfThenElse<ParentInformation> | import("../../r-bridge/lang-4.x/ast/model/nodes/r-access").RNamedAccess<ParentInformation> | import("../../r-bridge/lang-4.x/ast/model/nodes/r-access").RIndexAccess<ParentInformation> | import("../../r-bridge/lang-4.x/ast/model/nodes/r-unary-op").RUnaryOp<ParentInformation> | import("../../r-bridge/lang-4.x/ast/model/nodes/r-binary-op").RBinaryOp<ParentInformation> | import("../../r-bridge/lang-4.x/ast/model/nodes/r-symbol").RSymbol<ParentInformation, string> | import("../../r-bridge/lang-4.x/ast/model/nodes/r-number").RNumber<ParentInformation> | import("../../r-bridge/lang-4.x/ast/model/nodes/r-string").RString<ParentInformation> | import("../../r-bridge/lang-4.x/ast/model/nodes/r-logical").RLogical<ParentInformation> | import("../../r-bridge/lang-4.x/ast/model/nodes/r-break").RBreak<ParentInformation> | import("../../r-bridge/lang-4.x/ast/model/nodes/r-next").RNext<ParentInformation> | import("../../r-bridge/lang-4.x/ast/model/nodes/r-pipe").RPipe<ParentInformation>;
|
|
44
|
-
}[]>, config: AbsoluteFilePathConfig, data: {
|
|
39
|
+
readonly createSearch: (config: AbsoluteFilePathConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"from-query", ["unique"], 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>[]>>;
|
|
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: {
|
|
45
41
|
normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
46
42
|
dataflow: import("../../dataflow/info").DataflowInformation;
|
|
47
43
|
config: FlowrConfigOptions;
|
|
@@ -57,6 +53,7 @@ export declare const ABSOLUTE_PATH: {
|
|
|
57
53
|
readonly name: "Absolute Paths";
|
|
58
54
|
readonly description: "Checks whether file paths are absolute.";
|
|
59
55
|
readonly tags: readonly [LintingRuleTag.Robustness, LintingRuleTag.Reproducibility, LintingRuleTag.Smell, LintingRuleTag.QuickFix];
|
|
56
|
+
readonly certainty: LintingRuleCertainty.BestEffort;
|
|
60
57
|
readonly defaultConfig: {
|
|
61
58
|
readonly include: {
|
|
62
59
|
readonly constructed: true;
|