@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
71 lines • 3.2 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const log_1 = require("../../test/functionality/_helper/log");
const doc_types_1 = require("./doc-util/doc-types");
const path_1 = __importDefault(require("path"));
const linter_tags_1 = require("../linter/linter-tags");
const doc_general_1 = require("./doc-util/doc-general");
const doc_files_1 = require("./doc-util/doc-files");
const linter_rules_1 = require("../linter/linter-rules");
/* this prints the yaml configuration for the GitHub issue template to request a new linter rule / an update */
function summarizeIfTooLong(text, maxLength = 52) {
if (text.length <= maxLength) {
return text;
}
return text.slice(0, maxLength - 1) + '…';
}
function getText() {
const types = (0, doc_types_1.getTypesFromFolder)({
rootFolder: path_1.default.resolve('./src/linter/')
});
return `
name: Linting Rule
description: Suggest either a new linting rule or an improvement to an existing one.
title: "[Linter]: "
labels: ["flowr linter"]
body:
- type: markdown
attributes:
value: |
Thank you for suggesting a new linting rule or an improvement to an existing one. Please provide as much detail as possible to help us understand your request. See the [Linter Wiki Page](${doc_files_1.FlowrWikiBaseRef}/Linter) for more information.
- type: textarea
id: description
attributes:
label: Description
description: |
Please provide a detailed description of the linting rule you are suggesting or the improvement you would like to see. Include examples if possible.
validations:
required: true
- type: dropdown
id: linting-rule
attributes:
label: Linting Rule
description: |
Select the linting rule that you are suggesting or improving. If it is a new rule, select "New Rule".
options:
- New Rule
${(0, doc_general_1.prefixLines)(Object.keys(linter_rules_1.LintingRules).sort().map(name => {
const rule = linter_rules_1.LintingRules[name];
return `- ${rule.info.name}`;
}).join('\n'), ' ')}
default: 0
- type: checkboxes
id: tags
attributes:
label: Meta Information
description: Select any tags that you think apply to the linting rule you are suggesting. If you try to suggest a new linting rule, please only select those that you think apply after your suggestions.
options:
${(0, doc_general_1.prefixLines)(Object.entries(linter_tags_1.LintingRuleTag).map(([name]) => {
return `- label: '**${name}**: ${summarizeIfTooLong((0, doc_types_1.getDocumentationForType)('LintingRuleTag::' + name, types.info).replaceAll(/\n/g, ' ').replaceAll('\'', '\\\'').trim())}'\n required: false`;
}).join('\n'), ' ')}
`.trim();
}
/** if we run this script, we want a Markdown representation of the capabilities */
if (require.main === module) {
(0, log_1.setMinLevelOfAllLogs)(6 /* LogLevel.Fatal */);
console.log(getText());
}
//# sourceMappingURL=print-linter-issue.js.map