@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
68 lines (67 loc) • 3.86 kB
TypeScript
import { type LintingResult, LintingRuleCertainty } from '../linter-format';
import { type MergeableRecord } from '../../util/objects';
import { SourceLocation } from '../../util/range';
import { LintingRuleTag } from '../linter-tags';
import type { FunctionInfo } from '../../queries/catalog/dependencies-query/function-info/function-info';
export interface AbsoluteFilePathResult extends LintingResult {
filePath: string;
loc: SourceLocation;
}
type SupportedWd = '@script' | '@home' | string;
export interface AbsoluteFilePathConfig extends MergeableRecord {
/** Include paths that are built by functions, e.g., `file.path()` */
include: {
/** Whether to include paths that are constructed by functions */
constructed: boolean;
/** Include every string, even if it is not used as a file path, to count, strings must have a length of at least 3 chars */
allStrings: boolean;
};
/** Extend the built-in absolute path recognition with additional regexes */
absolutePathRegex: string | undefined;
/**
* The set of functions that should additionally be considered as using a file path.
* Entries in this array use the {@link FunctionInfo} format from the dependencies query.
*/
additionalPathFunctions: FunctionInfo[];
/**
* Which path should be considered to be the origin for relative paths.
* This is only relevant with quickfixes. In the future we may be sensitive to setwd etc.
*/
useAsWd: SupportedWd;
}
export interface AbsoluteFilePathMetadata extends MergeableRecord {
totalConsidered: number;
totalUnknown: number;
}
export declare const ABSOLUTE_PATH: {
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>[]>>;
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: {
normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
dataflow: import("../../dataflow/info").DataflowInformation;
cfg: import("../../control-flow/control-flow-graph").ControlFlowInformation;
analyzer: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider;
}) => {
results: AbsoluteFilePathResult[];
".meta": AbsoluteFilePathMetadata;
};
readonly prettyPrint: {
readonly query: (result: AbsoluteFilePathResult) => string;
readonly full: (result: AbsoluteFilePathResult) => string;
};
readonly info: {
readonly name: "Absolute Paths";
readonly description: "Checks whether file paths are absolute.";
readonly tags: readonly [LintingRuleTag.Robustness, LintingRuleTag.Reproducibility, LintingRuleTag.Smell, LintingRuleTag.QuickFix];
readonly certainty: LintingRuleCertainty.BestEffort;
readonly defaultConfig: {
readonly include: {
readonly constructed: true;
readonly allStrings: false;
};
readonly additionalPathFunctions: readonly [];
readonly absolutePathRegex: undefined;
readonly useAsWd: "@script";
};
};
};
export {};