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

chore(travis): report bad code excerpts (BAD FILENAME) in docs #2154

Merged
merged 2 commits into from
Aug 23, 2016
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
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 changes: 56 additions & 0 deletions scripts/check-docs.sh
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions scripts/config/bad-code-excerpt-skip-patterns.txt
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions tools/doc-shredder/doc-shredder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down