@eagleoutice/flowr-dev
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
54 lines (53 loc) • 3.19 kB
TypeScript
import { LintingRuleCertainty } from '../linter-format';
import { type FunctionsMetadata, type FunctionsResult } from './function-finder-util';
import { LintingRuleTag } from '../linter-tags';
import type { MergeableRecord } from '../../util/objects';
import type { FlowrSearchElement } from '../../search/flowr-search';
import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
import type { FunctionInfo } from '../../queries/catalog/dependencies-query/function-info/function-info';
import { Identifier } from '../../dataflow/environments/identifier';
export interface NetworkFunctionsConfig extends MergeableRecord {
/**
* The list of function names or more detailed {@link NetworkFunction} information that should be marked in the given context if their arguments match.
*/
fns: readonly (Identifier | NetworkFunction)[];
}
export interface NetworkFunction extends MergeableRecord {
/**
* The name of the network function to find.
*/
name: Identifier;
/**
* The {@link FunctionInfo} to use for querying the argument whose value should match {@link onlyTriggerWithArgument}.
* If this is not specified, flowR's default database of functions ({@link ReadFunctions}, {@link SourceFunctions} and {@link WriteFunctions}) is queried for appropriate information on the function's read argument.
*/
info?: Omit<FunctionInfo, 'name'>;
/**
* Only trigger if the function's read argument is linked to a value that matches this pattern through {@link info}.
* If this is unset, the read argument is not queried for whether its value matches a pattern.
*/
onlyTriggerWithArgument?: RegExp | string;
}
export declare const NETWORK_FUNCTIONS: {
readonly createSearch: (config: NetworkFunctionsConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["filter", "with", "filter"], ParentInformation, Promise<import("../../search/flowr-search").FlowrSearchElements<ParentInformation, [] | FlowrSearchElement<ParentInformation>[]>>>;
readonly processSearchResult: (e: import("../../search/flowr-search").FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>, c: NetworkFunctionsConfig, d: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>) => Promise<{
results: FunctionsResult[];
'.meta': FunctionsMetadata;
}>;
readonly prettyPrint: {
query: (result: FunctionsResult) => string;
full: (result: FunctionsResult) => string;
};
readonly info: {
readonly name: "Network Functions";
readonly tags: readonly [LintingRuleTag.Reproducibility, LintingRuleTag.Security, LintingRuleTag.Performance, LintingRuleTag.Smell];
readonly certainty: LintingRuleCertainty.BestEffort;
readonly description: "Marks network functions that execute network operations, such as downloading files or making HTTP requests.";
readonly defaultConfig: {
readonly fns: {
name: Identifier;
onlyTriggerWithArgument: RegExp;
}[];
};
};
};