From 35a43f21d8b92a4fadfc6719fc444ebdadc5c5d1 Mon Sep 17 00:00:00 2001 From: Martin Staffa Date: Wed, 22 Mar 2017 11:09:40 +0100 Subject: [PATCH 1/2] chore(doc-gen): report on missing or obsolete error docs Closes #12527 --- docs/config/processors/error-docs.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/docs/config/processors/error-docs.js b/docs/config/processors/error-docs.js index c80297efbba5..ebcd18658939 100644 --- a/docs/config/processors/error-docs.js +++ b/docs/config/processors/error-docs.js @@ -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]; @@ -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); }); From 8dc9aa28e53fd97a0469d540b3c0a8974c181c73 Mon Sep 17 00:00:00 2001 From: Martin Staffa Date: Wed, 22 Mar 2017 17:11:53 +0100 Subject: [PATCH 2/2] docs($animate): remove obsolete error doc --- docs/content/error/$animate/nocb.ngdoc | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 docs/content/error/$animate/nocb.ngdoc diff --git a/docs/content/error/$animate/nocb.ngdoc b/docs/content/error/$animate/nocb.ngdoc deleted file mode 100644 index e0e2e95e0304..000000000000 --- a/docs/content/error/$animate/nocb.ngdoc +++ /dev/null @@ -1,12 +0,0 @@ -@ngdoc error -@name $animate:nocb -@fullName Do not pass a callback to animate methods -@description - -Since AngularJS 1.3, the methods of {@link ng.$animate} do not accept a callback as the last parameter. -Instead, they return a promise to which you can attach `then` handlers to be run when the animation completes. - -If you are getting this error then you need to update your code to use the promise-based API. - -See https://github.com/angular/angular.js/commit/bf0f5502b1bbfddc5cdd2f138efd9188b8c652a9 for information about -the change to the animation API and the changes you need to make.