Pull request: all: replace aghstrings with stringutil
Merge in DNS/adguard-home from add-stringutil to master Squashed commit of the following: commit 4ca9b29356de7d0a162b1e5a6496c691e9751f15 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Jul 29 17:29:25 2021 +0300 all: replace aghstrings with stringutil
This commit is contained in:
@@ -4,29 +4,32 @@ set -e -f -u
|
||||
|
||||
# Show all temporary todos to the programmer but don't fail the commit
|
||||
# if there are any, because the commit could be in a temporary branch.
|
||||
git grep -e 'TODO.*!!' -- ':!HACKING.md' ':!scripts/hooks/pre-commit' | cat || :
|
||||
git grep -e 'TODO.*!!' -- ':!scripts/hooks/pre-commit' | cat || :
|
||||
|
||||
verbose="${VERBOSE:-0}"
|
||||
readonly verbose
|
||||
|
||||
if [ "$( git diff --cached --name-only -- 'client/*.js' )" ]
|
||||
then
|
||||
make js-lint js-test
|
||||
make VERBOSE="$verbose" js-lint js-test
|
||||
fi
|
||||
|
||||
if [ "$( git diff --cached --name-only -- 'client2/*.js' 'client2/*.ts' 'client2/*.tsx' )" ]
|
||||
then
|
||||
make js-beta-lint js-beta-test
|
||||
make VERBOSE="$verbose" js-beta-lint js-beta-test
|
||||
fi
|
||||
|
||||
if [ "$( git diff --cached --name-only -- '*.go' '*.mod' '*.sh' 'Makefile' )" ]
|
||||
then
|
||||
make go-os-check go-lint go-test
|
||||
make VERBOSE="$verbose" go-os-check go-lint go-test
|
||||
fi
|
||||
|
||||
if [ "$( git diff --cached --name-only -- '*.md' '*.yaml' '*.yml' )" ]
|
||||
then
|
||||
make txt-lint
|
||||
make VERBOSE="$verbose" txt-lint
|
||||
fi
|
||||
|
||||
if [ "$( git diff --cached --name-only -- './openapi/openapi.yaml' )" ]
|
||||
then
|
||||
make openapi-lint
|
||||
make VERBOSE="$verbose" openapi-lint
|
||||
fi
|
||||
|
||||
@@ -73,11 +73,31 @@ esac
|
||||
|
||||
# Simple Analyzers
|
||||
|
||||
# blocklist_imports is a simple check against unwanted packages. Package
|
||||
# io/ioutil is soft-deprecated. Packages errors and log are replaced by our own
|
||||
# packages in the github.com/AdguardTeam/golibs module.
|
||||
# blocklist_imports is a simple check against unwanted packages. The following
|
||||
# packages are banned:
|
||||
#
|
||||
# * Package io/ioutil is soft-deprecated.
|
||||
#
|
||||
# * Packages errors and log are replaced by our own packages in the
|
||||
# github.com/AdguardTeam/golibs module.
|
||||
#
|
||||
# * Package reflect is often an overkill, and for deep comparisons there are
|
||||
# much better functions in module github.com/google/go-cmp. Which is
|
||||
# already our indirect dependency and which may or may not enter the stdlib
|
||||
# at some point.
|
||||
#
|
||||
# See https://github.com/golang/go/issues/45200.
|
||||
#
|
||||
# * Package unsafe is… unsafe.
|
||||
#
|
||||
blocklist_imports() {
|
||||
git grep -F -e '"errors"' -e '"io/ioutil"' -e '"log"' -- '*.go' || exit 0;
|
||||
git grep\
|
||||
-e '[[:space:]]"errors"$'\
|
||||
-e '[[:space:]]"io/ioutil"$'\
|
||||
-e '[[:space:]]"log"$'\
|
||||
-e '[[:space:]]"reflect"$'\
|
||||
-e '[[:space:]]"unsafe"$'\
|
||||
-- '*.go' || exit 0;
|
||||
}
|
||||
|
||||
# method_const is a simple check against the usage of some raw strings and
|
||||
@@ -181,8 +201,7 @@ gocyclo --over 17 ./internal/dhcpd/ ./internal/dnsforward/\
|
||||
|
||||
# Apply stricter standards to new or vetted code
|
||||
gocyclo --over 10 ./internal/aghio/ ./internal/aghnet/ ./internal/aghos/\
|
||||
./internal/aghstrings/ ./internal/aghtest/ ./internal/tools/\
|
||||
./internal/version/ ./main.go
|
||||
./internal/aghtest/ ./internal/tools/ ./internal/version/ ./main.go
|
||||
|
||||
gosec --quiet $go_files
|
||||
|
||||
|
||||
Reference in New Issue
Block a user