Skip to content

Commit 2ce7f11

Browse files
feat(ARCO-281): check commit message format and PR title (#632)
1 parent c6f2d9a commit 2ce7f11

40 files changed

+145
-115
lines changed

.github/workflows/pr-title-check.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Enforce Commit Message Format
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, edited, synchronize]
6+
7+
jobs:
8+
check_commit_message:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check commit message format
12+
env:
13+
PR_TITLE: ${{ github.event.pull_request.title }}
14+
run: |
15+
if [[ ! "$PR_TITLE" =~ ^(feat|chore|deps|sec|fix|refactor|docs|build|ci|test)(\([A-Z]{3,6}-[0-9]{3,6}\))?:\ .+$ ]]; then
16+
echo "PR title which is used as merge commit does not follow Conventional Commits format."
17+
echo "Please use format: <type>(<scope>): <description> as described in CONTRIBUTING.md"
18+
exit 1
19+
fi

.goreleaser.yaml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
# ---------------------------
55
version: 2
66

7-
before:
8-
hooks:
9-
- make test
10-
- make run_e2e_tests
117
snapshot:
128
version_template: "{{ .Tag }}"
139

@@ -56,18 +52,18 @@ release:
5652
name_template: "{{.Tag}}"
5753
header: |
5854
# 🚀 Release of {{ .ProjectName }} - {{ .Tag }}
59-
55+
6056
**Released on**: {{ .Date }}
61-
57+
6258
## What's New
6359
Here are the latest updates, bug fixes, and features in this release:
6460
6561
footer: |
66-
## Full Changelog:
62+
## Full Changelog:
6763
You can find full changelog here: https://github.com/bitcoin-sv/arc/compare/{{ .PreviousTag }}...{{ .Tag }}
68-
64+
6965
## Docker Image:
7066
You can find docker container at [Docker Hub](https://hub.docker.com/r/bsvb/arc)
7167
or get it by running `docker pull bsvb/arc:{{.Version}}`
72-
68+
7369
### Thank you for using {{ .ProjectName }}! 🎉

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,10 @@ repos:
66
- id: trailing-whitespace
77
- id: end-of-file-fixer
88
- id: check-added-large-files
9+
- repo: https://github.com/dtaivpp/commit-msg-regex-hook
10+
rev: v0.2.2
11+
hooks:
12+
- id: commit-msg-regex-hook
13+
args: [ "--pattern='^(feat|chore|deps|sec|fix|refactor|docs|build|ci|test)(\\([A-Z]{3,6}-[0-9]{3,6}\\))?: .+$'",
14+
"--failure_message='Commits should match the pattern: <type>(CODE-XXX)?: Message, where <type> is one of feat, sec, fix, refactor, docs, build, ci, and (CODE-XXX) is optional.'" ]
15+
stages: [ commit-msg ]

CODE_OF_CONDUCT.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,27 @@
33
## Introduction
44
This Code of Conduct outlines the expectations for all contributors to our open-source project, as well as the responsibilities of the maintainers in ensuring a positive and productive environment. Our goal is to create excellent software. To achieve that, we foster a welcoming atmosphere for developers to collaborate and contribute to the project's success.
55

6-
## Expectations for Contributors
7-
All contributors are expected to:
8-
a. Treat others with respect and dignity.
9-
b. Be considerate of differing viewpoints.
10-
c. Collaborate constructively with others.
11-
d. Refrain from demeaning or harassing others.
6+
## Expectations for Contributors
7+
All contributors are expected to:
8+
a. Treat others with respect and dignity.
9+
b. Be considerate of differing viewpoints.
10+
c. Collaborate constructively with others.
11+
d. Refrain from demeaning or harassing others.
1212

1313
## Reporting Violations
14-
If you witness or experience any behavior that violates this Code of Conduct, please report it to the project maintainers. Reports can be made anonymously or by contacting a specific maintainer.
14+
If you witness or experience any behavior that violates this Code of Conduct, please report it to the project maintainers. Reports can be made anonymously or by contacting a specific maintainer.
1515

1616
## Enforcement
17-
The project maintainers are responsible for enforcing this Code of Conduct. They will investigate any reported violations and take appropriate action, which may include:
18-
a. Issuing a warning.
19-
b. Requiring an apology or remediation.
20-
c. Temporarily suspending or permanently banning a contributor from the project.
17+
The project maintainers are responsible for enforcing this Code of Conduct. They will investigate any reported violations and take appropriate action, which may include:
18+
a. Issuing a warning.
19+
b. Requiring an apology or remediation.
20+
c. Temporarily suspending or permanently banning a contributor from the project.
2121

2222
## Maintainer Responsibilities
23-
Maintainers are responsible for:
24-
a. Upholding the Code of Conduct and setting a positive example for the community.
25-
b. Investigating and addressing reported violations in a fair and timely manner.
26-
c. Making decisions about merging code based on its merit alone, without bias or favoritism.
23+
Maintainers are responsible for:
24+
a. Upholding the Code of Conduct and setting a positive example for the community.
25+
b. Investigating and addressing reported violations in a fair and timely manner.
26+
c. Making decisions about merging code based on its merit alone, without bias or favoritism.
2727

2828
## Changes to the Code of Conduct
2929
This Code of Conduct is subject to change as the project evolves. Any updates will be communicated to all contributors and posted in the project repository.

CONTRIBUTING.md

Lines changed: 49 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,64 @@ Thank you for considering contributing in the BSV Blockchain ecosystem! This doc
1616
## General Guidelines
1717

1818
- **Issues First**: If you're planning to add a new feature or change existing behavior, please open an issue first. This allows us to avoid multiple people working on similar features and provides a place for discussion.
19-
19+
2020
- **Stay Updated**: Always pull the latest changes from the main branch before creating a new branch or starting on new code.
21-
21+
2222
- **Simplicity Over Complexity**: Your solution should be as simple as possible, given the requirements.
2323

2424
## Code of Conduct
2525

2626
### Posting Issues and Comments
2727

2828
- **Be Respectful**: Everyone is here to help and grow. Avoid any language that might be considered rude or offensive.
29-
29+
3030
- **Be Clear and Concise**: Always be clear about what you're suggesting or reporting. If an issue is related to a particular piece of code or a specific error message, include that in your comment.
31-
31+
3232
- **Stay On Topic**: Keep the conversation relevant to the issue at hand. If you have a new idea or unrelated question, please open a new issue.
3333

3434
### Coding and PRs
3535

3636
- **Stay Professional**: Avoid including "fun" code, comments, or irrelevant file changes in your commits and pull requests.
3737

38+
### Commit Messages
39+
40+
- **Use Conventional Commits**: To maintain a clean, organized, and automated commit history, we follow the Conventional Commits format.
41+
This format allows for clear categorization of commits, enabling automated changelogs and improved collaboration.
42+
43+
44+
Each commit message should follow this structure:
45+
46+
```
47+
<type>(<scope>): <description>
48+
```
49+
50+
51+
Where:
52+
53+
`<type>`: Specifies the purpose of the change. Options implemented when sorting changelog:
54+
```
55+
deps -> dependency update
56+
feat -> new feature
57+
chore -> updating grunt tasks, no production code change
58+
test -> changes associated with the tests
59+
sec -> security update
60+
fix -> bug fixes
61+
refactor -> refactor commits
62+
docs -> documentation
63+
build/ci -> build process update
64+
```
65+
66+
`<scope>`: **(Optional)** Task or issue identifier, Example: **ARCO-001**\
67+
`<description>`: A brief description of the change.
68+
69+
Example of a commit:
70+
71+
> `feat(ARCO-001): add new feature to the project`
72+
3873
## Getting Started
3974

4075
1. **Fork the Repository**: Click on the "Fork" button at the top-right corner of this repository.
41-
76+
4277
2. **Clone the Forked Repository**: `git clone https://github.com/YOUR_USERNAME/PROJECT.git`
4378

4479
3. **Navigate to the Directory**: `cd PROJECT`
@@ -48,33 +83,33 @@ Thank you for considering contributing in the BSV Blockchain ecosystem! This doc
4883
## Pull Request Process
4984

5085
1. **Create a Branch**: For every new feature or bugfix, create a new branch.
51-
86+
5287
2. **Commit Your Changes**: Make your changes and commit them. Commit messages should be clear and concise to explain what was done.
53-
88+
5489
3. **Run Tests**: Ensure all tests pass.
55-
90+
5691
4. **Documentation**: All code must be fully annotated with comments. Update the documentation by running `make docs` before creating a pull request.
57-
92+
5893
5. **Push to Your Fork**: `git push origin your-new-branch`.
59-
94+
6095
6. **Open a Pull Request**: Go to your fork on GitHub and click "New Pull Request". Fill out the PR template, explaining your changes.
61-
96+
6297
7. **Code Review**: At least two maintainers must review and approve the PR before it's merged. Address any feedback or changes requested.
63-
98+
6499
8. **Merge**: Once approved, the PR will be merged into the main branch.
65100

66101
## Coding Conventions
67102

68103
- **Code Style**: We use `Effective Go` guideline for our coding style. Run `make lint` to ensure your code adheres to this style.
69104

70105
- **Testing**: Always include tests for new code or changes. We aim for industry-standard levels of test coverage.
71-
106+
72107
- **Documentation**: All exported functions, structures and modules should be documented. Use comments to describe the purpose, parameters, and return values.
73108

74109
## Documentation and Testing
75110

76111
- **Documentation**: Update the documentation whenever you add or modify the code. Run `make docs` to generate the latest docs.
77-
112+
78113
- **Testing**: Write comprehensive tests, ensuring edge cases are covered. All PRs should maintain or improve the current test coverage.
79114

80115
## Contact & Support

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ USER nobody
4242

4343
EXPOSE 9090
4444

45-
CMD ["/service/arc"]
45+
CMD ["/service/arc"]

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ install:
118118
# arch -arm64 brew install golangci-lint
119119
brew install pre-commit
120120
pre-commit install
121+
pre-commit install --hook-type commit-msg
121122

122123
.PHONY: install_gen
123124
install_gen:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ Metamorph publishes new transactions to the message queue and BlockTx subscribes
254254

255255
### Callbacker
256256

257-
Callbacker is a microservice that sends callbacks to a specified URL.
257+
Callbacker is a microservice that sends callbacks to a specified URL.
258258

259259
Callbacker is designed to be horizontally scalable, with each instance operating independently. As a result, they do not communicate with each other and remain unaware of each other's existence.
260260

config/test_files/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ broadcasting: # settings for connection to nodes
2424
p2p: 18334
2525
- host: localhost
2626
port:
27-
p2p: 18335
27+
p2p: 18335

doc/BIP-239.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
BIP: 239
33
Layer: Applications
44
Title: Transaction Extended Format (TEF)
5-
Author:
5+
Author:
66
Simon Ordish (@ordishs)
77
Siggi Oskarsson (@icellan)
8-
Comments-Summary: No comments yet.
9-
Comments-URI: -
10-
Status: Proposal
11-
Type: Standards Track
8+
Comments-Summary: No comments yet.
9+
Comments-URI: -
10+
Status: Proposal
11+
Type: Standards Track
1212
Created: 2022-11-09
1313
</pre>
1414

@@ -64,7 +64,7 @@ The input structure is the only additional thing that is changed in the Extended
6464
| Previous Transaction hash | TXID of the transaction the output was created in | 32 bytes |
6565
| Previous Txout-index | Index of the output (Non negative integer) | 4 bytes |
6666
| Txin-script length | Non negative integer VI = VarInt | 1 - 9 bytes |
67-
| Txin-script / scriptSig | Script | <in-script length>-many bytes |
67+
| Txin-script / scriptSig | Script | <in-script length>-many bytes |
6868
| Sequence_no | Used to iterate inputs inside a payment channel. Input is final when nSequence = 0xFFFFFFFF | 4 bytes |
6969

7070
In the Extended Format, we extend the input structure to include the previous locking script and satoshi outputs:
@@ -74,11 +74,11 @@ In the Extended Format, we extend the input structure to include the previous lo
7474
| Previous Transaction hash | TXID of the transaction the output was created in | 32 bytes |
7575
| Previous Txout-index | Index of the output (Non negative integer) | 4 bytes |
7676
| Txin-script length | Non negative integer VI = VarInt | 1 - 9 bytes |
77-
| Txin-script / scriptSig | Script | <in-script length>-many bytes |
77+
| Txin-script / scriptSig | Script | <in-script length>-many bytes |
7878
| Sequence_no | Used to iterate inputs inside a payment channel. Input is final when nSequence = 0xFFFFFFFF | 4 bytes |
7979
| **Previous TX satoshi output** | **Output value in satoshis of previous input** | **8 bytes** |
8080
| **Previous TX script length** | **Non negative integer VI = VarInt** | **1 - 9 bytes** |
81-
| **Previous TX locking script** | **Script** | **\<script length>-many bytes** |
81+
| **Previous TX locking script** | **Script** | **\<script length>-many bytes** |
8282

8383
## Backward compatibility
8484

0 commit comments

Comments
 (0)