Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Git: add pre-commit hooks #4289

Merged
merged 7 commits into from
Jan 11, 2023
Merged

Conversation

antirotor
Copy link
Member

@antirotor antirotor commented Jan 6, 2023

Description

This PR is adding pre-commit to OpenPype. It comes with pre-configured checks:

trailing-whitespace

check for trailing whitespace

end-of-file-fixer

check if there is no new line at the end of the file

check-yaml

check yaml syntax

check-added-large-files

check if newly added files are larger than 500 Kb (default value)

no-commit-to-branch

check that the commit goes to sane branch defined with following regex:

^(?!((enhancement|feature|bugfix|documentation|tests|local)\/[a-zA-Z0-9\-]+)$).*

so that will prevent accidental commits to main, develop and various custom branch names. Only allowed branch prefixes are:
enhancement, feature, bugfix, documentation, tests, local

and lastly it is running the code against black.

More can be added to .pre-commit-config.yaml

Installation

You can either run create_env script, or manually run ./.poetry/bin/poetry run pre-commit install.

@antirotor antirotor added the type: enhancement Enhancements to existing functionality label Jan 6, 2023
@antirotor antirotor self-assigned this Jan 6, 2023
@iLLiCiTiT
Copy link
Member

The PR is mixing 3.15.* changes and develop changes.

@antirotor
Copy link
Member Author

The PR is mixing 3.15.* changes and develop changes.

what changes? If you refer to the fixes on create_env, they are needed even in 3.14

@iLLiCiTiT
Copy link
Member

iLLiCiTiT commented Jan 9, 2023

Poetry.lock file

@antirotor
Copy link
Member Author

Poetry.lock file

that is just result of running poetry update against current pyproject.toml so I guess it isn't adding anything new or changing major versions. And if it does, it is a matter of tighter version specifications.

@iLLiCiTiT
Copy link
Member

The issue is that poetry.lock is already changed in release 3.15.x branch and it would be hell to resolve it with all these changes.

@kalisp
Copy link
Member

kalisp commented Jan 9, 2023

Didn't we also had "chore" branches? (These were for refactoring cases, eg. it is not a new feature, nor bugfix.)
(That's for the limiting regex.)

@antirotor antirotor changed the base branch from develop to release/3.15.x January 9, 2023 17:41
@antirotor antirotor merged commit 7418da2 into release/3.15.x Jan 11, 2023
@antirotor antirotor deleted the enhancement/add-pre-commit-hooks branch January 11, 2023 10:28
@github-actions github-actions bot added this to the next-minor milestone Jan 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: enhancement Enhancements to existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants