You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore(ci): Add action and documentation for semantic commits (#26122)
## Description
We decided in the TSC meeting to use conventional commits to enforce
consistent commit messages in this project. This adds an advisory Github
Action to validate the PR title, and documentation for developers on the
new expectation. When this PR is merged, I will begin to socialize the
new requirements over Slack. After a time, we'll make the Github Action
mandatory.
## Motivation and Context
Consistent commit messages, alignment with Velox and other open source
projects
## Impact
Presto will begin to use conventional commits.
## Test Plan
N/A
## Contributor checklist
- [ ] Please make sure your submission complies with our [contributing
guide](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md),
in particular [code
style](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#code-style)
and [commit
standards](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#commit-standards).
- [ ] PR description addresses the issue accurately and concisely. If
the change is non-trivial, a GitHub Issue is referenced.
- [ ] Documented new properties (with its default value), SQL syntax,
functions, or other functionality.
- [ ] If release notes are required, they follow the [release notes
guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines).
- [ ] Adequate tests were added if applicable.
- [ ] CI passed.
## Release Notes
```
== NO RELEASE NOTE ==
```
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+99-49Lines changed: 99 additions & 49 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -310,42 +310,99 @@ We recommend you use IntelliJ as your IDE. The code style template for the proje
310
310
311
311
312
312
## CommitStandards
313
-
* ### CommitSize
314
-
*Recommended lines of code should be no more than +1000 lines, and should focus on one single major topic.\
315
-
If your commit is more than 1000 lines, consider breaking it down into multiple commits, each handling a specific small topic.
316
-
* ### CommitMessageStyle
317
-
***Separate subject from body with a blank line**
318
-
***Subject**
319
-
*Limit the subject line to 10 words or 50 characters
320
-
*If you cannot make the subject short, you may be committing too many changes at once
321
-
*Capitalize the subject line
322
-
*Do not end the subject line with a period
323
-
*Use the imperative mood in the subject line
324
-
***Body**
325
-
*Wrap the body at 72 characters
326
-
*Use the body to explain what and why versus how
327
-
*Use the indicative mood in the body\
328
-
For example, “If applied, this commit will ___________”
329
-
*Communicate only context (why) for the commit in the subject line
330
-
*Use the body forWhat and Why
331
-
*If your commit is complex or dense, share some of the How context
332
-
*Assume someone may need to revert your change during an emergency
333
-
***Content**
334
-
***Aimfor smaller commits for easier review and simpler code maintenance**
335
-
*All bug fixes and new features must have associated tests
336
-
* Commits should pass tests on their own, not be dependent on other commits
337
-
* The following is recommended:
338
-
* Describe why a change is being made.
339
-
* How does it address the issue?
340
-
* What effects does the patch have?
341
-
* Do not assume the reviewer understands what the original problem was.
342
-
* Do not assume the code is self-evident or self-documenting.
343
-
* Read the commit message to see if it hints at improved code structure.
344
-
* The first commit line is the most important.
345
-
* Describe any limitations of the current code.
346
-
* Do not include patch set-specific comments.
347
-
348
-
Details for each point and good commit message examples can be found on https://wiki.openstack.org/wiki/GitCommitMessages#Information_in_commit_messages
313
+
314
+
### ConventionalCommits
315
+
We follow the [ConventionalCommits](https://www.conventionalcommits.org/) specification for our commit messages and PR titles.
316
+
317
+
**PRTitleFormat:**
318
+
```
319
+
<type>[(scope)]:<description>
320
+
```
321
+
322
+
**Types:**Defined in [.github/workflows/conventional-commit-check.yml](.github/workflows/conventional-commit-check.yml):
323
+
***feat**:New feature or functionality
324
+
***fix**:Bug fix
325
+
***docs**:Documentation only changes
326
+
***refactor**:Code refactoring without changing functionality
327
+
***perf**:Performance improvements
328
+
***test**:Adding or modifying tests
329
+
***build**:Build system or dependency changes
330
+
***ci**:CI/CD configuration changes
331
+
***chore**:Maintenance tasks
332
+
***revert**:Reverting a previous commit
333
+
***misc**:Miscellaneous changes
334
+
335
+
Note:EachPR/commit should have a single primary type. If your changes span multiple categories, choose the most significant one or consider splitting into separate PRs.
336
+
337
+
**Scope (optional):**The area of code affected. Common scopes include:
338
+
339
+
* `parser` -SQL parser and grammar
340
+
* `analyzer` -Query analysis and validation
341
+
* `planner` -Query planning, optimization, and rules (including CBO)
Additionally, any connector name (e.g., `hive`, `iceberg`, `delta`, `kafka`) or plugin name (e.g., `session-property-manager`, `access-control`, `event-listener`) can be used as a scope.
360
+
361
+
**Description:**
362
+
*Must start with a capital letter
363
+
*Must not end with a period
364
+
*Use imperative mood ("Add feature" not "Added feature")
365
+
*Be concise but descriptive
366
+
367
+
**BreakingChanges:**
368
+
*Use `!` after the type/scope (e.g., `feat!:Remove deprecated API`)
369
+
*AND include `BREAKINGCHANGE:` in the commit description footer with a detailed explanation of the change
370
+
*Use to indicate any change that is not backward compatible as defined in the [BackwardCompatibilityGuidelines](presto-docs/src/main/sphinx/develop/release-process.rst#backward-compatibility-guidelines)
371
+
372
+
**Examples:**
373
+
* `feat(connector):Add support for dynamic catalog registration`
***AllPRs must be merged as a single commit** using GitHub's "Squash and merge" feature
380
+
* The PR title will become the commit message, so it must follow the conventional commit format
381
+
* Multiple commits within a PR are allowed during development for easier review, but they will be squashed on merge
382
+
* If you need to reference other commits or PRs, include them in the PR description or commit body, not as separate commits
383
+
384
+
### Commit Message Guidelines
385
+
* **PR Title/First Line**
386
+
* Must follow conventional commit format
387
+
* Limit to 50-72 characters when possible
388
+
* If you cannot make it concise, you may be changing too much at once
389
+
390
+
* **PR Description/Commit Body**
391
+
* Separate from title with a blank line
392
+
* Wrap at 72 characters
393
+
* Explain what and why, not how
394
+
* Include:
395
+
* Why the change is being made
396
+
* What issue it addresses
397
+
* Any side effects or limitations
398
+
* Breaking changes or migration notes if applicable
399
+
* Assume someone may need to revert your change during an emergency
400
+
401
+
* **Content Requirements**
402
+
* All bug fixes and new features must have associated tests
403
+
* Changes should be focused on a single topic
404
+
* Code should pass all tests independently
405
+
* Include documentation updates with code changes
349
406
350
407
* **Metadata**
351
408
* If the commit was to solve a Github issue, refer to it at the end of a commit message in a rfc822 header line format.\
@@ -460,20 +517,13 @@ We use the [Fork and Pull model](https://docs.github.com/en/pull-requests/collab
460
517
461
518
- Make sure your code follows the [code style guidelines](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#code-style), [development guidelines](https://github.com/prestodb/presto/wiki/Presto-Development-Guidelines#development) and [formatting guidelines](https://github.com/prestodb/presto/wiki/Presto-Development-Guidelines#formatting)
462
519
463
-
- Make sure you follow the [review and commit guidelines](https://github.com/prestodb/presto/wiki/Review-and-Commit-guidelines), in particular:
464
-
465
-
- Ensure that each commit is correct independently. Each commit should compile and pass tests.
466
-
- When possible, reduce the size of the commit for ease of review. Consider breaking a large PR into multiple commits, with each one addressing a particular issue. For example, if you are introducing a new feature that requires certain refactor, making a separate refactor commit before the real change helps the reviewer to isolate the changes.
467
-
- Do not send commits like addressing comments or fixing tests for previous commits in the same PR. Squash such commits to its corresponding base commit before the PR is rebased and merged.
468
-
- Make sure commit messages [follow these guidelines](https://chris.beams.io/posts/git-commit/). In particular (from the guidelines):
520
+
- Make sure you follow the [Commit Standards](#commit-standards) section above, which uses Conventional Commits format:
469
521
470
-
* Separate subject from body with a blank line
471
-
* Limit the subject line to 50 characters
472
-
* Capitalize the subject line
473
-
* Do not end the subject line with a period
474
-
* Use the imperative mood in the subject line
475
-
* Wrap the body at 72 characters
476
-
* Use the body to explain what and why vs. how
522
+
- PR titles must follow the conventional commit format (e.g., `feat: Add new feature`, `fix: Resolve bug`)
523
+
- All PRs will be squashed into a single commit on merge, so the PR title becomes the commit message
524
+
- While developing, you can have multiple commits in your PR for easier review
525
+
- Ensure each commit in your PR compiles and passes tests independently
526
+
- The PR description should explain what and why, not how. Keep lines wrapped at 72 characters for better readability. Include context about why the change is needed, what issue it addresses, any side effects or breaking changes, and enough detail that someone could understand whether to revert it during an emergency.
477
527
- Ensure all code is peer reviewed within your own organization or peers before submitting
478
528
- Implement and address existing feedback before requesting further review
479
529
- Make a good faith effort to locate example or referential code before requesting someone else direct you towards it
0 commit comments