|
| 1 | +# Contributing Guidelines |
| 2 | + |
| 3 | +## 📘 Conventional Commit Standard |
| 4 | + |
| 5 | +All MapsMessaging repositories follow the [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/) standard. |
| 6 | + |
| 7 | +Every commit message must follow this pattern: |
| 8 | + |
| 9 | +``` |
| 10 | +<type>(<scope>): <subject> |
| 11 | +
|
| 12 | +[optional body] |
| 13 | +
|
| 14 | +[JIRA: MAPS-### | NO-ISSUE | BREAKING CHANGE: ...] |
| 15 | +``` |
| 16 | + |
| 17 | +### Example |
| 18 | +``` |
| 19 | +feat(server): add MQTT 5 bridge support |
| 20 | +
|
| 21 | +Implements protocol translation between MQTT 3.1.1 and 5.0. |
| 22 | +
|
| 23 | +JIRA: MAPS-123 |
| 24 | +``` |
| 25 | + |
| 26 | +--- |
| 27 | + |
| 28 | +## 🔹 Allowed Types |
| 29 | +| Type | Purpose | |
| 30 | +|------|----------| |
| 31 | +| **feat** | A new feature | |
| 32 | +| **fix** | A bug fix | |
| 33 | +| **refactor** | Code change that neither fixes a bug nor adds a feature | |
| 34 | +| **perf** | Performance improvements | |
| 35 | +| **test** | Adding or modifying tests | |
| 36 | +| **build** | Build system or dependency changes | |
| 37 | +| **ci** | Continuous Integration or pipeline updates (e.g., Buildkite) | |
| 38 | +| **docs** | Documentation only | |
| 39 | +| **style** | Code style changes (formatting, etc.) | |
| 40 | +| **chore** | Maintenance or non-functional changes | |
| 41 | +| **revert** | Reverts a previous commit | |
| 42 | + |
| 43 | +--- |
| 44 | + |
| 45 | +## 🔸 Scopes |
| 46 | +Examples include: |
| 47 | +`server`, `ml`, `scheduler`, `config`, `schema`, `protocol`, `mqtt`, `amqp`, `nats`, `coap`, `lora`, `rest`, `buildkite`, `docs`. |
| 48 | + |
| 49 | +--- |
| 50 | + |
| 51 | +## 🧱 Footer Fields |
| 52 | +| Footer | Description | |
| 53 | +|---------|--------------| |
| 54 | +| **JIRA:** | Reference to a Jira issue, e.g. `MAPS-123` | |
| 55 | +| **NO-ISSUE:** | Used when no Jira ticket applies | |
| 56 | +| **BREAKING CHANGE:** | Describes an API or behavior change | |
| 57 | +| **DEPRECATED:** | Marks functionality as deprecated | |
| 58 | +| **SECURITY:** | Notes security-related commits | |
| 59 | + |
| 60 | +--- |
| 61 | + |
| 62 | +## ✍️ Header Rules |
| 63 | +- Limit header line to **100 characters**. |
| 64 | +- Use **imperative mood** (e.g., “add”, not “added”). |
| 65 | +- Don’t end the subject line with a period. |
| 66 | +- Use lowercase for type and scope. |
| 67 | +- Example: |
| 68 | + ``` |
| 69 | + fix(protocol): handle empty MQTT 5 property lists |
| 70 | + ``` |
| 71 | + |
| 72 | +--- |
| 73 | + |
| 74 | +## ⚙️ IntelliJ Setup |
| 75 | + |
| 76 | +1. Install **Conventional Commit** plugin. |
| 77 | + - Go to **Settings → Plugins → Marketplace → "Conventional Commit"**. |
| 78 | +2. Enable these options under **Settings → Tools → Conventional Commit**: |
| 79 | + - ✅ Validate commit messages |
| 80 | + - ✅ Enable template completion |
| 81 | + - ✅ Expand template on type completion |
| 82 | +3. Optional: |
| 83 | + - **Settings → Version Control → Commit → Commit Message Template** |
| 84 | + Add this: |
| 85 | + ``` |
| 86 | + type(scope): short summary |
| 87 | + |
| 88 | + [optional body] |
| 89 | + |
| 90 | + [JIRA: MAPS-### | NO-ISSUE] |
| 91 | + ``` |
| 92 | +
|
| 93 | +--- |
| 94 | +
|
| 95 | +## 🧰 Command Line Setup |
| 96 | +
|
| 97 | +For CLI contributors, install `commitlint` and use it as a local Git hook. |
| 98 | +
|
| 99 | +```bash |
| 100 | +npm install --save-dev @commitlint/{config-conventional,cli} |
| 101 | +echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js |
| 102 | +echo '#!/bin/sh\nnpx commitlint --edit "$1"' > .git/hooks/commit-msg |
| 103 | +chmod +x .git/hooks/commit-msg |
| 104 | +``` |
| 105 | + |
| 106 | +To enforce Jira ID or `NO-ISSUE`, you can extend the config: |
| 107 | +```js |
| 108 | +rules: { |
| 109 | + 'footer-leading-blank': [2, 'always'], |
| 110 | + 'footer-empty': [2, 'never'], |
| 111 | + 'references-empty': [2, 'never'], |
| 112 | + 'footer-max-line-length': [2, 'always', 120] |
| 113 | +} |
| 114 | +``` |
| 115 | + |
| 116 | +--- |
| 117 | + |
| 118 | +## 🔐 Buildkite Enforcement |
| 119 | + |
| 120 | +Buildkite CI checks commit messages on each branch before merging. |
| 121 | + |
| 122 | +Example snippet: |
| 123 | +```yaml |
| 124 | +steps: |
| 125 | + - label: ":white_check_mark: Validate Commit Messages" |
| 126 | + command: npx commitlint --from origin/main --to HEAD |
| 127 | +``` |
| 128 | +
|
| 129 | +--- |
| 130 | +
|
| 131 | +## 🧭 Team Standard (One-Pager to Share) |
| 132 | +
|
| 133 | +**Format:** |
| 134 | +`type(scope): subject` + optional body + footer(s) |
| 135 | + |
| 136 | +**Jira:** |
| 137 | +Every commit must include a Jira ID (`MAPS-###`) or `NO-ISSUE`. |
| 138 | + |
| 139 | +**Breaking changes:** |
| 140 | +Use `!` after type/scope or footer `BREAKING CHANGE:`. |
| 141 | + |
| 142 | +**Header:** |
| 143 | +≤100 characters, lowercase type/scope, imperative mood. |
| 144 | + |
| 145 | +**IDE setup:** |
| 146 | +Install the *Conventional Commit* plugin, enable validation and template completion. |
| 147 | + |
| 148 | +**CLI setup:** |
| 149 | +Use `commitlint` with a Git hook to block invalid commits. |
| 150 | + |
| 151 | +**Branch naming:** |
| 152 | +`MAPS-###-short-desc` |
| 153 | + |
| 154 | +**Pull Requests:** |
| 155 | +Title must mirror the commit header. |
| 156 | + |
| 157 | +**CI:** |
| 158 | +Buildkite runs commit message validation before merging. |
| 159 | + |
| 160 | +--- |
| 161 | + |
| 162 | +## 🏁 Summary |
| 163 | + |
| 164 | +By following this standard: |
| 165 | +- All commits stay consistent and parseable. |
| 166 | +- Release notes can be generated automatically. |
| 167 | +- Jira integration links issues directly from commit logs. |
| 168 | +- Developers across IDEs and pipelines share one format. |
| 169 | + |
| 170 | +``` |
| 171 | +feat(config): add support for external schema mapping |
| 172 | +
|
| 173 | +Adds ability to import Avro/Protobuf/JSON schema files from external repos. |
| 174 | +
|
| 175 | +JIRA: MAPS-321 |
| 176 | +``` |
0 commit comments