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

New pre-commit hooks #38

Merged

Conversation

victorsevero
Copy link
Collaborator

@victorsevero victorsevero commented Jul 1, 2023

These were the other pre-commit hooks I considered adding to this project a month ago. What are your thoughts?

  • pygrep-hooks: enforce that python3.6+ type annotations are used instead of type comments;
  • add-trailing-comma: add trailing commas to calls and literals;
  • pydocstyle: check compliance with Python docstring conventions;
  • absolufy-imports: automatically convert relative imports to absolute;
  • cmake-format-precommit: CMake formatting and linting;
  • pre-commit-hooks: C/C++ formatting and linting;
  • doctoc: generate table of contents for markdown files.

I haven't run them on all files of the repo, I wanted to make this PR as clean as possible at first. Let me know if you think it's a good idea to run them before merging (in case of approval) or if we should open a new PR for that.

EDIT: didn't know that pre-commit was already running for all files in GH Actions. Nice!
EDIT²: I decided to remove C/C++ formatting and linting since it seems broken and not maintained anymore. I also removed the pydocstyle since we have so many files with no docs at all (but I'd love to enforce that in the future).

Copy link
Member

@pseudo-rnd-thoughts pseudo-rnd-thoughts left a comment

Choose a reason for hiding this comment

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

Thanks for the PR

Personally, while the doctoc can be helpful, I would prefer to us to do this by hand and I'm not sure how helpful it actually is looking at the readme.md for example

Also the pygrep-hooks doesn't seem to have changed any code and given we are 3.7+ then we can do actual python type hints so would remove this

@victorsevero victorsevero force-pushed the pre-commit-hooks branch 2 times, most recently from 7ab3c04 to 15d91e0 Compare July 4, 2023 23:22
Copy link
Member

@pseudo-rnd-thoughts pseudo-rnd-thoughts left a comment

Choose a reason for hiding this comment

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

Thanks for removing the TOC plugin from pre-commit but could you remove all of the instances that it added to the code in the markdown files

rev: v3.0.0
hooks:
- id: add-trailing-comma
- repo: https://github.com/MarcoGorelli/absolufy-imports
Copy link
Member

Choose a reason for hiding this comment

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

While I agree this is a helpful idea, I'm a bit nervous about an automated tool that updates the imports for me rather than warnings to change something. Second this doesn't seemed to have changed any code from what I can see.
Therefore, could you remove

@victorsevero
Copy link
Collaborator Author

Thanks for removing the TOC plugin from pre-commit but could you remove all of the instances that it added to the code in the markdown files

Sorry! I only searched for .MD (uppercase) files when I was reverting these changes. I'll remove that.

@pseudo-rnd-thoughts pseudo-rnd-thoughts merged commit 9b3cc61 into Farama-Foundation:master Jul 9, 2023
6 checks passed
@victorsevero victorsevero deleted the pre-commit-hooks branch July 10, 2023 20:39
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