|
| 1 | +<!-- PROJECT SHIELDS --> |
| 2 | + |
| 3 | +[![Contributors][contributors-shield]][contributors-url] |
| 4 | +[![Forks][forks-shield]][forks-url] |
| 5 | +[![Stargazers][stars-shield]][stars-url] |
| 6 | +[![Issues][issues-shield]][issues-url] |
| 7 | +[![MIT License][license-shield]][license-url] |
| 8 | + |
| 9 | +<!-- PROJECT LOGO --> |
| 10 | +<br /> |
| 11 | +<p align="center"> |
| 12 | + <a href="https://github.com/lumapps/commit-msg-validator"> |
| 13 | + <img src="images/stamp.png" alt="Logo" width="80" height="80"> |
| 14 | + </a> |
| 15 | + |
| 16 | + <h3 align="center">Commit message validator</h3> |
| 17 | + |
| 18 | + <p align="center"> |
| 19 | + Enforce angular commit message convention with minimal dependancy only git and bash. |
| 20 | + <br /> |
| 21 | + <a href="https://github.com/lumapps/commit-msg-validator"><strong>Explore the docs »</strong></a> |
| 22 | + <br /> |
| 23 | + <br /> |
| 24 | + <a href="https://github.com/lumapps/commit-msg-validator/issues">Report Bug</a> |
| 25 | + · |
| 26 | + <a href="https://github.com/lumapps/commit-msg-validator/issues">Request Feature</a> |
| 27 | + </p> |
| 28 | +</p> |
| 29 | + |
| 30 | +<!-- TABLE OF CONTENTS --> |
| 31 | + |
| 32 | +## Table of Contents |
| 33 | + |
| 34 | +- [About the Project](#about-the-project) |
| 35 | + - [Built With](#built-with) |
| 36 | +- [Getting Started](#getting-started) |
| 37 | + - [Prerequisites](#prerequisites) |
| 38 | + - [Installation](#installation) |
| 39 | +- [Usage](#usage) |
| 40 | +- [Roadmap](#roadmap) |
| 41 | +- [Contributing](#contributing) |
| 42 | +- [License](#license) |
| 43 | +- [Contact](#contact) |
| 44 | +- [Acknowledgements](#acknowledgements) |
| 45 | + |
| 46 | +<!-- ABOUT THE PROJECT --> |
| 47 | + |
| 48 | +## About The Project |
| 49 | + |
| 50 | +The provided script enforce Angular commit message convention, with an opinionated reduction of allowed types. |
| 51 | +Moreover, it enforces reference to a project management tools named JIRA. |
| 52 | + |
| 53 | +### Commit Message Format |
| 54 | + |
| 55 | +Each commit message consists of a **header**, a **body** and a **footer**. |
| 56 | +The header has a special format that includes a **type**, a **scope** and a **subject**: |
| 57 | + |
| 58 | +``` |
| 59 | +<type>(<scope>): <subject> |
| 60 | +<BLANK LINE> |
| 61 | +<body> |
| 62 | +<BLANK LINE> |
| 63 | +<footer> |
| 64 | +``` |
| 65 | + |
| 66 | +- The first line of the commit message (the "Subject") cannot be longer than 70 characters. |
| 67 | +- Any other line of the commit message cannot be longer 100 characters! |
| 68 | + |
| 69 | +This allows the message to be easier to read on github as well as in various git tools. |
| 70 | + |
| 71 | +### Type |
| 72 | + |
| 73 | +Must be one of the following: |
| 74 | + |
| 75 | +- **feat**: A new feature |
| 76 | +- **fix**: A bug fix |
| 77 | +- **docs**: Documentation only changes |
| 78 | +- **lint**: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc) |
| 79 | +- **refactor**: A code change that neither fixes a bug or adds a feature |
| 80 | +- **test**: Adding missing tests or correcting existing tests |
| 81 | +- **chore**: Changes to the build process or auxiliary tools and libraries such as distribution generation |
| 82 | +- **revert**: Reverts a previous commit |
| 83 | + |
| 84 | +### Scope |
| 85 | + |
| 86 | +The scope could be anything specifying place of the commit change. For example `notification', 'dropdown', etc. |
| 87 | +The scope must be written in [kebab-case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). |
| 88 | + |
| 89 | +If the commit reverts a previous commit, it should contains the reverted commit SHA1. |
| 90 | + |
| 91 | +### Subject |
| 92 | + |
| 93 | +A brief but meaningfull description of the change. |
| 94 | +Here are some recommandation for writing your subject: |
| 95 | + |
| 96 | +- use the imperative, present tense: "change" not "changed" nor "changes" |
| 97 | +- don't capitalize first letter |
| 98 | +- no "." (dot) at the end |
| 99 | + |
| 100 | +If the commit reverts a previous commit, it should contains the title of the reverted commit. |
| 101 | + |
| 102 | +### Body |
| 103 | + |
| 104 | +The body should include the motivation for the change and contrast this with previous behavior. |
| 105 | +If the commit reverts a previous commit, explain why you reverted it. |
| 106 | + |
| 107 | +### Footer |
| 108 | + |
| 109 | +The footer should contain any information about **Breaking Changes** and is also the place to |
| 110 | +reference JIRA ticket related to this commit. |
| 111 | +The breaking changes must be at the end of the commit with only "BROKEN:" before the list of breaking changes. |
| 112 | +They must be each on a new line. |
| 113 | + |
| 114 | +### Commit Example |
| 115 | + |
| 116 | +``` |
| 117 | +feat(toto-service): provide toto for all |
| 118 | +
|
| 119 | +Before we had to do another thing. There was this and this problem. |
| 120 | +Now, by using "toto", it's simpler and the problems are managed. |
| 121 | +
|
| 122 | +LUM-3462 |
| 123 | +BROKEN: |
| 124 | +first thing broken |
| 125 | +second thing broken |
| 126 | +``` |
| 127 | + |
| 128 | +### Built With |
| 129 | + |
| 130 | +- [bash](https://www.gnu.org/software/bash/) |
| 131 | +- [bats](https://github.com/sstephenson/bats) |
| 132 | + |
| 133 | +<!-- GETTING STARTED --> |
| 134 | + |
| 135 | +## Getting Started |
| 136 | + |
| 137 | +To get a local copy up and running follow these simple steps. |
| 138 | + |
| 139 | +### Prerequisites |
| 140 | + |
| 141 | +1. Install bash |
| 142 | + |
| 143 | +```sh |
| 144 | +sudo apt install bash |
| 145 | +``` |
| 146 | + |
| 147 | +2. Install bats for development testing |
| 148 | + |
| 149 | +```sh |
| 150 | +sudo apt install bats |
| 151 | +``` |
| 152 | + |
| 153 | +### Installation |
| 154 | + |
| 155 | +1. Clone the commit-msg-validator |
| 156 | + |
| 157 | +```sh |
| 158 | +git clone https://github.com/lumapps/commit-msg-validator.git |
| 159 | +``` |
| 160 | + |
| 161 | +That's all, your ready to go ! |
| 162 | + |
| 163 | +<!-- USAGE EXAMPLES --> |
| 164 | + |
| 165 | +## Usage |
| 166 | + |
| 167 | +Check the commit message referenced by <commit1>: |
| 168 | + |
| 169 | +```sh |
| 170 | +./check.sh <commit1> |
| 171 | +``` |
| 172 | + |
| 173 | +Check all the commits between 2 references: |
| 174 | + |
| 175 | +```sh |
| 176 | +./check.sh <commit1>..<commit2> |
| 177 | +``` |
| 178 | + |
| 179 | +Behind the hood, the script use `git log` to list all the commit thus any syntax allowed by git will be working. |
| 180 | + |
| 181 | +<!-- ROADMAP --> |
| 182 | + |
| 183 | +## Roadmap |
| 184 | + |
| 185 | +See the [open issues](https://github.com/lumapps/commit-msg-validator/issues) for a list of proposed features (and known issues). |
| 186 | + |
| 187 | +- [ ] list all the commit a run on each |
| 188 | +- [ ] enforce the overall commit message structure |
| 189 | +- [ ] enforce the overall commit header structure |
| 190 | +- [ ] enforce the overall commit header lenght |
| 191 | +- [ ] enforce the commit type |
| 192 | +- [ ] enforce the commit scope |
| 193 | +- [ ] enforce the commit subject |
| 194 | +- [ ] enforce the commit body length |
| 195 | +- [ ] enforce the JIRA reference |
| 196 | +- [ ] enforce the BROKEN part |
| 197 | +- [ ] allow automated revert commit |
| 198 | +- [ ] allow fixup! and squash! commit with an option |
| 199 | + |
| 200 | +<!-- CONTRIBUTING --> |
| 201 | + |
| 202 | +## Contributing |
| 203 | + |
| 204 | +Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**. |
| 205 | + |
| 206 | +1. Fork the Project |
| 207 | +2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`) |
| 208 | +3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`) |
| 209 | +4. Push to the Branch (`git push origin feature/AmazingFeature`) |
| 210 | +5. Open a Pull Request |
| 211 | + |
| 212 | +<!-- LICENSE --> |
| 213 | + |
| 214 | +## License |
| 215 | + |
| 216 | +Distributed under the MIT License. See `LICENSE` for more information. |
| 217 | + |
| 218 | +<!-- CONTACT --> |
| 219 | + |
| 220 | +## Contact |
| 221 | + |
| 222 | +Project Link: [https://github.com/lumapps/commit-msg-validator](https://github.com/lumapps/commit-msg-validator) |
| 223 | + |
| 224 | +<!-- ACKNOWLEDGEMENTS --> |
| 225 | + |
| 226 | +## Acknowledgements |
| 227 | + |
| 228 | +Icons made by <a href="https://www.flaticon.com/authors/freepik" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon"> www.flaticon.com</a> |
| 229 | + |
| 230 | +<!-- MARKDOWN LINKS & IMAGES --> |
| 231 | +<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links --> |
| 232 | + |
| 233 | +[contributors-shield]: https://img.shields.io/github/contributors/lumapps/commit-message-validator.svg?style=flat-square |
| 234 | +[contributors-url]: https://github.com/lumapps/commit-message-validator/graphs/contributors |
| 235 | +[forks-shield]: https://img.shields.io/github/forks/lumapps/commit-message-validator.svg?style=flat-square |
| 236 | +[forks-url]: https://github.com/lumapps/commit-message-validator/network/members |
| 237 | +[stars-shield]: https://img.shields.io/github/stars/lumapps/commit-message-validator.svg?style=flat-square |
| 238 | +[stars-url]: https://github.com/lumapps/commit-message-validator/stargazers |
| 239 | +[issues-shield]: https://img.shields.io/github/issues/lumapps/commit-message-validator.svg?style=flat-square |
| 240 | +[issues-url]: https://github.com/lumapps/commit-message-validator/issues |
| 241 | +[license-shield]: https://img.shields.io/github/license/lumapps/commit-message-validator.svg?style=flat-square |
| 242 | +[license-url]: https://github.com/lumapps/commit-message-validator/blob/master/LICENSE |
0 commit comments