cytomining / pycytominer

Python package for processing image-based profiling data
https://pycytominer.readthedocs.io
BSD 3-Clause "New" or "Revised" License
81 stars 36 forks source link

FeatureRequest: Commitizen pre-commit hooks #345

Open kenibrewer opened 1 year ago

kenibrewer commented 1 year ago

Feature type

General description of the proposed functionality

Adding commitizen pre-commit hooks will ensure that all commits are properly formatted for updating the CHANGELOG. However, there are potential side-effects of these hooks:

What would happen to PR's which don't abide this (would we disapprove solely based on the commit style)? Thinking about the end of the PR and getting ready to merge: how are squashes treated with this (would we lose the ability to leverage GitHub's built-in functionality here)?

_Originally posted by @d33bs in https://github.com/cytomining/pycytominer/pull/340#discussion_r1374868916_

Feature example

Commitizen provides two hooks as show below:

  - repo: https://github.com/commitizen-tools/commitizen
    rev: master
    hooks:
      - id: commitizen
      - stages: [pre-commit]
      - id: commitizen-branch
        stages: [push]

The commitizen hook prevents commits from being completed if they aren't formatted correctly. The commitzen-branch hook will check all of the commits of a branch prior to them being pushed to the repo.

Alternative Solutions

Additional information

No response

gwaybio commented 1 year ago

Thanks Ken, here are my two cents

I would like to keep the barrier to entry low for contributing to the project. I like the idea of this tool supporting CHANGELOGs, but not worth the risk of having someone not contribute b/c of an incorrectly formatted/written commit message. Am I understanding this correctly?

I like the first two alternative solutions, maybe let's do both? In the CONTRIBUTING doc, we can use language that encourages (but not requires) it's use and include setup instructions. I like the "raise warnings" options as it could be instructive for folks to improve their commit messages.

I don't really like the idea of maintainers adjusting commit messages. Maybe every once in a while, but I'd prefer for contributors original messages to be included most of the time, even if they are suboptimal. I'd rather have maintainers adjust the CHANGELOG.