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

Add pre-commit configuration #862

Merged
merged 2 commits into from
Jul 17, 2023
Merged

Conversation

lucacome
Copy link
Member

@lucacome lucacome commented Jul 14, 2023

Proposed changes

Adds configuration for pre-commit.com that runs checks automatically before committing and (in most cases) fix the problems.

Here the quick start for installing it, basically:
brew install pre-commit followed by pre-commit install. After that, it will run before every commit.

I've added some hooks in the config (there are many more):

golang-ci lint and prettier, which we're already using, will just run it automatically
pre-commit-hooks, has a few hooks, mostly about formatting (and end of line whitespaces and similar), and not committing large files or with merge conflicts.
gitleaks, for detecting and preventing hardcoded secrets like passwords, api keys, and tokens in git repos.

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch from my own fork

@lucacome lucacome self-assigned this Jul 14, 2023
@lucacome lucacome requested a review from a team as a code owner July 14, 2023 02:48
@github-actions github-actions bot added chore Pull requests for routine tasks documentation Improvements or additions to documentation labels Jul 14, 2023
Copy link
Member

@ciarams87 ciarams87 left a comment

Choose a reason for hiding this comment

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

🚀

@kate-osborn
Copy link
Contributor

Thanks for doing this @lucacome!

Can you add the pre-commit installation instructions or link to the quickstart installation list: https://github.com/nginxinc/nginx-kubernetes-gateway/blob/main/docs/developer/quickstart.md#setup-your-development-environment?

Copy link
Contributor

@pleshakov pleshakov left a comment

Choose a reason for hiding this comment

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

are we going to enable this in the CI too?

.pre-commit-config.yaml Show resolved Hide resolved
@lucacome
Copy link
Member Author

@kate-osborn I added the docs 👍

@pleshakov once this PR is merged I will enable the pre-commit CI for the repo. It's an app that we have installed for the org that runs the checks, commits fixable changes and keeps the dependencies up to date.

@lucacome lucacome merged commit 84d48e5 into nginxinc:main Jul 17, 2023
16 checks passed
@lucacome lucacome deleted the chore/add-pre-commit branch July 17, 2023 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Pull requests for routine tasks documentation Improvements or additions to documentation
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

5 participants