From 3b846bae6e97b456633c3799cd1def2bc9dca90d Mon Sep 17 00:00:00 2001 From: Stanislav Chzhen Date: Thu, 7 Sep 2023 15:05:21 +0300 Subject: [PATCH] Pull request 1998: upd-proj-skel Squashed commit of the following: commit 5cc2914b18fd71ff83e2872ef6755f2ff56d653c Merge: bf14a513e 085b4fdce Author: Stanislav Chzhen Date: Thu Sep 7 14:58:44 2023 +0300 Merge branch 'master' into upd-proj-skel commit bf14a513eb46ebf2c2809246603b071e6c334e9f Author: Stanislav Chzhen Date: Thu Sep 7 14:47:10 2023 +0300 all: imp code commit ec3f7a88b86b3f423193aa95c2e820bcd86fdef3 Author: Stanislav Chzhen Date: Thu Sep 7 14:28:39 2023 +0300 scripts: upd go lint commit 6a9342f6058bc21252f97045f7015440f013cb09 Author: Stanislav Chzhen Date: Thu Sep 7 14:13:17 2023 +0300 all: upd proj skel --- .../filtering/rewrite/item_internal_test.go | 2 +- scripts/make/go-lint.sh | 29 +++++++++++++++++-- scripts/make/go-tools.sh | 2 +- scripts/make/helper.sh | 4 +-- scripts/make/txt-lint.sh | 9 +++--- 5 files changed, 36 insertions(+), 10 deletions(-) diff --git a/internal/filtering/rewrite/item_internal_test.go b/internal/filtering/rewrite/item_internal_test.go index 68d88223..a63b2cea 100644 --- a/internal/filtering/rewrite/item_internal_test.go +++ b/internal/filtering/rewrite/item_internal_test.go @@ -18,9 +18,9 @@ func TestItem_equal(t *testing.T) { } testCases := []struct { - name string left *Item right *Item + name string want bool }{{ name: "nil_left", diff --git a/scripts/make/go-lint.sh b/scripts/make/go-lint.sh index ae230d15..e89eca6d 100644 --- a/scripts/make/go-lint.sh +++ b/scripts/make/go-lint.sh @@ -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 @@ -238,7 +238,32 @@ 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 ./... diff --git a/scripts/make/go-tools.sh b/scripts/make/go-tools.sh index f9ccb42f..fdb70f86 100644 --- a/scripts/make/go-tools.sh +++ b/scripts/make/go-tools.sh @@ -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 diff --git a/scripts/make/helper.sh b/scripts/make/helper.sh index 6d7fe778..9c4ff88b 100644 --- a/scripts/make/helper.sh +++ b/scripts/make/helper.sh @@ -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 diff --git a/scripts/make/txt-lint.sh b/scripts/make/txt-lint.sh index 74d5758d..578297ec 100644 --- a/scripts/make/txt-lint.sh +++ b/scripts/make/txt-lint.sh @@ -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: 4 +# 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,12 +42,13 @@ 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.