Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit aa439d2

Browse files
chalinkwalrath
authored andcommitted
chore(travis): report bad code excerpts (BAD FILENAME) in docs (#2154)
* chore(travis): report bad code excerpts (BAD FILENAME) * Only ignore build dir under dart dir Have the shredder ignore `**/dart/build/**`.
1 parent fcaf8fa commit aa439d2

File tree

4 files changed

+69
-7
lines changed

4 files changed

+69
-7
lines changed

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,17 @@ env:
1212
- CHROME_BIN=chromium-browser
1313
- LATEST_RELEASE=2.0.0-rc.5
1414
- TASK_FLAGS="--dgeni-log=warn"
15-
# - TASK_FLAGS=""
1615
matrix:
1716
- TASK=lint
1817
- TASK="run-e2e-tests --fast" SCRIPT=examples-install.sh
1918
- TASK="run-e2e-tests --fast" SCRIPT=examples-install-preview.sh
20-
- TASK=build-compile SCRIPT=deploy-install.sh WAIT="travis_wait 50"
21-
- TASK=build-compile SCRIPT=deploy-install-preview.sh WAIT="travis_wait 50"
19+
- TASK=build-compile SCRIPT=deploy-install.sh WAIT="travis_wait 50" POST_SCRIPT="check-docs.sh -v"
20+
- TASK=build-compile SCRIPT=deploy-install-preview.sh WAIT="travis_wait 50" POST_SCRIPT="check-docs.sh -v"
2221
matrix:
2322
fast_finish: true
2423
allow_failures:
2524
- env: TASK="run-e2e-tests --fast" SCRIPT=examples-install-preview.sh
26-
- env: TASK=build-compile SCRIPT=deploy-install-preview.sh WAIT="travis_wait 50"
25+
- env: TASK=build-compile SCRIPT=deploy-install-preview.sh WAIT="travis_wait 50" POST_SCRIPT="check-docs.sh -v"
2726
before_install:
2827
- source ./scripts/env-set.sh
2928
- ./scripts/before-install.sh
@@ -34,3 +33,4 @@ before_script:
3433
- sh -e /etc/init.d/xvfb start
3534
script:
3635
- $WAIT gulp $TASK $TASK_FLAGS
36+
- if [[ -n "$POST_SCRIPT" ]]; then ./scripts/$POST_SCRIPT; fi

scripts/check-docs.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env bash
2+
3+
set -e -o pipefail
4+
5+
[[ -z "$NGIO_ENV_DEFS" ]] && . ./scripts/env-set.sh > /dev/null
6+
if [[ "x$1" == "x-v" ]]; then VERBOSE=1; shift; fi
7+
8+
SITE=./www
9+
10+
CHECK_FOR=bad-code-excerpt
11+
12+
LOGFILE_PREFIX=$CHECK_FOR-log
13+
LOGFILE_FULL=$TMP/$LOGFILE_PREFIX-full.txt
14+
LOGFILE=$TMP/$LOGFILE_PREFIX.txt
15+
16+
SKIPFILE_BASE=$CHECK_FOR-skip-patterns.txt
17+
SKIPFILE_SRC=./scripts/config/$SKIPFILE_BASE
18+
SKIPFILE=$TMP/$SKIPFILE_BASE
19+
20+
if [[ ! -d $SITE ]]; then
21+
echo "Missing site folder $SITE"
22+
exit 1;
23+
fi
24+
25+
travis_fold start $CHECK_FOR
26+
echo "Searching site for HTML files containing bad code excerpts (BAD FILENAME)."
27+
echo
28+
29+
if [[ -n "$VERBOSE" ]]; then
30+
travis_fold start $CHECK_FOR-details
31+
echo "Full file list with grep details:"
32+
find $SITE -type f -name "*.html" -exec grep -Hne "BAD FILENAME" {} \; | tee $LOGFILE_FULL
33+
travis_fold end $CHECK_FOR-details
34+
echo
35+
else
36+
echo "Full file list:"
37+
find $SITE -type f -name "*.html" -exec grep -le "BAD FILENAME" {} \; | tee $LOGFILE_FULL
38+
fi
39+
40+
echo
41+
echo "Skip patterns for paths of files known to have issues ($SKIPFILE_SRC):"
42+
43+
perl -pe 's/(\s+|\s*#.*)$/\n/g' $SKIPFILE_SRC | \
44+
# Remove blank lines \
45+
grep '.' > $SKIPFILE
46+
cat $SKIPFILE
47+
echo
48+
echo "File list excluding those matching skip patterns:"
49+
grep -v -E -f $SKIPFILE $LOGFILE_FULL | tee $LOGFILE || true
50+
51+
if [[ ! -s $LOGFILE ]]; then
52+
echo "No matches, all is good!"
53+
travis_fold end $CHECK_FOR
54+
else
55+
exit 1;
56+
fi
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Comments & blank lines are ignored. Entry format (make pattern as specific as possible):
2+
# <grep-pattern-to-match-file-path> # reason / issue number
3+
4+
/[jt]s/.*/api/router-deprecated/ # Obsolete API entries. No issue open yet.
5+
/ts/latest/guide/style-guide.html # https://github.com/angular/angular.io/issues/2123
6+
/ts/latest/guide/upgrade.html # In a transient state until RC6 - @filipe.silva

tools/doc-shredder/doc-shredder.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ function createShredExamplePackage(shredOptions) {
138138
readFilesProcessor.sourceFiles = [ {
139139
// Process all candidate files in `src` and its subfolders ...
140140
include: includeFiles ,
141-
exclude: [ '**/node_modules/**', '**/dist/**', '**/typings/**', '**/packages/**', '**/build/**'],
141+
exclude: [ '**/node_modules/**', '**/dist/**', '**/typings/**', '**/packages/**', '**/dart/build/**'],
142142
// When calculating the relative path to these files use this as the base path.
143143
// So `src/foo/bar.js` will have relative path of `foo/bar.js`
144144
basePath: options.examplesDir
@@ -190,7 +190,7 @@ function createShredJadePackage(shredOptions) {
190190
readFilesProcessor.sourceFiles = [ {
191191
// Process all candidate files in `src` and its subfolders ...
192192
include: includeFiles ,
193-
exclude: [ '**/node_modules/**', '**/typings/**', '**/packages/**', '**/build/**', '**/_code-examples.jade'],
193+
exclude: [ '**/node_modules/**', '**/typings/**', '**/packages/**', '**/dart/build/**', '**/_code-examples.jade'],
194194
// When calculating the relative path to these files use this as the base path.
195195
// So `src/foo/bar.js` will have relative path of `foo/bar.js`
196196
basePath: options.jadeDir
@@ -244,7 +244,7 @@ var createShredMapPackage = function(mapOptions) {
244244
readFilesProcessor.sourceFiles = [ {
245245
// Process all candidate files in `src` and its subfolders ...
246246
include: includeFiles,
247-
exclude: ['**/node_modules/**', '**/typings/**', '**/packages/**', '**/build/**'],
247+
exclude: ['**/node_modules/**', '**/typings/**', '**/packages/**', '**/dart/build/**'],
248248
// When calculating the relative path to these files use this as the base path.
249249
// So `src/foo/bar.js` will have relative path of `foo/bar.js`
250250
basePath: options.jadeDir

0 commit comments

Comments
 (0)