build(docs-infra): fail doc-gen if a content rule fails (#26039)

PR Close #26039
This commit is contained in:
Pete Bacon Darwin 2018-09-21 08:49:35 +01:00 committed by Kara Erickson
parent 8ac4dd6447
commit b8422b41bb
1 changed files with 5 additions and 28 deletions

View File

@ -151,40 +151,17 @@ module.exports = new Package('angular-api', [basePackage, typeScriptPackage])
]; ];
}) })
.config(function(checkContentRules, EXPORT_DOC_TYPES) { .config(function(checkContentRules, API_DOC_TYPES, API_CONTAINED_DOC_TYPES) {
// Min length rules addMinLengthRules(checkContentRules);
const createMinLengthRule = require('./content-rules/minLength'); addHeadingRules(checkContentRules, API_DOC_TYPES);
const paramRuleSet = checkContentRules.docTypeRules['parameter'] = checkContentRules.docTypeRules['parameter'] || {}; addAllowedPropertiesRules(checkContentRules, API_CONTAINED_DOC_TYPES);
const paramRules = paramRuleSet['name'] = paramRuleSet['name'] || []; checkContentRules.failOnContentErrors = true;
paramRules.push(createMinLengthRule());
// Heading rules
const createNoMarkdownHeadingsRule = require('./content-rules/noMarkdownHeadings');
const noMarkdownHeadings = createNoMarkdownHeadingsRule();
const allowOnlyLevel3Headings = createNoMarkdownHeadingsRule(1, 2, '4,');
const DOC_TYPES_TO_CHECK = EXPORT_DOC_TYPES.concat(['member', 'overload-info']);
const PROPS_TO_CHECK = ['description', 'shortDescription'];
DOC_TYPES_TO_CHECK.forEach(docType => {
const ruleSet = checkContentRules.docTypeRules[docType] = checkContentRules.docTypeRules[docType] || {};
PROPS_TO_CHECK.forEach(prop => {
const rules = ruleSet[prop] = ruleSet[prop] || [];
rules.push(noMarkdownHeadings);
});
const rules = ruleSet['usageNotes'] = ruleSet['usageNotes'] || [];
rules.push(allowOnlyLevel3Headings);
});
}) })
.config(function(filterContainedDocs, API_CONTAINED_DOC_TYPES) { .config(function(filterContainedDocs, API_CONTAINED_DOC_TYPES) {
filterContainedDocs.docTypes = API_CONTAINED_DOC_TYPES; filterContainedDocs.docTypes = API_CONTAINED_DOC_TYPES;
}) })
.config(function(checkContentRules, API_DOC_TYPES, API_CONTAINED_DOC_TYPES) {
addMinLengthRules(checkContentRules);
addHeadingRules(checkContentRules, API_DOC_TYPES);
addAllowedPropertiesRules(checkContentRules, API_CONTAINED_DOC_TYPES);
})
.config(function(computePathsProcessor, EXPORT_DOC_TYPES, generateApiListDoc) { .config(function(computePathsProcessor, EXPORT_DOC_TYPES, generateApiListDoc) {