gherkin-lint-ts
Version:
Gherkin features linter written in Typescript
37 lines • 1.22 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.run = exports.name = void 0;
exports.name = "no-partially-commented-tag-lines";
function run(feature) {
var _a;
if (!feature) {
return [];
}
const errors = [];
checkTags(feature, errors);
(_a = feature.children) === null || _a === void 0 ? void 0 : _a.forEach(child => {
var _a;
if (child.scenario) {
checkTags(child.scenario, errors);
(_a = child.scenario.examples) === null || _a === void 0 ? void 0 : _a.forEach(example => {
checkTags(example, errors);
});
}
});
return errors;
}
exports.run = run;
function checkTags(node, errors) {
var _a;
(_a = node.tags) === null || _a === void 0 ? void 0 : _a.forEach(tag => {
var _a;
if (tag.name && tag.name.indexOf("#") > 0) {
errors.push({
message: "Partially commented tag lines not allowed",
rule: exports.name,
line: ((_a = tag.location) === null || _a === void 0 ? void 0 : _a.line) || 0,
});
}
});
}
//# sourceMappingURL=no-partially-commented-tag-lines.js.map