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

Define commit type, and enhance the CHANGELOG format #61

@Hywan

Description

@Hywan

Hello fellow @hoaproject/hoackers and users!

Introduction

Actual commit messages in Hoa are really great. They are detailed, meaningful, reviewed, and comprehensive. The commit title is always: scope: title. However, when generating the CHANGELOG.md file, this is hard to see what is a bug fix or a new feature.

Goal

Import the concept of “commit type” from the Angular commit message guideline.

To quote it:

We have very precise rules over how our git commit messages can be formatted. This leads to more
readable messages
that are easy to follow when looking through the project history. But also,
we use the git commit messages to generate the AngularJS change log.

The commit message formatting can be added using a typical git workflow or through the use of a CLI
wizard (Commitizen). To use the wizard, run yarn run commit
in your terminal after staging your changes in git.

Commit Message Format

Each commit message consists of a header, a body and a footer. The header has a special
format that includes a type, a scope and a subject:

<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>

The header is mandatory and the scope of the header is optional.

Any line of the commit message cannot be longer 100 characters! This allows the message to be easier
to read on GitHub as well as in various git tools.

Revert

If the commit reverts a previous commit, it should begin with revert: , followed by the header of the reverted commit.
In the body it should say: This reverts commit <hash>., where the hash is the SHA of the commit being reverted.

Type

Must be one of the following:

  • feat: A new feature
  • fix: A bug fix
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing
    semi-colons, etc)
  • refactor: A code change that neither fixes a bug nor adds a feature
  • perf: A code change that improves performance
  • test: Adding missing or correcting existing tests
  • chore: Changes to the build process or auxiliary tools and libraries such as documentation
    generation

Scope

The scope could be anything specifying place of the commit change. For example $location,
$browser, $compile, $rootScope, ngHref, ngClick, ngView, etc...

You can use * when the change affects more than a single scope.

Subject

The subject contains succinct description of the change:

  • use the imperative, present tense: "change" not "changed" nor "changes"
  • don't capitalize first letter
  • no dot (.) at the end

Body

Just as in the subject, use the imperative, present tense: "change" not "changed" nor "changes".
The body should include the motivation for the change and contrast this with previous behavior.

Footer

The footer should contain any information about Breaking Changes and is also the place to
[reference GitHub issues that this commit closes][closing-issues].

Breaking Changes should start with the word BREAKING CHANGE: with a space or two newlines.
The rest of the commit message is then used for this.

A detailed explanation can be found in this [document][commit-message-format].

Not everything is useful. We are mostly concerned about the “commit type”.

Differences with the current format

The “commit type” is the only main difference, and this is what I would like to “import” in our format. The goal is to generate a CHANGELOG as suggested by http://keepachangelog.com/en/0.3.0/, so with the “Added”, “Bug fixes”, “Removed“ Sections, and the date of the release (already given by our Rust Release snapshot format, but anyway, we should give it a try).

Commit types

I would like to introduce the following commit types:

  • feat for a new feature,
  • fix for a bug fix,
  • test for a test modification,
  • doc for a documentation modification,
  • chore to replace the “Quality” type,
  • undef for anything else, must not be used, so should we introduce it?

Example

In the Angular commit message guideline, they propose this syntax: type(scope): title. In Hoa, we use scope: title. The colon is a separator. However, the commit type will reduce the size of the title (remember that we have only 50 characters for the whole line!). With the type(scope) we no longer need a separator, so I propose type(scope) title, like

  • feat(permission) Search backward bla bla.,
  • fix(user) `getName` is incorrectly computing its value.,

Will produce:

2.17.16.02

New features

Permission

  • Search backward bla bla (Ivan Enderlin, date, bla).

Bug fixes

User

  • getName is incorrectly computing its value (Ivan Enderlin, date, bla).

Thoughts?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions