@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
37 lines • 2.62 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.NETWORK_FUNCTIONS = void 0;
const linter_format_1 = require("../linter-format");
const function_finder_util_1 = require("./function-finder-util");
const linter_tags_1 = require("../linter-tags");
const read_functions_1 = require("../../queries/catalog/dependencies-query/function-info/read-functions");
const logic_1 = require("../../util/logic");
exports.NETWORK_FUNCTIONS = {
createSearch: (config) => function_finder_util_1.functionFinderUtil.createSearch(config.fns),
processSearchResult: (e, c, d) => function_finder_util_1.functionFinderUtil.processSearchResult(e, c, d, es => {
const res = [];
for (const e of es) {
const val = function_finder_util_1.functionFinderUtil.requireArgumentValue(e, read_functions_1.ReadFunctions, d, c.onlyTriggerWithArgument);
if (val === logic_1.Ternary.Never) {
continue;
}
const x = e;
x.certainty = val === logic_1.Ternary.Always ? linter_format_1.LintingResultCertainty.Certain : linter_format_1.LintingResultCertainty.Uncertain;
res.push(x);
}
return res;
}),
prettyPrint: function_finder_util_1.functionFinderUtil.prettyPrint('network operations'),
info: {
name: 'Network Functions',
tags: [linter_tags_1.LintingRuleTag.Reproducibility, linter_tags_1.LintingRuleTag.Security, linter_tags_1.LintingRuleTag.Performance, linter_tags_1.LintingRuleTag.Smell],
// ensures all network functions found are actually network functions through its limited config, but doesn't find all network functions since the config is pre-crawled, and the DFG may be over-approximated
certainty: linter_format_1.LintingRuleCertainty.BestEffort,
description: 'Marks network functions that execute network operations, such as downloading files or making HTTP requests.',
defaultConfig: {
fns: ['read.table', 'read.csv', 'read.csv2', 'read.delim', 'read.delim2', 'readRDS', 'download.file', 'url', 'GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'content', 'handle', 'get_callback', 'VERB', 'fread', 'gzcon', 'readlines', 'source', 'load', 'curl_download', 'curl_fetch_memory', 'getURL', 'getForm', 'read_html', 'html_nodes', 'html_text', 'fromJSON', 'read.xlsx', 'drive_download', 'drive_get', 's3read_using', 's3write_using', 'storage_download', 'AnnotationHub', 'ExperimentHub'],
onlyTriggerWithArgument: /^(https?|ftps?|file):\/\//
}
}
};
//# sourceMappingURL=network-functions.js.map