UNPKG

@eagleoutice/flowr-dev

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

64 lines (63 loc) 3.76 kB
import { type LintingResult, LintingRuleCertainty } from '../linter-format'; import { type MergeableRecord } from '../../util/objects'; import { LintingRuleTag } from '../linter-tags'; import type { FunctionInfo } from '../../queries/catalog/dependencies-query/function-info/function-info'; export interface AbsoluteFilePathResult extends LintingResult { filePath: string; } type SupportedWd = '@script' | '@home' | '@project' | 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 the relative-path quick fix is built against: `@project` (project root, falling back to the * script when there is no root), `@script`, `@home`, or a literal directory. */ useAsWd: SupportedWd; /** Automatically ignore URLs (http/https/ftp) so they are not reported as absolute paths. */ ignoreUrls: boolean; } 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: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>) => Promise<{ 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: "@project"; readonly ignoreUrls: true; }; }; }; export {};