Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Warn for missing / obsolete error docs #15844

Merged
merged 2 commits into from
Mar 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion docs/config/processors/error-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,36 @@
* @description
* Process "error" docType docs and generate errorNamespace docs
*/
module.exports = function errorDocsProcessor(errorNamespaceMap, getMinerrInfo) {
module.exports = function errorDocsProcessor(log, errorNamespaceMap, getMinerrInfo) {
return {
$runAfter: ['tags-extracted'],
$runBefore: ['extra-docs-added'],
$process: function(docs) {

// Get the extracted min errors to compare with the error docs, and report any mismatch
var collectedErrors = require('../../../build/errors.json').errors;
var flatErrors = [];

for (var namespace in collectedErrors) {
for (var error in collectedErrors[namespace]) {
flatErrors.push(namespace + ':' + error);
}
}

// Create error namespace docs and attach error docs to each
docs.forEach(function(doc) {
var parts, namespaceDoc;

if (doc.docType === 'error') {

var matchingMinErr = flatErrors.indexOf(doc.name);

if (matchingMinErr === -1) {
log.warn('Error doc: ' + doc.name + ' has no matching min error');
} else {
flatErrors.splice(matchingMinErr, 1);
}

// Parse out the error info from the id
parts = doc.name.split(':');
doc.namespace = parts[0];
Expand All @@ -41,6 +59,10 @@ module.exports = function errorDocsProcessor(errorNamespaceMap, getMinerrInfo) {
}
});

flatErrors.forEach(function(value) {
log.warn('No error doc exists for min error: ' + value);
});

errorNamespaceMap.forEach(function(errorNamespace) {
docs.push(errorNamespace);
});
Expand Down
12 changes: 0 additions & 12 deletions docs/content/error/$animate/nocb.ngdoc

This file was deleted.