forked from ava-labs/avalanchego
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0eb61fb
commit ec147ab
Showing
8 changed files
with
52 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ fi | |
# by default, "./scripts/lint.sh" runs all lint tests | ||
# to run only "license_header" test | ||
# TESTS='license_header' ./scripts/lint.sh | ||
TESTS=${TESTS:-"golangci_lint license_header require_error_is_no_funcs_as_params single_import interface_compliance_nil require_equal_zero require_len_zero require_equal_len"} | ||
TESTS=${TESTS:-"golangci_lint license_header require_error_is_no_funcs_as_params single_import interface_compliance_nil require_equal_zero require_len_zero require_equal_len require_nil"} | ||
|
||
function test_golangci_lint { | ||
go install -v github.com/golangci/golangci-lint/cmd/[email protected] | ||
|
@@ -102,6 +102,29 @@ function test_require_equal_len { | |
fi | ||
} | ||
|
||
function test_require_nil { | ||
if grep -R -o -P 'require\..+?!= nil' .; then | ||
echo "" | ||
echo "Use require.NotNil when testing for nil inequality." | ||
echo "" | ||
return 1 | ||
fi | ||
|
||
if grep -R -o -P 'require\..+?== nil' .; then | ||
echo "" | ||
echo "Use require.Nil when testing for nil equality." | ||
echo "" | ||
return 1 | ||
fi | ||
|
||
if grep -R -o -P 'require\.ErrorIs.+?nil\)' .; then | ||
echo "" | ||
echo "Use require.NoError instead of require.ErrorIs when testing for nil error." | ||
echo "" | ||
return 1 | ||
fi | ||
} | ||
|
||
# Ref: https://go.dev/doc/effective_go#blank_implements | ||
function test_interface_compliance_nil { | ||
if grep -R -o -P '_ .+? = &.+?\{\}' .; then | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters