Skip to content

Commit f5d9789

Browse files
authored
build: check broken links in generated docs (#358)
* build: check dead links on Kokoro * recursive crawl local links * fix dead links in timestamp * fix links * fix broken links
1 parent 0c3c668 commit f5d9789

7 files changed

Lines changed: 33 additions & 11 deletions

File tree

handwritten/logging/.jsdoc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = {
2020
opts: {
2121
readme: './README.md',
2222
package: './package.json',
23-
template: './node_modules/ink-docstrap/template',
23+
template: './node_modules/jsdoc-baseline',
2424
recurse: true,
2525
verbose: true,
2626
destination: './docs/'

handwritten/logging/.kokoro/docs.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,11 @@ cd $(dirname $0)/..
2323
npm install
2424

2525
npm run docs
26+
27+
# Check broken links
28+
BIN=./node_modules/.bin
29+
30+
npm install broken-link-checker
31+
npm install http-server
32+
$BIN/http-server -p 8080 docs/ &
33+
$BIN/blc -r http://localhost:8080

handwritten/logging/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
"eslint-plugin-prettier": "^3.0.0",
9797
"google-proto-files": "^0.18.0",
9898
"gts": "^0.9.0",
99-
"ink-docstrap": "git+https://github.com/docstrap/docstrap.git",
99+
"jsdoc-baseline": "git+https://github.com/hegemonic/jsdoc-baseline.git",
100100
"intelli-espower-loader": "^1.0.1",
101101
"jsdoc": "^3.5.5",
102102
"mocha": "^5.2.0",

handwritten/logging/src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ export interface LoggingOptions extends gax.GoogleAuthOptions {
9898
*
9999
* @class
100100
*
101-
* @see [What is Stackdriver Logging?]{@link https://cloud.google.com/logging/docs}
102-
* @see [Introduction to the Stackdriver Logging API]{@link https://cloud.google.com/logging/docs/api}
103-
* @see [Logging to Stackdriver from Bunyan]{@link https://www.npmjs.com/package/@google-cloud/logging-bunyan}
104-
* @see [Logging to Stackdriver from Winston]{@link https://www.npmjs.com/package/@google-cloud/logging-winston}
101+
* @see [What is Stackdriver Logging?](https://cloud.google.com/logging/docs)
102+
* @see [Introduction to the Stackdriver Logging API](https://cloud.google.com/logging/docs/api)
103+
* @see [Logging to Stackdriver from Bunyan](https://www.npmjs.com/package/@google-cloud/logging-bunyan)
104+
* @see [Logging to Stackdriver from Winston](https://www.npmjs.com/package/@google-cloud/logging-winston)
105105
*
106106
* @param {ClientConfig} [options] Configuration options.
107107
*

handwritten/logging/src/v2/doc/google/api/doc_distribution.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
* The sum of squared deviations from the mean of the values in the
4545
* population. For values x_i this is:
4646
*
47-
* Sum[i=1..n](https://cloud.google.com(x_i - mean)^2)
47+
* Sum\[i=1..n](x_1 - mean)^2
4848
*
4949
* Knuth, "The Art of Computer Programming", Vol. 2, page 323, 3rd edition
5050
* describes Welford's method for accumulating this sum in one pass.

handwritten/logging/src/v2/doc/google/protobuf/doc_timestamp.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,11 @@
8787
* 01:30 UTC on January 15, 2017.
8888
*
8989
* In JavaScript, one can convert a Date object to this format using the
90-
* standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString]
90+
* standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
9191
* method. In Python, a standard `datetime.datetime` object can be converted
9292
* to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
9393
* with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
94-
* can use the Joda Time's [`ISODateTimeFormat.dateTime()`](https://cloud.google.com
95-
* http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--
96-
* ) to obtain a formatter capable of generating timestamps in this format.
94+
* can use the Joda Time's [`ISODateTimeFormat.dateTime()`](https://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--) to obtain a formatter capable of generating timestamps in this format.
9795
*
9896
* @property {number} seconds
9997
* Represents seconds of UTC time since Unix epoch

handwritten/logging/synth.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,22 @@
4545
templates = common_templates.node_library(source_location='build/src')
4646
s.copy(templates)
4747

48+
# [START fix-dead-link]
49+
s.replace('**/doc/google/protobuf/doc_timestamp.js',
50+
'https:\/\/cloud\.google\.com[\s\*]*http:\/\/(.*)[\s\*]*\)',
51+
r"https://\1)")
52+
53+
s.replace('**/doc/google/protobuf/doc_timestamp.js',
54+
'toISOString\]',
55+
'toISOString)')
56+
# [END fix-dead-link]
57+
58+
s.replace('src/v2/doc/google/api/doc_distribution.js',
59+
r"Sum\[i=1\.\.n\]\(https:\/\/cloud\.google\.com\(x_i - mean\)\^2\)",
60+
"Sum\[i=1..n](x_1 - mean)^2")
61+
62+
63+
4864
# Node.js specific cleanup
4965
subprocess.run(["npm", "install"])
5066
subprocess.run(["npm", "run", "fix"])

0 commit comments

Comments
 (0)