@eagleoutice/flowr 2.3.0 → 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 +41 -29
- package/abstract-interpretation/data-frame/absint-visitor.d.ts +2 -3
- package/abstract-interpretation/data-frame/absint-visitor.js +14 -16
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +3 -3
- package/abstract-interpretation/data-frame/semantics.d.ts +1 -1
- package/abstract-interpretation/data-frame/semantics.js +7 -10
- package/abstract-interpretation/data-frame/shape-inference.js +2 -8
- package/benchmark/slicer.js +7 -5
- package/benchmark/summarizer/second-phase/graph.js +1 -1
- package/benchmark/summarizer/second-phase/process.js +1 -1
- package/cli/benchmark-app.d.ts +1 -0
- package/cli/benchmark-app.js +1 -0
- package/cli/benchmark-helper-app.d.ts +1 -0
- package/cli/benchmark-helper-app.js +4 -3
- package/cli/common/options.js +2 -0
- package/cli/repl/commands/repl-query.js +1 -1
- package/cli/repl/server/connection.js +14 -5
- 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 +2 -8
- package/control-flow/control-flow-graph.js +1 -6
- package/control-flow/extract-cfg.d.ts +2 -2
- package/control-flow/extract-cfg.js +52 -63
- 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 +2 -2
- package/dataflow/environments/built-in.js +13 -12
- 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/documentation/doc-util/doc-query.js +1 -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-linter-wiki.js +32 -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 +12 -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 +40 -12
- package/linter/linter-rules.js +3 -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 +3 -1
- package/linter/rules/dataframe-access-validation.js +3 -1
- 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 +4 -3
- package/linter/rules/naming-convention.js +3 -1
- 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 +1 -1
- 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/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 +16 -5
- package/queries/query.js +24 -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/mermaid/dfg.js +4 -2
- package/util/range.d.ts +1 -0
- package/util/range.js +5 -1
- package/util/version.js +1 -1
|
@@ -37,6 +37,7 @@ 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
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");
|
|
40
41
|
(0, doc_query_1.registerQueryDocumentation)('call-context', {
|
|
41
42
|
name: 'Call-Context Query',
|
|
42
43
|
type: 'active',
|
|
@@ -407,15 +408,15 @@ Now, the results no longer contain calls to \`plot\` that are not defined locall
|
|
|
407
408
|
(0, doc_query_1.registerQueryDocumentation)('static-slice', {
|
|
408
409
|
name: 'Static Slice Query',
|
|
409
410
|
type: 'active',
|
|
410
|
-
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).',
|
|
411
412
|
functionName: static_slice_query_executor_1.executeStaticSliceQuery.name,
|
|
412
413
|
functionFile: '../queries/catalog/static-slice-query/static-slice-query-executor.ts',
|
|
413
414
|
buildExplanation: async (shell) => {
|
|
414
415
|
const exampleCode = 'x <- 1\ny <- 2\nx';
|
|
415
416
|
return `
|
|
416
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
|
|
417
|
-
return of the call) that you want to slice the dataflow graph for.
|
|
418
|
-
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.
|
|
419
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).
|
|
420
421
|
|
|
421
422
|
To exemplify the capabilities, consider the following code:
|
|
@@ -436,6 +437,14 @@ ${(0, doc_structure_1.details)('No Reconstruction Example', await (0, doc_query_
|
|
|
436
437
|
noReconstruction: true
|
|
437
438
|
}], { showCode: false }))}
|
|
438
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
|
+
|
|
439
448
|
You can disable [magic comments](${doc_files_1.FlowrWikiBaseRef}/Interface#slice-magic-comments) using the \`noMagicComments\` flag.
|
|
440
449
|
This query replaces the old [\`request-slice\`](${doc_files_1.FlowrWikiBaseRef}/Interface#message-request-slice) message.
|
|
441
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" | "df-shape" | "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,6 +168,7 @@ 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: {
|
|
@@ -175,7 +177,7 @@ export declare const LintingRules: {
|
|
|
175
177
|
};
|
|
176
178
|
};
|
|
177
179
|
readonly 'dataframe-access-validation': {
|
|
178
|
-
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/
|
|
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>[]>>;
|
|
179
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: {
|
|
180
182
|
normalize: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
181
183
|
dataflow: import("../dataflow/info").DataflowInformation;
|
|
@@ -191,12 +193,38 @@ export declare const LintingRules: {
|
|
|
191
193
|
readonly info: {
|
|
192
194
|
readonly name: "Dataframe Access Validation";
|
|
193
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;
|
|
194
197
|
readonly description: "Validates the existance of accessed columns and rows of dataframes.";
|
|
195
198
|
readonly defaultConfig: {
|
|
196
199
|
readonly readLoadedData: false;
|
|
197
200
|
};
|
|
198
201
|
};
|
|
199
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
|
+
};
|
|
200
228
|
};
|
|
201
229
|
export type LintingRuleNames = keyof typeof LintingRules;
|
|
202
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,6 +5,7 @@ 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");
|
|
10
11
|
const dataframe_access_validation_1 = require("./rules/dataframe-access-validation");
|
|
@@ -19,6 +20,7 @@ exports.LintingRules = {
|
|
|
19
20
|
'absolute-file-paths': absolute_path_1.ABSOLUTE_PATH,
|
|
20
21
|
'unused-definitions': unused_definition_1.UNUSED_DEFINITION,
|
|
21
22
|
'naming-convention': naming_convention_1.NAMING_CONVENTION,
|
|
22
|
-
'dataframe-access-validation': dataframe_access_validation_1.DATA_FRAME_ACCESS_VALIDATION
|
|
23
|
+
'dataframe-access-validation': dataframe_access_validation_1.DATA_FRAME_ACCESS_VALIDATION,
|
|
24
|
+
'dead-code': dead_code_1.DEAD_CODE,
|
|
23
25
|
};
|
|
24
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" | "df-shape" | "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;
|
|
@@ -87,7 +87,7 @@ exports.ABSOLUTE_PATH = {
|
|
|
87
87
|
}
|
|
88
88
|
if (config.include.constructed) {
|
|
89
89
|
q = q.merge(flowr_search_builder_1.Q.all().filter(vertex_1.VertexType.FunctionCall).with(search_enrichers_1.Enrichment.CallTargets));
|
|
90
|
-
/* in the future we want to directly check whether this is one of the supported functions */
|
|
90
|
+
/* in the future, we want to directly check whether this is one of the supported functions */
|
|
91
91
|
}
|
|
92
92
|
return q.unique();
|
|
93
93
|
},
|
|
@@ -96,6 +96,7 @@ exports.ABSOLUTE_PATH = {
|
|
|
96
96
|
totalConsidered: 0,
|
|
97
97
|
totalUnknown: 0
|
|
98
98
|
};
|
|
99
|
+
const queryResults = elements.enrichmentContent(search_enrichers_1.Enrichment.QueryData)?.queries;
|
|
99
100
|
const regex = config.absolutePathRegex ? new RegExp(config.absolutePathRegex) : undefined;
|
|
100
101
|
return {
|
|
101
102
|
results: elements.getElements().flatMap(element => {
|
|
@@ -105,7 +106,7 @@ exports.ABSOLUTE_PATH = {
|
|
|
105
106
|
if ((0, r_string_1.isRString)(node)) {
|
|
106
107
|
if (node.content.str.length >= 3 && (0, strings_1.isAbsolutePath)(node.content.str, regex)) {
|
|
107
108
|
return [{
|
|
108
|
-
certainty: linter_format_1.
|
|
109
|
+
certainty: linter_format_1.LintingResultCertainty.Uncertain,
|
|
109
110
|
filePath: node.content.str,
|
|
110
111
|
range: node.info.fullRange ?? node.location,
|
|
111
112
|
quickFix: buildQuickFix(node, node.content.str, wd)
|
|
@@ -115,12 +116,12 @@ exports.ABSOLUTE_PATH = {
|
|
|
115
116
|
return [];
|
|
116
117
|
}
|
|
117
118
|
}
|
|
118
|
-
else if (element.
|
|
119
|
-
const result = element.
|
|
119
|
+
else if ((0, search_enrichers_1.enrichmentContent)(element, search_enrichers_1.Enrichment.QueryData)) {
|
|
120
|
+
const result = queryResults[(0, search_enrichers_1.enrichmentContent)(element, search_enrichers_1.Enrichment.QueryData).query];
|
|
120
121
|
const mappedStrings = result.readData.filter(r => r.source !== dependencies_query_format_1.Unknown && (0, strings_1.isAbsolutePath)(r.source, regex)).map(r => {
|
|
121
122
|
const elem = data.normalize.idMap.get(r.nodeId);
|
|
122
123
|
return {
|
|
123
|
-
certainty: linter_format_1.
|
|
124
|
+
certainty: linter_format_1.LintingResultCertainty.Certain,
|
|
124
125
|
filePath: r.source,
|
|
125
126
|
range: elem?.info.fullRange ?? elem?.location ?? (0, range_1.rangeFrom)(-1, -1, -1, -1),
|
|
126
127
|
quickFix: buildQuickFix(elem, r.source, wd)
|
|
@@ -141,7 +142,7 @@ exports.ABSOLUTE_PATH = {
|
|
|
141
142
|
const strings = handler ? handler(data.dataflow.graph, dfNode, data.config) : [];
|
|
142
143
|
if (strings) {
|
|
143
144
|
return strings.filter(s => (0, strings_1.isAbsolutePath)(s, regex)).map(str => ({
|
|
144
|
-
certainty: linter_format_1.
|
|
145
|
+
certainty: linter_format_1.LintingResultCertainty.Uncertain,
|
|
145
146
|
filePath: str,
|
|
146
147
|
range: node.info.fullRange ?? node.location ?? (0, range_1.rangeFrom)(-1, -1, -1, -1)
|
|
147
148
|
}));
|
|
@@ -163,6 +164,8 @@ exports.ABSOLUTE_PATH = {
|
|
|
163
164
|
name: 'Absolute Paths',
|
|
164
165
|
description: 'Checks whether file paths are absolute.',
|
|
165
166
|
tags: [linter_tags_1.LintingRuleTag.Robustness, linter_tags_1.LintingRuleTag.Reproducibility, linter_tags_1.LintingRuleTag.Smell, linter_tags_1.LintingRuleTag.QuickFix],
|
|
167
|
+
// checks all found paths for whether they're absolute to ensure correctness, but doesn't handle non-constant paths so not all will be returned
|
|
168
|
+
certainty: linter_format_1.LintingRuleCertainty.BestEffort,
|
|
166
169
|
defaultConfig: {
|
|
167
170
|
include: {
|
|
168
171
|
constructed: true,
|
|
@@ -3,6 +3,7 @@ import type { FlowrSearchElements } from '../../search/flowr-search';
|
|
|
3
3
|
import { type MergeableRecord } from '../../util/objects';
|
|
4
4
|
import { type SourceRange } from '../../util/range';
|
|
5
5
|
import type { LintingResult } from '../linter-format';
|
|
6
|
+
import { LintingRuleCertainty } from '../linter-format';
|
|
6
7
|
import { LintingRuleTag } from '../linter-tags';
|
|
7
8
|
export interface DataFrameAccessValidationResult extends LintingResult {
|
|
8
9
|
/** The type of the data frame access ("column" or "row") */
|
|
@@ -29,7 +30,7 @@ export interface DataFrameAccessValidationMetadata extends MergeableRecord {
|
|
|
29
30
|
totalAccessed: number;
|
|
30
31
|
}
|
|
31
32
|
export declare const DATA_FRAME_ACCESS_VALIDATION: {
|
|
32
|
-
readonly createSearch: () => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["with"], ParentInformation, FlowrSearchElements<ParentInformation, import("../../search/
|
|
33
|
+
readonly createSearch: () => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["with"], ParentInformation, FlowrSearchElements<ParentInformation, import("../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>>;
|
|
33
34
|
readonly processSearchResult: (elements: FlowrSearchElements<ParentInformation, import("../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>, config: DataFrameAccessValidationConfig, data: {
|
|
34
35
|
normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
35
36
|
dataflow: import("../../dataflow/info").DataflowInformation;
|
|
@@ -45,6 +46,7 @@ export declare const DATA_FRAME_ACCESS_VALIDATION: {
|
|
|
45
46
|
readonly info: {
|
|
46
47
|
readonly name: "Dataframe Access Validation";
|
|
47
48
|
readonly tags: readonly [LintingRuleTag.Bug, LintingRuleTag.Usability, LintingRuleTag.Reproducibility];
|
|
49
|
+
readonly certainty: LintingRuleCertainty.BestEffort;
|
|
48
50
|
readonly description: "Validates the existance of accessed columns and rows of dataframes.";
|
|
49
51
|
readonly defaultConfig: {
|
|
50
52
|
readonly readLoadedData: false;
|
|
@@ -65,7 +65,7 @@ exports.DATA_FRAME_ACCESS_VALIDATION = {
|
|
|
65
65
|
access: node?.lexeme ?? '???',
|
|
66
66
|
...(operand?.type === type_1.RType.Symbol ? { operand: operand.content } : {}),
|
|
67
67
|
range: node?.info.fullRange ?? node?.location ?? (0, range_1.rangeFrom)(-1, -1, -1, -1),
|
|
68
|
-
certainty: linter_format_1.
|
|
68
|
+
certainty: linter_format_1.LintingResultCertainty.Certain
|
|
69
69
|
}));
|
|
70
70
|
return { results, '.meta': metadata };
|
|
71
71
|
},
|
|
@@ -80,6 +80,8 @@ exports.DATA_FRAME_ACCESS_VALIDATION = {
|
|
|
80
80
|
info: {
|
|
81
81
|
name: 'Dataframe Access Validation',
|
|
82
82
|
tags: [linter_tags_1.LintingRuleTag.Bug, linter_tags_1.LintingRuleTag.Usability, linter_tags_1.LintingRuleTag.Reproducibility],
|
|
83
|
+
// this rule is unable to detect all cases of dataframe access, but sufficiently ensures returned results are valid
|
|
84
|
+
certainty: linter_format_1.LintingRuleCertainty.BestEffort,
|
|
83
85
|
description: 'Validates the existance of accessed columns and rows of dataframes.',
|
|
84
86
|
defaultConfig: { readLoadedData: false }
|
|
85
87
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { LintingResultCertainty, type LintingResult, LintingRuleCertainty } from '../linter-format';
|
|
2
|
+
import type { SourceRange } from '../../util/range';
|
|
3
|
+
import type { MergeableRecord } from '../../util/objects';
|
|
4
|
+
import { LintingRuleTag } from '../linter-tags';
|
|
5
|
+
import { type CfgSimplificationPassName } from '../../control-flow/cfg-simplification';
|
|
6
|
+
export interface DeadCodeResult extends LintingResult {
|
|
7
|
+
range: SourceRange;
|
|
8
|
+
}
|
|
9
|
+
export interface DeadCodeConfig extends MergeableRecord {
|
|
10
|
+
/**
|
|
11
|
+
* The simplification passes that should be run on the extracted CFG.
|
|
12
|
+
* Defaults to the entries of {@link DefaultCfgSimplificationOrder} and `analyze-dead-code`.
|
|
13
|
+
*/
|
|
14
|
+
simplificationPasses?: CfgSimplificationPassName[];
|
|
15
|
+
}
|
|
16
|
+
export interface DeadCodeMetadata extends MergeableRecord {
|
|
17
|
+
consideredNodes: number;
|
|
18
|
+
}
|
|
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>[]>>;
|
|
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
|
+
normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
23
|
+
dataflow: import("../../dataflow/info").DataflowInformation;
|
|
24
|
+
config: import("../../config").FlowrConfigOptions;
|
|
25
|
+
}) => {
|
|
26
|
+
results: {
|
|
27
|
+
certainty: LintingResultCertainty.Certain;
|
|
28
|
+
range: SourceRange;
|
|
29
|
+
}[];
|
|
30
|
+
'.meta': DeadCodeMetadata;
|
|
31
|
+
};
|
|
32
|
+
readonly prettyPrint: {
|
|
33
|
+
readonly query: (result: DeadCodeResult) => string;
|
|
34
|
+
readonly full: (result: DeadCodeResult) => string;
|
|
35
|
+
};
|
|
36
|
+
readonly info: {
|
|
37
|
+
readonly name: "Dead Code";
|
|
38
|
+
readonly tags: readonly [LintingRuleTag.Smell, LintingRuleTag.Usability, LintingRuleTag.Reproducibility];
|
|
39
|
+
readonly certainty: LintingRuleCertainty.BestEffort;
|
|
40
|
+
readonly description: "Marks areas of code that are never reached during execution.";
|
|
41
|
+
readonly defaultConfig: {};
|
|
42
|
+
};
|
|
43
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEAD_CODE = void 0;
|
|
4
|
+
const linter_format_1 = require("../linter-format");
|
|
5
|
+
const range_1 = require("../../util/range");
|
|
6
|
+
const flowr_search_builder_1 = require("../../search/flowr-search-builder");
|
|
7
|
+
const dfg_1 = require("../../util/mermaid/dfg");
|
|
8
|
+
const linter_tags_1 = require("../linter-tags");
|
|
9
|
+
const search_enrichers_1 = require("../../search/search-executor/search-enrichers");
|
|
10
|
+
const assert_1 = require("../../util/assert");
|
|
11
|
+
const cfg_simplification_1 = require("../../control-flow/cfg-simplification");
|
|
12
|
+
exports.DEAD_CODE = {
|
|
13
|
+
createSearch: (config) => flowr_search_builder_1.Q.all().with(search_enrichers_1.Enrichment.CfgInformation, {
|
|
14
|
+
checkReachable: true,
|
|
15
|
+
simplificationPasses: config.simplificationPasses ?? [...cfg_simplification_1.DefaultCfgSimplificationOrder, 'analyze-dead-code']
|
|
16
|
+
}),
|
|
17
|
+
processSearchResult: (elements, _config, _data) => {
|
|
18
|
+
const meta = {
|
|
19
|
+
consideredNodes: 0
|
|
20
|
+
};
|
|
21
|
+
return {
|
|
22
|
+
results: (0, range_1.combineRanges)(...new Set(elements.getElements()
|
|
23
|
+
.filter(element => {
|
|
24
|
+
meta.consideredNodes++;
|
|
25
|
+
const cfgInformation = (0, search_enrichers_1.enrichmentContent)(element, search_enrichers_1.Enrichment.CfgInformation);
|
|
26
|
+
return cfgInformation.isRoot && !cfgInformation.isReachable;
|
|
27
|
+
})
|
|
28
|
+
.map(element => element.node.info.fullRange ?? element.node.location)
|
|
29
|
+
.filter(assert_1.isNotUndefined)))
|
|
30
|
+
.map(range => ({
|
|
31
|
+
certainty: linter_format_1.LintingResultCertainty.Certain,
|
|
32
|
+
range
|
|
33
|
+
})),
|
|
34
|
+
'.meta': meta
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
prettyPrint: {
|
|
38
|
+
[linter_format_1.LintingPrettyPrintContext.Query]: result => `Code at ${(0, dfg_1.formatRange)(result.range)}`,
|
|
39
|
+
[linter_format_1.LintingPrettyPrintContext.Full]: result => `Code at ${(0, dfg_1.formatRange)(result.range)} can never be executed`,
|
|
40
|
+
},
|
|
41
|
+
info: {
|
|
42
|
+
name: 'Dead Code',
|
|
43
|
+
tags: [linter_tags_1.LintingRuleTag.Smell, linter_tags_1.LintingRuleTag.Usability, linter_tags_1.LintingRuleTag.Reproducibility],
|
|
44
|
+
// our limited dead code analysis causes complex cases of dead code not to be included in the linting result, but deadness is properly investigated for returned results
|
|
45
|
+
certainty: linter_format_1.LintingRuleCertainty.BestEffort,
|
|
46
|
+
description: 'Marks areas of code that are never reached during execution.',
|
|
47
|
+
defaultConfig: {}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=dead-code.js.map
|