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

task: add support for pre-commit, commitizen and commitlint #101

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cylewitruk
Copy link
Member

@cylewitruk cylewitruk commented Sep 21, 2023

Adds support for (optional) tooling along with project-wide configs for the tools.

  • pre-commit (https://pre-commit.com/) - this is a tool in python (pip install pre-commit) which makes distributing/re-using git hooks easy. Just pre-commit install in the project root and all the configuration will be applied for all of us :)
  • commitlint-rs (https://lib.rs/crates/commitlint-rs, though I had to make some modifications in a fork to get it working, will PR these changes to their repo) - this tool will lint according to the Conventional Commits rules which are setup in .commitlintrc.yaml. Trying to commit with an invalid message will reject the commit locally, so you can re-do the commit correctly without needing to rollback/rewrite history :)
  • commitizen (https://commitizen-tools.github.io/commitizen/) - also in python, pip install commitizen - tooling which can do things like bump the version, auto-generate CHANGELOG.md from Conventional Commits, etc. (see the auto-generated changelog in this PR).

That reminds me, I should update the readme as well... will do that tomorrow :) Since this repo is small and isolated it could be a decent PoC to evaluate if it would work for some of the other projects.

@obycode
Copy link
Collaborator

obycode commented Sep 22, 2023

My experience is that using a tool to generate the changelog from the conventional commits is helpful, but not good to completely automate. It's usually best to start with the generated changelog, then modify it as needed. How does this setup handle the changelog?

@cylewitruk
Copy link
Member Author

cylewitruk commented Sep 22, 2023

My experience is that using a tool to generate the changelog from the conventional commits is helpful, but not good to completely automate. It's usually best to start with the generated changelog, then modify it as needed. How does this setup handle the changelog?

You have to manually generate the changelog with cz changelog (or alternatively cz bump which will bump the version and update the changelog). But I wouldn't be against using this repo as a stomping ground for trying to refine a commit/PR strategy where we can reliably automate the changelog (with the goal of being able to be a reference repo for others)...

Another bonus with commitizen (cz command) is that is also has a cz commit option, which based on .cz.toml provides an interactive commit prompt to make it really easy to write compliant commit messages.

@obycode
Copy link
Collaborator

obycode commented Sep 22, 2023

Do you have experience in other projects of going with a completely automated changelog? I don't like that cz changelog overwrites the existing file, so it doesn't even leave us room to modify the output after-the-fact, without fear of it being overwritten later.

@obycode
Copy link
Collaborator

obycode commented Sep 22, 2023

@cylewitruk can you add a CONTRIBUTING.md to go with this?

Or a contributing section could just be added to the end of the README

@cylewitruk
Copy link
Member Author

Just commenting here that I haven't forgotten this issue, just been tunnel-visioned on the testing tool. Will get around to this eventually :)

@CLAassistant
Copy link

CLAassistant commented Nov 16, 2023

CLA assistant check
All committers have signed the CLA.

@smcclellan
Copy link
Collaborator

Converted to draft given it's not an immediate need. Can be reopened & merged at a later date.

@smcclellan smcclellan marked this pull request as draft April 22, 2024 14:56
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

4 participants