-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update pre-commit - separate pre-commit and pre-push - fix lint issues in grafana * fix some shell check issues * review comments and simplify lint also add tidy check * Add installs to make and nix for installing the pre-push hook * add more default checks * Fix some whitespace issues and remove yaml * Fix whitespace issues in charts * Add pre-commit checks to ci * Rename to be more clear and consistent * Fix mock server * test * add unit tests back in * use version itself
- Loading branch information
Showing
104 changed files
with
312 additions
and
194 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
# Define the regex pattern for Ethereum keys | ||
ethereum_key_pattern="(0x[a-fA-F0-9]{40})" | ||
|
||
# Loop over each file passed to the script | ||
for file in "$@"; do | ||
echo -n "Checking $file for ethereum keys... " | ||
|
||
if grep -q "$ethereum_key_pattern" "$file"; then | ||
echo -e "❌\nFound eth keys in $file:" | ||
grep -n "$ethereum_key_pattern" "$file" | ||
echo -e "\e[31mRemove the Ethereum key before committing.\e[0m\n" | ||
exit 1 | ||
else | ||
echo "✅" | ||
fi | ||
done |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
# Define the regex pattern for HTTP and WS URLs | ||
url_pattern="(http|ws)(s)?:\/\/[^ \t\n\r]+" | ||
|
||
# Loop over each file passed to the script | ||
for file in "$@"; do | ||
echo -n "Checking $file for RPC URLs... " | ||
if grep -q "$url_pattern" "$file"; then | ||
echo -e "❌\nFound RPC URL in $file:" | ||
grep -n "$url_pattern" "$file" | ||
echo -e "\e[31mRemove the RPC URL before committing.\e[0m\n" | ||
exit 1 | ||
else | ||
echo "✅" | ||
fi | ||
done |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
# Find all 'go.mod' files, get their directories, and run 'go mod tidy' | ||
# shellcheck disable=SC2016 | ||
find "./" -type f -name 'go.mod' -print0 | xargs -0 -I{} bash -c ' | ||
directory=$(dirname "{}") | ||
cd "$directory" || exit 1 | ||
# Run linter and capture exit status | ||
golangci-lint run > /dev/null | ||
local linting_result=$? | ||
# Check linting result | ||
if [[ $linting_result -ne 0 ]]; then | ||
echo -e "Executing linters in $directory... \e[31mNOK!\e[0m\n" | ||
echo -e "Run \`cd $directory && golangci-lint run -fix -v\` and fix the issues\n" | ||
exit 1 | ||
else | ||
echo -e "Executing linters in $directory... \e[32mOK!\e[0m\n" | ||
fi | ||
' |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
# Loop over each file passed to the script | ||
for file in "$@"; do | ||
echo -n "Checking $file for local replacements... " | ||
if grep -q 'replace .* => /' "$file"; then | ||
echo -e "❌\nFound local replacements in $file:" | ||
grep -n 'replace .* => /' "$file" | ||
echo -e "\e[31mYou forgot about a local replacement\e[0m\n" | ||
exit 1 | ||
else | ||
echo "✅" | ||
fi | ||
done |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# Find all 'go.mod' files, get their directories, and run 'go mod tidy' | ||
# shellcheck disable=SC2016 | ||
find "./" -type f -name 'go.mod' -print0 | xargs -0 -I{} bash -c ' | ||
dir=$(dirname "{}") | ||
echo "Executing cd \"$dir\" && go mod tidy" | ||
cd "$dir" | ||
go mod tidy | ||
' | ||
# pre-commit stashes changes before running the hooks so we can use git to check for changes here | ||
# Run git diff and capture output | ||
output=$(git diff --stat) | ||
|
||
if [ -z "$output" ]; then | ||
echo "No changes in any files." | ||
else | ||
echo "go.mod files that need to be tidied:" | ||
echo "$output" | awk -F '|' '/\|/ { print $1 }' | ||
exit 1 | ||
fi |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# Find all 'go.mod' files, get their directories, and run an empty 'go test' in them to compile the tests. | ||
# shellcheck disable=SC2016 | ||
find "./" -type f -name 'go.mod' -print0 | xargs -0 -I{} bash -c ' | ||
dir=$(dirname "{}") | ||
echo "Executing cd \"$dir\" && go test -run=^# ./..." | ||
cd "$dir" | ||
go test -run=^# ./... | ||
' |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
printf "Executing unit tests..." | ||
|
||
make test_unit > /dev/null 2>&1 | ||
unit_test_result=$? | ||
|
||
if [[ $unit_test_result -ne 0 ]]; | ||
then | ||
printf "Executing unit tests... ❌\n" | ||
printf "Run 'make test_unit' to verify after you fix them.\n" | ||
exit 1 | ||
else | ||
printf "Executing unit tests... ✅\n" | ||
fi |
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
Validating CODEOWNERS rules …
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 |
---|---|---|
@@ -1 +1 @@ | ||
* @sebawo @smartcontractkit/test-tooling-team | ||
* @sebawo @smartcontractkit/test-tooling-team |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
*.sh | ||
besu-prysm-*.tgz | ||
besu-prysm-*.tgz |
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
Oops, something went wrong.