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/**`.
This commit is contained in:
Patrice Chalin 2016-08-23 10:16:47 -07:00 committed by Kathy Walrath
parent fcaf8fa365
commit aa439d28c5
4 changed files with 69 additions and 7 deletions

View File

@ -12,18 +12,17 @@ env:
- CHROME_BIN=chromium-browser
- LATEST_RELEASE=2.0.0-rc.5
- TASK_FLAGS="--dgeni-log=warn"
# - TASK_FLAGS=""
matrix:
- TASK=lint
- TASK="run-e2e-tests --fast" SCRIPT=examples-install.sh
- TASK="run-e2e-tests --fast" SCRIPT=examples-install-preview.sh
- TASK=build-compile SCRIPT=deploy-install.sh WAIT="travis_wait 50"
- TASK=build-compile SCRIPT=deploy-install-preview.sh WAIT="travis_wait 50"
- TASK=build-compile SCRIPT=deploy-install.sh WAIT="travis_wait 50" POST_SCRIPT="check-docs.sh -v"
- TASK=build-compile SCRIPT=deploy-install-preview.sh WAIT="travis_wait 50" POST_SCRIPT="check-docs.sh -v"
matrix:
fast_finish: true
allow_failures:
- env: TASK="run-e2e-tests --fast" SCRIPT=examples-install-preview.sh
- env: TASK=build-compile SCRIPT=deploy-install-preview.sh WAIT="travis_wait 50"
- env: TASK=build-compile SCRIPT=deploy-install-preview.sh WAIT="travis_wait 50" POST_SCRIPT="check-docs.sh -v"
before_install:
- source ./scripts/env-set.sh
- ./scripts/before-install.sh
@ -34,3 +33,4 @@ before_script:
- sh -e /etc/init.d/xvfb start
script:
- $WAIT gulp $TASK $TASK_FLAGS
- if [[ -n "$POST_SCRIPT" ]]; then ./scripts/$POST_SCRIPT; fi

56
scripts/check-docs.sh Executable file
View File

@ -0,0 +1,56 @@
#!/usr/bin/env bash
set -e -o pipefail
[[ -z "$NGIO_ENV_DEFS" ]] && . ./scripts/env-set.sh > /dev/null
if [[ "x$1" == "x-v" ]]; then VERBOSE=1; shift; fi
SITE=./www
CHECK_FOR=bad-code-excerpt
LOGFILE_PREFIX=$CHECK_FOR-log
LOGFILE_FULL=$TMP/$LOGFILE_PREFIX-full.txt
LOGFILE=$TMP/$LOGFILE_PREFIX.txt
SKIPFILE_BASE=$CHECK_FOR-skip-patterns.txt
SKIPFILE_SRC=./scripts/config/$SKIPFILE_BASE
SKIPFILE=$TMP/$SKIPFILE_BASE
if [[ ! -d $SITE ]]; then
echo "Missing site folder $SITE"
exit 1;
fi
travis_fold start $CHECK_FOR
echo "Searching site for HTML files containing bad code excerpts (BAD FILENAME)."
echo
if [[ -n "$VERBOSE" ]]; then
travis_fold start $CHECK_FOR-details
echo "Full file list with grep details:"
find $SITE -type f -name "*.html" -exec grep -Hne "BAD FILENAME" {} \; | tee $LOGFILE_FULL
travis_fold end $CHECK_FOR-details
echo
else
echo "Full file list:"
find $SITE -type f -name "*.html" -exec grep -le "BAD FILENAME" {} \; | tee $LOGFILE_FULL
fi
echo
echo "Skip patterns for paths of files known to have issues ($SKIPFILE_SRC):"
perl -pe 's/(\s+|\s*#.*)$/\n/g' $SKIPFILE_SRC | \
# Remove blank lines \
grep '.' > $SKIPFILE
cat $SKIPFILE
echo
echo "File list excluding those matching skip patterns:"
grep -v -E -f $SKIPFILE $LOGFILE_FULL | tee $LOGFILE || true
if [[ ! -s $LOGFILE ]]; then
echo "No matches, all is good!"
travis_fold end $CHECK_FOR
else
exit 1;
fi

View File

@ -0,0 +1,6 @@
# Comments & blank lines are ignored. Entry format (make pattern as specific as possible):
# <grep-pattern-to-match-file-path> # reason / issue number
/[jt]s/.*/api/router-deprecated/ # Obsolete API entries. No issue open yet.
/ts/latest/guide/style-guide.html # https://github.com/angular/angular.io/issues/2123
/ts/latest/guide/upgrade.html # In a transient state until RC6 - @filipe.silva

View File

@ -138,7 +138,7 @@ function createShredExamplePackage(shredOptions) {
readFilesProcessor.sourceFiles = [ {
// Process all candidate files in `src` and its subfolders ...
include: includeFiles ,
exclude: [ '**/node_modules/**', '**/dist/**', '**/typings/**', '**/packages/**', '**/build/**'],
exclude: [ '**/node_modules/**', '**/dist/**', '**/typings/**', '**/packages/**', '**/dart/build/**'],
// When calculating the relative path to these files use this as the base path.
// So `src/foo/bar.js` will have relative path of `foo/bar.js`
basePath: options.examplesDir
@ -190,7 +190,7 @@ function createShredJadePackage(shredOptions) {
readFilesProcessor.sourceFiles = [ {
// Process all candidate files in `src` and its subfolders ...
include: includeFiles ,
exclude: [ '**/node_modules/**', '**/typings/**', '**/packages/**', '**/build/**', '**/_code-examples.jade'],
exclude: [ '**/node_modules/**', '**/typings/**', '**/packages/**', '**/dart/build/**', '**/_code-examples.jade'],
// When calculating the relative path to these files use this as the base path.
// So `src/foo/bar.js` will have relative path of `foo/bar.js`
basePath: options.jadeDir
@ -244,7 +244,7 @@ var createShredMapPackage = function(mapOptions) {
readFilesProcessor.sourceFiles = [ {
// Process all candidate files in `src` and its subfolders ...
include: includeFiles,
exclude: ['**/node_modules/**', '**/typings/**', '**/packages/**', '**/build/**'],
exclude: ['**/node_modules/**', '**/typings/**', '**/packages/**', '**/dart/build/**'],
// When calculating the relative path to these files use this as the base path.
// So `src/foo/bar.js` will have relative path of `foo/bar.js`
basePath: options.jadeDir