jorisroovers / gitlint

Linting for your git commit messages
http://jorisroovers.github.io/gitlint
MIT License
806 stars 99 forks source link

[UX] Be more verbose about what is being checked #376

Open webknjaz opened 1 year ago

webknjaz commented 1 year ago

Hi, I noticed that when checking a single commit (or a range that only has one), gitlint does not output its hash. This is confusing when it's used in a CI because it doesn't give contributors enough context in the job log, on what's wrong. Just a number and an error message without specifying what it refers to.

This is how I'm trying to work around the problem and make the output better digestible: https://github.com/cherrypy/cheroot/pull/579/files. Check out the workflow summary under Checks to see more — I'm adding a job summary there.

But how could gitlint itself improve this? I think, there should be a way to output more info, like the commit contents being checked (at least for the commits with violations), so the readers could see what's up without having to guess this by looking things up locally, detached from the CI run.

One more thing could be linking to the error explanation pages in docs, similar to what pip is starting to do, and what Rust and eslint ecosystems have. Such docs pages could include information on what a rule is looking for and suggestions on how to fix the corresponding violations.

Also, in the context of GHA, gitlint could autodetect it and make use of https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#grouping-log-lines to collapse blocks of output or/and https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary to additionally produce colorful markdown explanations. This could also be a feature of a GitHub Action idea the project board mentions but it doesn't have to be — it'd be also useful for when folks run gitlint as a standalone command.

jorisroovers commented 1 year ago

Thoughts: