Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pre-commit #919

Merged
merged 14 commits into from
Apr 18, 2024
Merged

Update pre-commit #919

merged 14 commits into from
Apr 18, 2024

Conversation

tateexon
Copy link
Collaborator

@tateexon tateexon commented Apr 17, 2024

  • Break apart different pre-commit checks
  • Fix lint so it only runs once
  • Add Adam's checks for eth keys, rpc urls, and local replaces
  • Change unit test check to only run before push and not on pre-commit
  • Fixed some shell check issues so when people make changes to those files in the future they only have to deal with their changes and not pre-existing issues.

Below is a summarization created by an LLM (gpt-4-0125-preview). Be mindful of hallucinations and verify accuracy.

Why

The changes introduce additional pre-commit hooks for Ethereum keys, RPC URLs, Go mod local replaces, linting Go files, and a pre-push hook for running unit tests. They aim to enhance code quality and security by automating checks for sensitive keys, invalid URLs, local module replacements, and linting issues. Additionally, updating the golangci-lint version and adding shellcheck directives in shell scripts improve the development environment's consistency and compliance with best practices.

What

  • .githooks/RPC-URLs-pre-commit
    • Added a new pre-commit hook script to check for RPC URLs in the codebase.
  • .githooks/ethereum-keys-pre-commit
    • Added a new pre-commit hook script to check for Ethereum keys in the codebase.
  • .githooks/go-mod-local-replace-pre-commit
    • Added a new pre-commit hook script to check for local replacements in go.mod files.
  • .githooks/lint-go-pre-commit
    • Added a new pre-commit hook script for linting Go files.
  • .githooks/pre-push
    • Removed the existing pre-push hook script.
  • .githooks/unit-test-pre-push
    • Added a new pre-push hook script for running unit tests.
  • .pre-commit-config.yaml
    • Updated the pre-commit configuration to include the new pre-commit hooks for Ethereum keys, RPC URLs, Go mod local replaces, and linting Go files.
    • Removed the golangci-lint hook and replaced it with custom hooks.
    • Added a new pre-push hook for running unit tests.
  • .tool-versions
    • Updated golangci-lint from version 1.57.1 to 1.57.2.
  • charts/besu-prysm/install.sh and charts/geth-prysm/install.sh
    • Added shellcheck directives to disable specific warnings.
  • charts/besu-prysm/uninstall.sh and charts/geth-prysm/uninstall.sh
    • Added shellcheck directives and made minor adjustments for clarity and compliance.
  • grafana/client.go
    • Refactored variable names for consistency and added a comment to suppress a linter warning.
  • k8s-test-runner/package.sh
    • Added a safety check for changing directories and clarified the tar command.
  • k8s/scripts/buildBaseImage, k8s/scripts/buildImageHelper, k8s/scripts/buildTestImage, k8s/scripts/entrypoint
    • Added shellcheck directives in scripts and made minor adjustments for better clarity and compliance with best practices.

- separate pre-commit and pre-push
- fix lint issues in grafana
fi
done

echo -e "\n\e[37m*** No RPC URLs were found in files! ***\e[0m\n\n"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't have to deal with it now, but I don't think these are necessary. It seems like pre-commit doesn't bother to show any output unless you exit with a non-zero code (even then I've found that to be oddly funky)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call out, makes the scripts a bit more clean if we get rid of these.

@cl-sonarqube-production
Copy link

@tateexon tateexon merged commit 04f103d into main Apr 18, 2024
17 checks passed
@tateexon tateexon deleted the tate-pre-commit-updates branch April 18, 2024 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants