all: sync with master; upd chlog
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"strings"
|
||||
"text/template"
|
||||
"time"
|
||||
|
||||
@@ -43,8 +44,8 @@ func main() {
|
||||
check(err)
|
||||
|
||||
// Sort all services and rules to make the output more predictable.
|
||||
slices.SortStableFunc(hlSvcs.BlockedServices, func(a, b *hlServicesService) (less bool) {
|
||||
return a.ID < b.ID
|
||||
slices.SortStableFunc(hlSvcs.BlockedServices, func(a, b *hlServicesService) (res int) {
|
||||
return strings.Compare(a.ID, b.ID)
|
||||
})
|
||||
for _, s := range hlSvcs.BlockedServices {
|
||||
slices.Sort(s.Rules)
|
||||
|
||||
@@ -468,7 +468,7 @@ rerun_with_root() {
|
||||
readonly r u v
|
||||
|
||||
log 'restarting with root privileges'
|
||||
|
||||
|
||||
# Group curl/wget together with an echo, so that if the former fails before
|
||||
# producing any output, the latter prints an exit command for the following
|
||||
# shell to execute to prevent it from getting an empty input and exiting
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# This comment is used to simplify checking local copies of the script. Bump
|
||||
# this number every time a significant change is made to this script.
|
||||
#
|
||||
# AdGuard-Project-Version: 4
|
||||
# AdGuard-Project-Version: 5
|
||||
|
||||
verbose="${VERBOSE:-0}"
|
||||
readonly verbose
|
||||
@@ -35,7 +35,7 @@ set -f -u
|
||||
go_version="$( "${GO:-go}" version )"
|
||||
readonly go_version
|
||||
|
||||
go_min_version='go1.20.7'
|
||||
go_min_version='go1.20.8'
|
||||
go_version_msg="
|
||||
warning: your go version (${go_version}) is different from the recommended minimal one (${go_min_version}).
|
||||
if you have the version installed, please set the GO environment variable.
|
||||
@@ -170,36 +170,62 @@ run_linter govulncheck ./...
|
||||
|
||||
run_linter gocyclo --over 10 .
|
||||
|
||||
# TODO(a.garipov): Enable for all.
|
||||
run_linter gocognit --over 10\
|
||||
# TODO(a.garipov): Enable 10 for all.
|
||||
run_linter gocognit --over='20'\
|
||||
./internal/querylog/\
|
||||
;
|
||||
|
||||
run_linter gocognit --over='19'\
|
||||
./internal/home/\
|
||||
;
|
||||
|
||||
run_linter gocognit --over='18'\
|
||||
./internal/aghtls/\
|
||||
;
|
||||
|
||||
run_linter gocognit --over='15'\
|
||||
./internal/aghos/\
|
||||
./internal/dnsforward/\
|
||||
./internal/filtering/\
|
||||
;
|
||||
|
||||
run_linter gocognit --over='14'\
|
||||
./internal/dhcpd\
|
||||
;
|
||||
|
||||
run_linter gocognit --over='13'\
|
||||
./internal/aghnet/\
|
||||
;
|
||||
|
||||
run_linter gocognit --over='12'\
|
||||
./internal/updater/\
|
||||
./internal/filtering/rewrite/\
|
||||
;
|
||||
|
||||
run_linter gocognit --over='10'\
|
||||
./internal/aghalg/\
|
||||
./internal/aghchan/\
|
||||
./internal/aghhttp/\
|
||||
./internal/aghio/\
|
||||
./internal/aghrenameio/\
|
||||
./internal/aghtest/\
|
||||
./internal/arpdb/\
|
||||
./internal/client/\
|
||||
./internal/confmigrate/\
|
||||
./internal/dhcpsvc\
|
||||
./internal/filtering/hashprefix/\
|
||||
./internal/filtering/rulelist/\
|
||||
./internal/filtering/safesearch/\
|
||||
./internal/next/\
|
||||
./internal/rdns/\
|
||||
./internal/schedule/\
|
||||
./internal/stats/\
|
||||
./internal/tools/\
|
||||
./internal/version/\
|
||||
./internal/whois/\
|
||||
./scripts/\
|
||||
;
|
||||
|
||||
# TODO(a.garipov): move these to the group above.
|
||||
run_linter gocognit --over 20 ./internal/aghnet/ ./internal/querylog/
|
||||
run_linter gocognit --over 19 ./internal/dnsforward/ ./internal/home/
|
||||
run_linter gocognit --over 18 ./internal/aghtls/
|
||||
run_linter gocognit --over 17 ./internal/filtering ./internal/filtering/rewrite/
|
||||
run_linter gocognit --over 15 ./internal/aghos/ ./internal/dhcpd/
|
||||
run_linter gocognit --over 14 ./internal/stats/
|
||||
run_linter gocognit --over 12 ./internal/updater/
|
||||
run_linter gocognit --over 11 ./internal/aghtest/
|
||||
|
||||
run_linter ineffassign ./...
|
||||
|
||||
run_linter unparam ./...
|
||||
@@ -212,33 +238,62 @@ run_linter looppointer ./...
|
||||
|
||||
run_linter nilness ./...
|
||||
|
||||
# TODO(a.garipov): Add fieldalignment?
|
||||
# TODO(a.garipov): Enable for all.
|
||||
run_linter fieldalignment \
|
||||
./internal/aghalg/\
|
||||
./internal/aghchan/\
|
||||
./internal/aghhttp/\
|
||||
./internal/aghio/\
|
||||
./internal/aghos/\
|
||||
./internal/aghrenameio/\
|
||||
./internal/aghtest/\
|
||||
./internal/aghtls/\
|
||||
./internal/arpdb/\
|
||||
./internal/client/\
|
||||
./internal/confmigrate/\
|
||||
./internal/dhcpsvc/\
|
||||
./internal/filtering/hashprefix/\
|
||||
./internal/filtering/rewrite/\
|
||||
./internal/filtering/rulelist/\
|
||||
./internal/filtering/safesearch/\
|
||||
./internal/next/...\
|
||||
./internal/querylog/\
|
||||
./internal/rdns/\
|
||||
./internal/stats/\
|
||||
./internal/updater/\
|
||||
./internal/version/\
|
||||
./internal/whois/\
|
||||
;
|
||||
|
||||
run_linter -e shadow --strict ./...
|
||||
|
||||
# TODO(a.garipov): Enable for all.
|
||||
run_linter gosec --quiet\
|
||||
./internal/aghalg\
|
||||
./internal/aghchan\
|
||||
./internal/aghhttp\
|
||||
./internal/aghio\
|
||||
./internal/aghnet\
|
||||
./internal/aghos\
|
||||
./internal/aghalg/\
|
||||
./internal/aghchan/\
|
||||
./internal/aghhttp/\
|
||||
./internal/aghio/\
|
||||
./internal/aghnet/\
|
||||
./internal/aghos/\
|
||||
./internal/aghrenameio/\
|
||||
./internal/aghtest\
|
||||
./internal/client\
|
||||
./internal/dhcpd\
|
||||
./internal/dhcpsvc\
|
||||
./internal/dnsforward\
|
||||
./internal/aghtest/\
|
||||
./internal/arpdb/\
|
||||
./internal/client/\
|
||||
./internal/confmigrate/\
|
||||
./internal/dhcpd/\
|
||||
./internal/dhcpsvc/\
|
||||
./internal/dnsforward/\
|
||||
./internal/filtering/hashprefix/\
|
||||
./internal/filtering/rewrite/\
|
||||
./internal/filtering/rulelist/\
|
||||
./internal/next\
|
||||
./internal/rdns\
|
||||
./internal/schedule\
|
||||
./internal/stats\
|
||||
./internal/tools\
|
||||
./internal/version\
|
||||
./internal/whois\
|
||||
./internal/filtering/safesearch/\
|
||||
./internal/next/\
|
||||
./internal/rdns/\
|
||||
./internal/schedule/\
|
||||
./internal/stats/\
|
||||
./internal/tools/\
|
||||
./internal/version/\
|
||||
./internal/whois/\
|
||||
;
|
||||
|
||||
run_linter errcheck ./...
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# This comment is used to simplify checking local copies of the script. Bump
|
||||
# this number every time a significant change is made to this script.
|
||||
#
|
||||
# AdGuard-Project-Version: 2
|
||||
# AdGuard-Project-Version: 3
|
||||
|
||||
verbose="${VERBOSE:-0}"
|
||||
readonly verbose
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# This comment is used to simplify checking local copies of the script. Bump
|
||||
# this number every time a remarkable change is made to this script.
|
||||
#
|
||||
# AdGuard-Project-Version: 2
|
||||
# AdGuard-Project-Version: 3
|
||||
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ trap not_found EXIT
|
||||
run_linter() (
|
||||
set +e
|
||||
|
||||
if [ "$VERBOSE" -lt '2' ]
|
||||
if [ "${VERBOSE:-0}" -lt '2' ]
|
||||
then
|
||||
set +x
|
||||
fi
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# This comment is used to simplify checking local copies of the script. Bump
|
||||
# this number every time a remarkable change is made to this script.
|
||||
#
|
||||
# AdGuard-Project-Version: 3
|
||||
# AdGuard-Project-Version: 5
|
||||
|
||||
verbose="${VERBOSE:-0}"
|
||||
readonly verbose
|
||||
@@ -31,7 +31,7 @@ set -f -u
|
||||
|
||||
# trailing_newlines is a simple check that makes sure that all plain-text files
|
||||
# have a trailing newlines to make sure that all tools work correctly with them.
|
||||
trailing_newlines() {
|
||||
trailing_newlines() (
|
||||
nl="$( printf "\n" )"
|
||||
readonly nl
|
||||
|
||||
@@ -42,15 +42,39 @@ trailing_newlines() {
|
||||
':!*.zip'\
|
||||
| while read -r f
|
||||
do
|
||||
if [ "$( tail -c -1 "$f" )" != "$nl" ]
|
||||
final_byte="$( tail -c -1 "$f" )"
|
||||
if [ "$final_byte" != "$nl" ]
|
||||
then
|
||||
printf '%s: must have a trailing newline\n' "$f"
|
||||
fi
|
||||
done
|
||||
)
|
||||
|
||||
# trailing_whitespace is a simple check that makes sure that there are no
|
||||
# trailing whitespace in plain-text files.
|
||||
trailing_whitespace() {
|
||||
# NOTE: Adjust for your project.
|
||||
git ls-files\
|
||||
':!*.bmp'\
|
||||
':!*.jpg'\
|
||||
':!*.mmdb'\
|
||||
':!*.png'\
|
||||
':!*.svg'\
|
||||
':!*.tar.gz'\
|
||||
':!*.webp'\
|
||||
':!*.zip'\
|
||||
| while read -r f
|
||||
do
|
||||
grep -e '[[:space:]]$' -n -- "$f"\
|
||||
| sed -e "s:^:${f}\::" -e 's/ \+$/>>>&<<</'
|
||||
done
|
||||
}
|
||||
|
||||
run_linter -e trailing_newlines
|
||||
|
||||
git ls-files -- '*.md' '*.txt' '*.yaml' '*.yml' 'client/src/__locales/en.json'\
|
||||
run_linter -e trailing_whitespace
|
||||
|
||||
git ls-files -- '*.conf' '*.md' '*.txt' '*.yaml' '*.yml'\
|
||||
'client/src/__locales/en.json'\
|
||||
| xargs misspell --error\
|
||||
| sed -e 's/^/misspell: /'
|
||||
|
||||
@@ -76,8 +76,8 @@ do
|
||||
# Skip the ones that were failed by a duplicate upload error.
|
||||
case "$snapcraft_output"
|
||||
in
|
||||
(*'A file with this exact same content has already been uploaded'|\
|
||||
'Error checking upload uniqueness'*)
|
||||
(*'A file with this exact same content has already been uploaded'*|\
|
||||
*'Error checking upload uniqueness'*)
|
||||
|
||||
log "warning: duplicate upload, skipping"
|
||||
log "snapcraft upload error: ${snapcraft_output}"
|
||||
|
||||
Reference in New Issue
Block a user