Skip to content

Commit 1901e09

Browse files
author
nareshmmr
committed
base 0 commit
0 parents  commit 1901e09

File tree

803 files changed

+166574
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

803 files changed

+166574
-0
lines changed

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake .

.githooks/detect-ethereum-keys

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
# Define the regex pattern for Ethereum keys
4+
ethereum_key_pattern="(0x[a-fA-F0-9]{40})"
5+
6+
# Loop over each file passed to the script
7+
for file in "$@"; do
8+
echo -n "Checking $file for ethereum keys... "
9+
10+
if grep -q "$ethereum_key_pattern" "$file"; then
11+
echo -e "❌\nFound eth keys in $file:"
12+
grep -n "$ethereum_key_pattern" "$file"
13+
echo -e "\e[31mRemove the Ethereum key before committing.\e[0m\n"
14+
exit 1
15+
else
16+
echo ""
17+
fi
18+
done

.githooks/detect-rpc-urls

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
# Define the regex pattern for HTTP and WS URLs
4+
url_pattern="(http|ws)(s)?:\/\/[^ \t\n\r]+"
5+
6+
# Loop over each file passed to the script
7+
for file in "$@"; do
8+
echo -n "Checking $file for RPC URLs... "
9+
if grep -q "$url_pattern" "$file"; then
10+
echo -e "❌\nFound RPC URL in $file:"
11+
grep -n "$url_pattern" "$file"
12+
echo -e "\e[31mRemove the RPC URL before committing.\e[0m\n"
13+
exit 1
14+
else
15+
echo ""
16+
fi
17+
done

.githooks/go-lint

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
# Find all 'go.mod' files, get their directories, and run 'go mod tidy'
4+
find "./" -type f -name 'go.mod' -print0 | while IFS= read -r -d $'\0' file; do
5+
directory=$(dirname "$file")
6+
cd "$directory" || exit 1
7+
8+
# Run linter and capture exit status
9+
set +e
10+
golangci-lint run -v
11+
linting_result=$?
12+
set -e
13+
14+
# Check linting result
15+
if [[ $linting_result -ne 0 ]]; then
16+
echo -e "Executing linters in $directory... \e[31mNOK!\e[0m\n"
17+
echo -e "Run \`cd $directory && golangci-lint run --fix -v\` and fix the issues\n"
18+
exit 1
19+
else
20+
echo -e "Executing linters in $directory... \e[32mOK!\e[0m\n"
21+
fi
22+
cd - || exit 1
23+
done

.githooks/go-mod-local-replace

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
# Loop over each file passed to the script
4+
for file in "$@"; do
5+
echo -n "Checking $file for local replacements... "
6+
if grep -q 'replace .* => /' "$file"; then
7+
echo -e "❌\nFound local replacements in $file:"
8+
grep -n 'replace .* => /' "$file"
9+
echo -e "\e[31mYou forgot about a local replacement\e[0m\n"
10+
exit 1
11+
else
12+
echo ""
13+
fi
14+
done

.githooks/go-mod-tidy

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
set +e
4+
5+
# Find all 'go.mod' files, get their directories, and run 'go mod tidy'
6+
find "./" -type f -name 'go.mod' -print0 | while IFS= read -r -d $'\0' file; do
7+
dir=$(dirname "$file")
8+
echo "Executing cd \"$dir\" && go mod tidy"
9+
cd "$dir" || exit 1
10+
go mod tidy
11+
cd - || exit 1
12+
done
13+
# pre-commit stashes changes before running the hooks so we can use git to check for changes here
14+
# Run git diff and capture output
15+
output=$(git diff --stat)
16+
17+
if [ -z "$output" ]; then
18+
echo "No changes in any files."
19+
else
20+
echo "go.mod files that need to be tidied:"
21+
echo "$output" | awk -F '|' '/\|/ { print $1 }'
22+
exit 1
23+
fi

.githooks/go-test-build

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Find all 'go.mod' files, get their directories, and run an empty 'go test' in them to compile the tests.
6+
find "./" -type f -name 'go.mod' -print0 | while IFS= read -r -d $'\0' file; do
7+
dir=$(dirname "$file")
8+
echo "Executing cd \"$dir\" && go test -run=^# ./..."
9+
cd "$dir"
10+
go test -run=^# ./...
11+
cd -
12+
done

.githooks/run-unit-tests

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
printf "Executing unit tests..."
4+
5+
make test_unit

.githooks/typos

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
set +e
4+
# shellcheck disable=SC2068
5+
typos --config ./_typos.toml --force-exclude $@
6+
typos_result=$?
7+
set -e
8+
9+
# Check typos result
10+
if [[ $typos_result -ne 0 ]]; then
11+
echo -e "❌ Found typos\n"
12+
# shellcheck disable=SC2145
13+
echo -e "Run \`typos --write-changes --config ./_typos.toml --force-exclude $@\` and fix any issues left\n"
14+
exit 1
15+
fi
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
---
8+
9+
**Describe the bug**
10+
A clear and concise description of what the bug is.
11+
12+
**Versions**
13+
14+
- OS:
15+
- Integrations Framework Version:
16+
- plugin-testing-framework Version:
17+
18+
**To Reproduce**
19+
Steps to reproduce the behavior:
20+
21+
1. Go to '...'
22+
2. Click on '....'
23+
3. Scroll down to '....'
24+
4. See error
25+
26+
**Expected behavior**
27+
A clear and concise description of what you expected to happen.
28+
29+
**Code**
30+
If applicable, add the code of the test you're running.
31+
32+
**Additional context**
33+
Add any other context about the problem here.

0 commit comments

Comments
 (0)