Skip to content

Commit

Permalink
all: imp lint
Browse files Browse the repository at this point in the history
  • Loading branch information
EugeneOne1 committed Aug 20, 2024
1 parent b04d9cd commit 00fc458
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ NOTE: Add new changes BELOW THIS COMMENT.

- Upstream server URL domain names requirements has been relaxed and now follow
the same rules as their domain specifications.
- Go version has been updated to [1.22.6][go-1.22.6].

### Fixed

Expand All @@ -48,6 +49,8 @@ NOTE: Add new changes BELOW THIS COMMENT.
[#7154]: https://github.com/AdguardTeam/AdGuardHome/pull/7154
[#7155]: https://github.com/AdguardTeam/AdGuardHome/pull/7155

[go-1.22.6]: https://groups.google.com/g/golang-announce/c/X4q_-Wf-5g4

<!--
NOTE: Add new changes ABOVE THIS COMMENT.
-->
Expand Down
5 changes: 0 additions & 5 deletions internal/filtering/hashprefix/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ func fromCacheItem(item *cacheItem) (data []byte) {
data = binary.BigEndian.AppendUint64(data, uint64(expiry))

for _, v := range item.hashes {
// nolint:looppointer // The subslice of v is used for a copy.
data = append(data, v[:]...)
}

Expand All @@ -63,7 +62,6 @@ func (c *Checker) findInCache(

i := 0
for _, hash := range hashes {
// nolint:looppointer // The has subslice is used for a cache lookup.
data := c.cache.Get(hash[:prefixLen])
if data == nil {
hashes[i] = hash
Expand Down Expand Up @@ -98,7 +96,6 @@ func (c *Checker) storeInCache(hashesToRequest, respHashes []hostnameHash) {

for _, hash := range respHashes {
var pref prefix
// nolint:looppointer // The hash subslice is used for a copy.
copy(pref[:], hash[:])

hashToStore[pref] = append(hashToStore[pref], hash)
Expand All @@ -109,11 +106,9 @@ func (c *Checker) storeInCache(hashesToRequest, respHashes []hostnameHash) {
}

for _, hash := range hashesToRequest {
// nolint:looppointer // The hash subslice is used for a cache lookup.
val := c.cache.Get(hash[:prefixLen])
if val == nil {
var pref prefix
// nolint:looppointer // The hash subslice is used for a copy.
copy(pref[:], hash[:])

c.setCache(pref, nil)
Expand Down
1 change: 0 additions & 1 deletion internal/filtering/hashprefix/hashprefix.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ func (c *Checker) getQuestion(hashes []hostnameHash) (q string) {
b := &strings.Builder{}

for _, hash := range hashes {
// nolint:looppointer // The hash subslice is used for hex encoding.
stringutil.WriteToBuilder(b, hex.EncodeToString(hash[:prefixLen]), ".")
}

Expand Down
6 changes: 3 additions & 3 deletions scripts/hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ fi
verbose="${VERBOSE:-0}"
readonly verbose

if [ "$( git diff --cached --name-only -- 'client/*.js' )" ]
if [ "$( git diff --cached --name-only -- 'client/*.js' || true )" != '' ]
then
make VERBOSE="$verbose" js-lint js-test
fi

if [ "$( git diff --cached --name-only -- '*.go' '*.mod' 'Makefile' )" ]
if [ "$( git diff --cached --name-only -- '*.go' '*.mod' 'Makefile' || true )" != '' ]
then
make VERBOSE="$verbose" go-os-check go-lint go-test
fi
Expand All @@ -109,7 +109,7 @@ then
make VERBOSE="$verbose" txt-lint
fi

if [ "$( git diff --cached --name-only -- './openapi/openapi.yaml' )" ]
if [ "$( git diff --cached --name-only -- './openapi/openapi.yaml' || true )" != '' ]
then
make VERBOSE="$verbose" openapi-lint
fi
18 changes: 17 additions & 1 deletion scripts/make/sh-lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,23 @@ then
fi

# NOTE: Adjust for your project.
#
# TODO(e.burkov): Add build-docker.sh, build-release.sh and install.sh.
shellcheck -e 'SC2250' -f 'gcc' -o 'all' -x --\
./scripts/hooks/*\
./scripts/make/*\
./scripts/snap/*\
./scripts/make/clean.sh\
./scripts/make/go-bench.sh\
./scripts/make/go-build.sh\
./scripts/make/go-deps.sh\
./scripts/make/go-fuzz.sh\
./scripts/make/go-lint.sh\
./scripts/make/go-test.sh\
./scripts/make/go-tools.sh\
./scripts/make/go-upd-tools.sh\
./scripts/make/helper.sh\
./scripts/make/md-lint.sh\
./scripts/make/sh-lint.sh\
./scripts/make/txt-lint.sh\
./scripts/make/version.sh\
;

0 comments on commit 00fc458

Please sign in to comment.