Skip to content

Commit

Permalink
Add --no-lint option
Browse files Browse the repository at this point in the history
Part of whatwg#232.
  • Loading branch information
domenic committed Jun 5, 2020
1 parent 258e37a commit 01c2daf
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ WATTSI_LATEST=90
# Shared state variables throughout this script
LOCAL_WATTSI=true
DO_UPDATE=true
DO_LINT=true
USE_DOCKER=false
VERBOSE=false
QUIET=false
Expand Down Expand Up @@ -71,12 +72,7 @@ function main {
HTML_GIT_DIR="$HTML_SOURCE/.git/"
HTML_SHA=${SHA_OVERRIDE:-$(git --git-dir="$HTML_GIT_DIR" rev-parse HEAD)}

$QUIET || echo "Linting the source file..."
./lint.sh "$HTML_SOURCE/source" || {
echo
echo "There were lint errors. Stopping."
exit 1
}
doLint

clearCacheIfNecessary

Expand Down Expand Up @@ -135,13 +131,17 @@ function processCommandLineArgs {
echo " -d|--docker Use Docker to build in a container."
echo " -s|--serve After building, serve the results on http://localhost:$SERVE_PORT."
echo " -n|--no-update Don't update before building; just build."
echo " -l|--no-lint Don't lint before building; just build."
echo " -q|--quiet Don't emit any messages except errors/warnings."
echo " -v|--verbose Show verbose output from every build step."
exit 0
;;
-n|--no-update|--no-updates)
DO_UPDATE=false
;;
-l|--no-lint)
DO_LINT=false
;;
-d|--docker)
USE_DOCKER=true
;;
Expand Down Expand Up @@ -210,6 +210,23 @@ function ensureHighlighterInstalled {
fi
}

# Runs the lint.sh script, if requested
# - Arguments: none
# - Output:
# - Will echo any errors and exit the script with error code 1 if lint fails.
function doLint {
if [[ $DO_LINT == "false" ]]; then
return
fi

$QUIET || echo "Linting the source file..."
./lint.sh "$HTML_SOURCE/source" || {
echo
echo "There were lint errors. Stopping."
exit 1
}
}

# Finds the location of the HTML Standard, and stores it in the HTML_SOURCE variable.
# It either guesses based on directory structure, or interactively prompts the user.
# - Arguments: none
Expand Down Expand Up @@ -412,6 +429,7 @@ function doDockerBuild {
$QUIET && DOCKER_RUN_ARGS+=( --quiet )
$VERBOSE && DOCKER_RUN_ARGS+=( --verbose )
$DO_UPDATE || DOCKER_RUN_ARGS+=( --no-update )
$DO_LINT || DOCKER_RUN_ARGS+=( --no-lint )
$SERVE && DOCKER_RUN_ARGS+=( --serve )

# Pass in the html-build SHA (since there's no .git directory inside the container)
Expand Down

0 comments on commit 01c2daf

Please sign in to comment.