Overcomplication in Programming: When Complexity Becomes a Problem
Welcome to my technology blog
Greetings!
Labels: iot, java, personal-experience, smarthome, technology-history, web-development
Each commit consists of three different elements, as below:
Both the Body and the Footer are optional, and as far as I can see, they are generally not used much.
The header must maintain a predefined pattern, containing a type, a scope (only when applicable), and a title, and for faster and simpler reading and understanding, it must not exceed 50 characters.
{type}({scope}): {title}
Examples:
fix(login redirect): prevent redirect to external url
feat(middleware): refuse connections from other hosts on production
refactor(markdown viewer): prepared for future viewer package change
fix: serve HomeOffline and remove SWR fetch
fix(query): performance with large offset
These examples were selected from the list of commits in the official TabNews repository.
Did you notice how simple and objective they are? Any developer who has never even seen the repository before in their life, by reading these commits can already have a minimal idea of what the subject is about, and that is precisely the objective I want to achieve with this post!
Here is the real inspiration responsible for my decision to write this post.
The type of the commit says practically everything about it, being able to inform whether this commit is related to a correction in a line of code, the addition of a new feature, improvements, among others.
The type must be one of those listed below:
In addition to these, we have of course the famous merge, which is in a different structure pattern but is generated by GitHub itself and we understand its importance in the same way!
* Important observation: Today I do not have full knowledge of what CI (Continuous Delivery) and CD (Continuous Deployment) are about. So if anyone already has one or wants to make a post about it, let me know the post's URL in the comments and I'll be proud to learn about it and also attach it to the two items marked above!
If the commit reverts to a previous commit, it must begin with
revert:
, followed by the header of the reverted commit.
If the body is used, it must inform: This reverts the commit {commit hash}
The scope, in short, is what exactly you are working on in that commit, for example middlware, a login screen, a specific resource, among others.
The title should contain a summarized and succinct description of the change, and the ideal is to follow the rules listed below:
code
referring to the platform being used, in the case of GitHub it is the three backticks
(```)Below is a complete example:
fix(controller): use cf-connecting-ip
header to get client ip first
A longer description for your commit can be provided right after the title, in a separate field, providing
additional contextual information about your commit.
Break lines at least every 72 characters for better reading.
Use this description to explain "what" and "why" this change was made, rather than "how."
The footer may be provided below a blank line after the body.
You can use it to reference a ticket in Jira, a task in Asana or Perfex and other helpdesks, or even an issue on
GitHub itself, as in the example below:
fixes issue #12
These are some possibilities and advantages that we gain when committing in an organized and succinct way: