AdGuardHome/scripts/make/txt-lint.sh
Ainar Garipov b92db25e6a Pull request: scripts: imp linter scripts
Merge in DNS/adguard-home from imp-lint to master

Squashed commit of the following:

commit f5b5115a225431855798764770423209e03d6020
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Aug 23 17:57:59 2021 +0300

    scripts: imp linter scripts
2021-08-23 18:10:36 +03:00

50 lines
976 B
Bash

#!/bin/sh
verbose="${VERBOSE:-0}"
readonly verbose
# Set verbosity.
if [ "$verbose" -gt '0' ]
then
set -x
fi
# Set $EXIT_ON_ERROR to zero to see all errors.
if [ "${EXIT_ON_ERROR:-1}" -eq '0' ]
then
set +e
else
set -e
fi
# We don't need glob expansions and we want to see errors about unset variables.
set -f -u
# Deferred Helpers
not_found_msg='
looks like a binary not found error.
make sure you have installed the linter binaries using:
$ make go-tools
'
readonly not_found_msg
# TODO(a.garipov): Put it into a separate script and source it both here and in
# go-lint.sh?
not_found() {
if [ "$?" -eq '127' ]
then
# Code 127 is the exit status a shell uses when a command or
# a file is not found, according to the Bash Hackers wiki.
#
# See https://wiki.bash-hackers.org/dict/terms/exit_status.
echo "$not_found_msg" 1>&2
fi
}
trap not_found EXIT
git ls-files -- '*.md' '*.yaml' '*.yml' 'client/src/__locales/en.json'\
| xargs misspell --error