@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
68 lines • 2.95 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.IssueLintingRule = void 0;
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");
const doc_maker_1 = require("./wiki-mk/doc-maker");
/* 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) + '…';
}
/**
* https://github.com/flowr-analysis/flowr/blob/main/.github/ISSUE_TEMPLATE/linting-rule.yaml
*/
class IssueLintingRule extends doc_maker_1.DocMaker {
constructor() {
super('.github/ISSUE_TEMPLATE/linting-rule.yaml', module.filename, '', false);
}
text({ ctx }) {
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(ctx.doc('LintingRuleTag::' + name).replaceAll(/\n/g, ' ').replaceAll('\'', '\\\'').trim())}'\n required: false`;
}).join('\n'), ' ')}
`.trim();
}
}
exports.IssueLintingRule = IssueLintingRule;
//# sourceMappingURL=issue-linting-rule.js.map