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

Git hooks for contributors #80

Open
Mandera opened this issue Apr 16, 2023 · 1 comment
Open

Git hooks for contributors #80

Mandera opened this issue Apr 16, 2023 · 1 comment
Milestone

Comments

@Mandera
Copy link
Collaborator

Mandera commented Apr 16, 2023

Since the .git folder isn't versioned for security reasons to execute arbitrary code we have an issue; pre-commit and pre-push hooks won't be there when forked or cloned.

Options

  • Rely on generate.py to create all hooks for us - already implemented
    • Might get tricky to merge with additional checks - The pre-commit package has this nice config file. Not sure how that works under the hood, might also be easy
  • Rely on pre-commit package and remove git hook definitions from Packager
    • Implement the pre-commit install command somewhere, inside generate_localfiles or make a new method probably coupled to
      def create_blank_locally(self, install=True):
    • Could add the generate_localfiles step in .pre-commit-config.yaml as a pre-commit repo perhaps?

I don't want developers to have to write pre-commit install. Everything should go through generate.py - I like it especially because it's very transparent for devs to look through the python code before running the file

@Mandera
Copy link
Collaborator Author

Mandera commented Apr 18, 2023

Might not be such a good idea to have generate.py to setup the dev environment, because it would require generalpackager to be installed.
Although I guess generalpackager could be put in every repos [dev] dependencies. Having circular dependency through the optional [dev] might be fine. These dev deps should be ignored by the mermaid graph too

generate.py is just something I made because I got tired of generating the workflow by hand, then it turned out to be pretty useful to keep git hooks in sync as well. Also nice to make sure the readme has been generated properly

It's basically what happens in the sync stage of the workflow as well. Running it once will enable the pre-push hook to run it automatically, but only important (non-aesthetic) files

To summarize, generate_localfiles is used in a few places:

  • Manually by generate.py
  • In the pre push hook to halt if any non-aesthetic file was changed
  • In the CI unittest step (Might not be needed)
  • In the CI sync stage

The linting should probably be included in all of these places

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant