@eagleoutice/flowr 2.8.4 → 2.8.5
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/linter/linter-format.d.ts +6 -0
- package/linter/linter-rules.d.ts +6 -0
- package/linter/rules/dataframe-access-validation.js +1 -0
- package/linter/rules/dead-code.d.ts +1 -0
- package/linter/rules/dead-code.js +1 -0
- package/linter/rules/deprecated-functions.d.ts +1 -0
- package/linter/rules/file-path-validity.js +2 -0
- package/linter/rules/function-finder-util.d.ts +1 -0
- package/linter/rules/function-finder-util.js +1 -0
- package/linter/rules/naming-convention.d.ts +1 -0
- package/linter/rules/naming-convention.js +1 -0
- package/linter/rules/network-functions.d.ts +1 -0
- package/linter/rules/seeded-randomness.d.ts +1 -0
- package/linter/rules/seeded-randomness.js +2 -0
- package/linter/rules/unused-definition.js +1 -0
- package/linter/rules/useless-loop.d.ts +1 -0
- package/linter/rules/useless-loop.js +2 -1
- package/package.json +1 -1
- package/queries/catalog/linter-query/linter-query-format.d.ts +5 -1
- package/queries/catalog/linter-query/linter-query-format.js +9 -1
- package/queries/query.d.ts +5 -1
- package/util/version.js +1 -1
|
@@ -11,6 +11,7 @@ import type { SourceRange } from '../util/range';
|
|
|
11
11
|
import type { DataflowInformation } from '../dataflow/info';
|
|
12
12
|
import type { ControlFlowInformation } from '../control-flow/control-flow-graph';
|
|
13
13
|
import type { ReadonlyFlowrAnalysisProvider } from '../project/flowr-analyzer';
|
|
14
|
+
import type { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
14
15
|
export interface LinterRuleInformation<Config extends MergeableRecord = never> {
|
|
15
16
|
/** Human-Readable name of the linting rule. */
|
|
16
17
|
readonly name: string;
|
|
@@ -94,11 +95,16 @@ export type LintQuickFix = LintQuickFixReplacement | LintQuickFixRemove;
|
|
|
94
95
|
* A linting result for a single linting rule match.
|
|
95
96
|
*/
|
|
96
97
|
export interface LintingResult {
|
|
98
|
+
/** The certainty of the linting result. */
|
|
97
99
|
readonly certainty: LintingResultCertainty;
|
|
98
100
|
/**
|
|
99
101
|
* If available, what to do to fix the linting result.
|
|
100
102
|
*/
|
|
101
103
|
readonly quickFix?: LintQuickFix[];
|
|
104
|
+
/**
|
|
105
|
+
* The node ID involved in this linting result, if applicable.
|
|
106
|
+
*/
|
|
107
|
+
readonly involvedId: NodeId | undefined;
|
|
102
108
|
}
|
|
103
109
|
export interface ConfiguredLintingRule<Name extends LintingRuleNames = LintingRuleNames> {
|
|
104
110
|
readonly name: Name;
|
package/linter/linter-rules.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export declare const LintingRules: {
|
|
|
9
9
|
readonly processSearchResult: <T extends import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>(elements: import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, T>, _config: unknown, _data: unknown, refineSearch?: (elements: T) => T) => {
|
|
10
10
|
results: {
|
|
11
11
|
certainty: import("./linter-format").LintingResultCertainty;
|
|
12
|
+
involvedId: import("../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId;
|
|
12
13
|
function: import("../dataflow/environments/identifier").Identifier;
|
|
13
14
|
range: import("../util/range").SourceRange;
|
|
14
15
|
}[];
|
|
@@ -64,6 +65,7 @@ export declare const LintingRules: {
|
|
|
64
65
|
analyzer: import("../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider;
|
|
65
66
|
}) => {
|
|
66
67
|
results: {
|
|
68
|
+
involvedId: import("../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId;
|
|
67
69
|
certainty: import("./linter-format").LintingResultCertainty;
|
|
68
70
|
function: import("../dataflow/environments/identifier").Identifier;
|
|
69
71
|
range: import("../util/range").SourceRange;
|
|
@@ -156,6 +158,7 @@ export declare const LintingRules: {
|
|
|
156
158
|
analyzer: import("../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider;
|
|
157
159
|
}) => {
|
|
158
160
|
results: {
|
|
161
|
+
involvedId: import("../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId;
|
|
159
162
|
quickFix: import("./linter-format").LintQuickFixReplacement[] | undefined;
|
|
160
163
|
certainty: import("./linter-format").LintingResultCertainty;
|
|
161
164
|
detectedCasing: import("./rules/naming-convention").CasingConvention;
|
|
@@ -192,6 +195,7 @@ export declare const LintingRules: {
|
|
|
192
195
|
}) => {
|
|
193
196
|
results: {
|
|
194
197
|
certainty: import("./linter-format").LintingResultCertainty;
|
|
198
|
+
involvedId: import("../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId;
|
|
195
199
|
function: import("../dataflow/environments/identifier").Identifier;
|
|
196
200
|
range: import("../util/range").SourceRange;
|
|
197
201
|
}[];
|
|
@@ -247,6 +251,7 @@ export declare const LintingRules: {
|
|
|
247
251
|
}) => {
|
|
248
252
|
results: {
|
|
249
253
|
certainty: import("./linter-format").LintingResultCertainty.Certain;
|
|
254
|
+
involvedId: undefined;
|
|
250
255
|
range: import("../util/range").SourceRange;
|
|
251
256
|
}[];
|
|
252
257
|
'.meta': import("./rules/dead-code").DeadCodeMetadata;
|
|
@@ -275,6 +280,7 @@ export declare const LintingRules: {
|
|
|
275
280
|
certainty: import("./linter-format").LintingResultCertainty.Certain;
|
|
276
281
|
name: string;
|
|
277
282
|
range: import("../util/range").SourceRange;
|
|
283
|
+
involvedId: import("../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId;
|
|
278
284
|
}[];
|
|
279
285
|
'.meta': {
|
|
280
286
|
numOfUselessLoops: number;
|
|
@@ -65,6 +65,7 @@ exports.DATA_FRAME_ACCESS_VALIDATION = {
|
|
|
65
65
|
}))
|
|
66
66
|
.map(({ node, operand, ...accessed }) => ({
|
|
67
67
|
...accessed,
|
|
68
|
+
involvedId: node?.info.id,
|
|
68
69
|
access: node?.lexeme ?? '???',
|
|
69
70
|
...(operand?.type === type_1.RType.Symbol ? { operand: operand.content } : {}),
|
|
70
71
|
range: node?.info.fullRange ?? node?.location ?? (0, range_1.rangeFrom)(-1, -1, -1, -1),
|
|
@@ -6,6 +6,7 @@ export declare const DEPRECATED_FUNCTIONS: {
|
|
|
6
6
|
readonly processSearchResult: <T extends import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>(elements: import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, T>, _config: unknown, _data: unknown, refineSearch?: (elements: T) => T) => {
|
|
7
7
|
results: {
|
|
8
8
|
certainty: import("../linter-format").LintingResultCertainty;
|
|
9
|
+
involvedId: import("../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId;
|
|
9
10
|
function: import("../../dataflow/environments/identifier").Identifier;
|
|
10
11
|
range: import("../../util/range").SourceRange;
|
|
11
12
|
}[];
|
|
@@ -39,6 +39,7 @@ exports.FILE_PATH_VALIDITY = {
|
|
|
39
39
|
metadata.totalUnknown++;
|
|
40
40
|
if (config.includeUnknown) {
|
|
41
41
|
return [{
|
|
42
|
+
involvedId: matchingRead.nodeId,
|
|
42
43
|
range,
|
|
43
44
|
filePath: dependencies_query_format_1.Unknown,
|
|
44
45
|
certainty: linter_format_1.LintingResultCertainty.Uncertain
|
|
@@ -65,6 +66,7 @@ exports.FILE_PATH_VALIDITY = {
|
|
|
65
66
|
return [];
|
|
66
67
|
}
|
|
67
68
|
return [{
|
|
69
|
+
involvedId: matchingRead.nodeId,
|
|
68
70
|
range,
|
|
69
71
|
filePath: matchingRead.value,
|
|
70
72
|
certainty: writesBefore && writesBefore.length && writesBefore.every(w => w === logic_1.Ternary.Maybe) ? linter_format_1.LintingResultCertainty.Uncertain : linter_format_1.LintingResultCertainty.Certain
|
|
@@ -29,6 +29,7 @@ export declare const functionFinderUtil: {
|
|
|
29
29
|
processSearchResult: <T extends FlowrSearchElement<ParentInformation>[]>(elements: FlowrSearchElements<ParentInformation, T>, _config: unknown, _data: unknown, refineSearch?: (elements: T) => T) => {
|
|
30
30
|
results: {
|
|
31
31
|
certainty: LintingResultCertainty;
|
|
32
|
+
involvedId: import("../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId;
|
|
32
33
|
function: Identifier;
|
|
33
34
|
range: SourceRange;
|
|
34
35
|
}[];
|
|
@@ -60,6 +60,7 @@ export declare const NAMING_CONVENTION: {
|
|
|
60
60
|
analyzer: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider;
|
|
61
61
|
}) => {
|
|
62
62
|
results: {
|
|
63
|
+
involvedId: NodeId;
|
|
63
64
|
quickFix: LintQuickFixReplacement[] | undefined;
|
|
64
65
|
certainty: LintingResultCertainty;
|
|
65
66
|
detectedCasing: CasingConvention;
|
|
@@ -18,6 +18,7 @@ export declare const NETWORK_FUNCTIONS: {
|
|
|
18
18
|
}) => {
|
|
19
19
|
results: {
|
|
20
20
|
certainty: import("../linter-format").LintingResultCertainty;
|
|
21
|
+
involvedId: import("../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId;
|
|
21
22
|
function: import("../../dataflow/environments/identifier").Identifier;
|
|
22
23
|
range: import("../../util/range").SourceRange;
|
|
23
24
|
}[];
|
|
@@ -38,6 +38,7 @@ export declare const SEEDED_RANDOMNESS: {
|
|
|
38
38
|
analyzer: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider;
|
|
39
39
|
}) => {
|
|
40
40
|
results: {
|
|
41
|
+
involvedId: import("../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId;
|
|
41
42
|
certainty: LintingResultCertainty;
|
|
42
43
|
function: Identifier;
|
|
43
44
|
range: SourceRange;
|
|
@@ -47,6 +47,7 @@ exports.SEEDED_RANDOMNESS = {
|
|
|
47
47
|
.flatMap(element => (0, search_enrichers_1.enrichmentContent)(element, search_enrichers_1.Enrichment.CallTargets).targets.map(target => {
|
|
48
48
|
metadata.consumerCalls++;
|
|
49
49
|
return {
|
|
50
|
+
involvedId: element.node.info.id,
|
|
50
51
|
range: element.node.info.fullRange,
|
|
51
52
|
target: target,
|
|
52
53
|
searchElement: element
|
|
@@ -110,6 +111,7 @@ exports.SEEDED_RANDOMNESS = {
|
|
|
110
111
|
metadata.callsWithOtherBranchProducers++;
|
|
111
112
|
}
|
|
112
113
|
return [{
|
|
114
|
+
involvedId: element.involvedId,
|
|
113
115
|
certainty: cdsOfProduces.size > 0 ? linter_format_1.LintingResultCertainty.Uncertain : linter_format_1.LintingResultCertainty.Certain,
|
|
114
116
|
function: element.target,
|
|
115
117
|
range: element.range
|
|
@@ -83,6 +83,7 @@ exports.UNUSED_DEFINITION = {
|
|
|
83
83
|
return [{
|
|
84
84
|
certainty: linter_format_1.LintingResultCertainty.Uncertain,
|
|
85
85
|
variableName,
|
|
86
|
+
involvedId: element.node.info.id,
|
|
86
87
|
range: element.node.info.fullRange ?? element.node.location ?? (0, range_1.rangeFrom)(-1, -1, -1, -1),
|
|
87
88
|
quickFix: buildQuickFix(element.node, data.dataflow.graph, data.normalize)
|
|
88
89
|
}];
|
|
@@ -19,7 +19,8 @@ exports.USELESS_LOOP = {
|
|
|
19
19
|
}).filter(loop => (0, useless_loop_1.onlyLoopsOnce)(loop.node.info.id, dataflow.graph, cfg, normalize, analyzer.inspectContext())).map(res => ({
|
|
20
20
|
certainty: linter_format_1.LintingResultCertainty.Certain,
|
|
21
21
|
name: res.node.lexeme,
|
|
22
|
-
range: res.node.info.fullRange
|
|
22
|
+
range: res.node.info.fullRange,
|
|
23
|
+
involvedId: res.node.info.id
|
|
23
24
|
}));
|
|
24
25
|
return {
|
|
25
26
|
results: results,
|
package/package.json
CHANGED
|
@@ -31,6 +31,10 @@ export declare const LinterQueryDefinition: {
|
|
|
31
31
|
readonly completer: typeof linterQueryCompleter;
|
|
32
32
|
readonly fromLine: typeof linterQueryLineParser;
|
|
33
33
|
readonly schema: Joi.ObjectSchema<any>;
|
|
34
|
-
readonly flattenInvolvedNodes: () =>
|
|
34
|
+
readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => ((string & {
|
|
35
|
+
__brand?: "node-id";
|
|
36
|
+
}) | (number & {
|
|
37
|
+
__brand?: "node-id";
|
|
38
|
+
}))[];
|
|
35
39
|
};
|
|
36
40
|
export {};
|
|
@@ -105,7 +105,15 @@ exports.LinterQueryDefinition = {
|
|
|
105
105
|
config: joi_1.default.object()
|
|
106
106
|
})).description('The rules to lint for. If unset, all rules will be included.')
|
|
107
107
|
}).description('The linter query lints for the given set of rules and returns the result.'),
|
|
108
|
-
flattenInvolvedNodes: () =>
|
|
108
|
+
flattenInvolvedNodes: (queryResults) => {
|
|
109
|
+
const out = queryResults;
|
|
110
|
+
return Object.values(out.results).flatMap(v => {
|
|
111
|
+
if ((0, linter_format_1.isLintingResultsError)(v)) {
|
|
112
|
+
return [];
|
|
113
|
+
}
|
|
114
|
+
return v.results.map(v => v.involvedId);
|
|
115
|
+
}).filter(assert_1.isNotUndefined);
|
|
116
|
+
}
|
|
109
117
|
};
|
|
110
118
|
function addLintingRuleResult(ruleName, results, result) {
|
|
111
119
|
const rule = linter_rules_1.LintingRules[ruleName];
|
package/queries/query.d.ts
CHANGED
|
@@ -228,7 +228,11 @@ export declare const SupportedQueries: {
|
|
|
228
228
|
readonly completer: (line: readonly string[], startingNewArg: boolean, _config: FlowrConfigOptions) => CommandCompletions;
|
|
229
229
|
readonly fromLine: (output: ReplOutput, line: readonly string[], _config: FlowrConfigOptions) => ParsedQueryLine<"linter">;
|
|
230
230
|
readonly schema: Joi.ObjectSchema<any>;
|
|
231
|
-
readonly flattenInvolvedNodes: () =>
|
|
231
|
+
readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => ((string & {
|
|
232
|
+
__brand?: "node-id";
|
|
233
|
+
}) | (number & {
|
|
234
|
+
__brand?: "node-id";
|
|
235
|
+
}))[];
|
|
232
236
|
};
|
|
233
237
|
};
|
|
234
238
|
export type SupportedQueryTypes = keyof typeof SupportedQueries;
|
package/util/version.js
CHANGED
|
@@ -6,7 +6,7 @@ exports.printVersionInformation = printVersionInformation;
|
|
|
6
6
|
const semver_1 = require("semver");
|
|
7
7
|
const assert_1 = require("./assert");
|
|
8
8
|
// this is automatically replaced with the current version by release-it
|
|
9
|
-
const version = '2.8.
|
|
9
|
+
const version = '2.8.5';
|
|
10
10
|
/**
|
|
11
11
|
* Retrieves the current flowR version as a new {@link SemVer} object.
|
|
12
12
|
*/
|