Skip to content

Commit 01c2daf

Browse files
committed
Add --no-lint option
Part of #232.
1 parent 258e37a commit 01c2daf

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

build.sh

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ WATTSI_LATEST=90
1515
# Shared state variables throughout this script
1616
LOCAL_WATTSI=true
1717
DO_UPDATE=true
18+
DO_LINT=true
1819
USE_DOCKER=false
1920
VERBOSE=false
2021
QUIET=false
@@ -71,12 +72,7 @@ function main {
7172
HTML_GIT_DIR="$HTML_SOURCE/.git/"
7273
HTML_SHA=${SHA_OVERRIDE:-$(git --git-dir="$HTML_GIT_DIR" rev-parse HEAD)}
7374

74-
$QUIET || echo "Linting the source file..."
75-
./lint.sh "$HTML_SOURCE/source" || {
76-
echo
77-
echo "There were lint errors. Stopping."
78-
exit 1
79-
}
75+
doLint
8076

8177
clearCacheIfNecessary
8278

@@ -135,13 +131,17 @@ function processCommandLineArgs {
135131
echo " -d|--docker Use Docker to build in a container."
136132
echo " -s|--serve After building, serve the results on http://localhost:$SERVE_PORT."
137133
echo " -n|--no-update Don't update before building; just build."
134+
echo " -l|--no-lint Don't lint before building; just build."
138135
echo " -q|--quiet Don't emit any messages except errors/warnings."
139136
echo " -v|--verbose Show verbose output from every build step."
140137
exit 0
141138
;;
142139
-n|--no-update|--no-updates)
143140
DO_UPDATE=false
144141
;;
142+
-l|--no-lint)
143+
DO_LINT=false
144+
;;
145145
-d|--docker)
146146
USE_DOCKER=true
147147
;;
@@ -210,6 +210,23 @@ function ensureHighlighterInstalled {
210210
fi
211211
}
212212

213+
# Runs the lint.sh script, if requested
214+
# - Arguments: none
215+
# - Output:
216+
# - Will echo any errors and exit the script with error code 1 if lint fails.
217+
function doLint {
218+
if [[ $DO_LINT == "false" ]]; then
219+
return
220+
fi
221+
222+
$QUIET || echo "Linting the source file..."
223+
./lint.sh "$HTML_SOURCE/source" || {
224+
echo
225+
echo "There were lint errors. Stopping."
226+
exit 1
227+
}
228+
}
229+
213230
# Finds the location of the HTML Standard, and stores it in the HTML_SOURCE variable.
214231
# It either guesses based on directory structure, or interactively prompts the user.
215232
# - Arguments: none
@@ -412,6 +429,7 @@ function doDockerBuild {
412429
$QUIET && DOCKER_RUN_ARGS+=( --quiet )
413430
$VERBOSE && DOCKER_RUN_ARGS+=( --verbose )
414431
$DO_UPDATE || DOCKER_RUN_ARGS+=( --no-update )
432+
$DO_LINT || DOCKER_RUN_ARGS+=( --no-lint )
415433
$SERVE && DOCKER_RUN_ARGS+=( --serve )
416434

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

0 commit comments

Comments
 (0)