UNPKG

@eagleoutice/flowr-dev

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

61 lines 2.45 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.countFeatures = countFeatures; /** * Counts what the running flowR version carries, so a release also shows how the feature set grew. * @module */ /* the query module has to come first, the linter rules import back into it */ const query_1 = require("../../queries/query"); const linter_rules_1 = require("../../linter/linter-rules"); const default_builtin_config_1 = require("../../dataflow/environments/default-builtin-config"); const built_in_proc_name_1 = require("../../dataflow/environments/built-in-proc-name"); const DefaultProcessors = [built_in_proc_name_1.BuiltInProcName.Default, built_in_proc_name_1.BuiltInProcName.DefaultReadAllArgs]; /** how many linting rules carry each tag, a rule usually carries several */ function countRuleTags() { const tags = {}; for (const rule of Object.values(linter_rules_1.LintingRules ?? {})) { const own = rule?.info?.tags; if (!Array.isArray(own)) { continue; } for (const tag of own) { if (typeof tag === 'string') { tags[tag] = (tags[tag] ?? 0) + 1; } } } return tags; } /** * Counts the linting rules, their tags, the queries, and the built-in definitions by the handler they use. * Every count is defensive, as this also runs against older definitions when the history is filled in. */ function countFeatures() { const builtins = (Array.isArray(default_builtin_config_1.DefaultBuiltinConfig) ? default_builtin_config_1.DefaultBuiltinConfig : []); let def = 0, custom = 0, evals = 0; for (const entry of builtins) { const processor = entry?.processor; if (typeof processor === 'string') { if (DefaultProcessors.includes(processor)) { def++; } else { custom++; } } if (entry?.evalHandler !== undefined) { evals++; } } return { lintingRules: Object.keys(linter_rules_1.LintingRules ?? {}).length, queries: Object.keys(query_1.SupportedQueries ?? {}).length, builtinDefinitions: builtins.length, builtinDefinitionsDefault: def, builtinDefinitionsCustom: custom, builtinDefinitionsWithEvalHandler: evals, lintingRulesByTag: countRuleTags() }; } //# sourceMappingURL=feature-counts.js.map