1
- Contributing to LNP/BP projects
2
- ===============================
1
+ Contributing guidelines
2
+ =======================
3
3
4
- :+1 ::tada :
5
- First and foremost, thanks for taking the time to contribute!
6
- :tada ::+1 :
7
-
8
- The following is a set of guidelines for contributing to [ LNP/BP Standards
9
- Association] ( https://lnp-bp.org ) projects, which are hosted in the GitHub
10
- organizations listed in [ readme] ( https://github.com/LNP-BP#Working-groups ) .
11
- These are mostly guidelines, not rules. Use your best judgment, and feel free to
12
- propose changes to this document in a pull request.
4
+ Contributions are very welcome. When contributing code, please follow these
5
+ simple guidelines.
13
6
14
7
#### Table Of Contents
15
- - [ General] ( #general )
16
- - [ Communication channels] ( #communication-channels )
17
- - [ Asking questions] ( #asking-questions )
18
8
- [ Contribution workflow] ( #contribution-workflow )
9
+ * [ Proposing changes] ( #proposing-changes )
19
10
* [ Preparing PRs] ( #preparing-prs )
20
11
* [ Peer review] ( #peer-review )
21
12
- [ Coding conventions] ( #coding-conventions )
22
13
- [ Security] ( #security )
23
14
- [ Testing] ( #testing )
24
15
- [ Going further] ( #going-further )
25
16
17
+ Overview
18
+ --------
26
19
27
- General
28
- -------
29
- The LNP/BP projects operate an open contributor model where anyone is welcome to
30
- contribute towards development in the form of peer review, documentation,
31
- testing and patches.
32
-
33
- Anyone is invited to contribute without regard to technical experience,
34
- "expertise", OSS experience, age, or other concern. However, the development of
35
- standards & reference implementations demands a high-level of rigor, adversarial
36
- thinking, thorough testing and risk-minimization. Any bug may cost users real
37
- money. That being said, we deeply welcome people contributing for the first time
38
- to an open source project or pick up Rust while contributing. Don't be shy,
39
- you'll learn.
40
-
41
- Communications Channels
42
- -----------------------
43
- Communication about LNP/BP standards & implementations happens primarily
44
- on #lnp-pb IRC chat on Freenode with the logs available at
45
- < http://gnusha.org/lnp-bp/ >
46
-
47
- Discussion about code base improvements happens in GitHub issues and on pull
48
- requests.
49
-
50
- Major projects are tracked [ here] ( https://github.com/orgs/LNP-BP/projects ) .
51
- Project roadmap is tracked in each repository GitHub milestones.
20
+ * Before adding any code dependencies, check with the maintainers if this is okay.
21
+ * Write properly formatted comments: they should be English sentences, eg:
52
22
53
- Asking Questions
54
- ----------------
55
- > ** Note:** Please don't file an issue to ask a question. Each repository - or
56
- > GitHub organization has a "Discussions" with Q&A section; please post your
57
- > questions there. You'll get faster results by using this channel.
23
+ // Return the current UNIX time.
58
24
59
- Alternatively, we have a dedicated developer channel on IRC, #
[email protected]
60
- where you may get helpful advice if you have questions.
25
+ * Read the DCO and make sure all commits are signed off, using ` git commit -s ` .
26
+ * Follow the guidelines when proposing code changes (see below).
27
+ * Write properly formatted git commits (see below).
28
+ * Run the tests with ` cargo test --workspace --all-features ` .
29
+ * Make sure you run ` rustfmt ` on your code (see below details).
30
+ * Please don't file an issue to ask a question. Each repository - or
31
+ GitHub organization has a "Discussions" with Q&A section; please post your
32
+ questions there. You'll get faster results by using this channel.
61
33
62
34
Contribution Workflow
63
35
---------------------
@@ -67,39 +39,49 @@ facilitates social contribution, easy testing and peer review.
67
39
68
40
To contribute a patch, the workflow is a as follows:
69
41
70
- 1 . Fork Repository
71
- 2 . Create topic branch
72
- 3 . Commit patches
42
+ 1 . Fork Repository
43
+ 2 . Create topic branch
44
+ 3 . Commit patches
73
45
74
- In general commits should be atomic and diffs should be easy to read. For this
75
- reason do not mix any formatting fixes or code moves with actual code changes.
76
- Further, each commit, individually, should compile and pass tests, in order to
46
+ In general commits should be atomic and diffs should be easy to read. For this
47
+ reason do not mix any formatting fixes or code moves with actual code changes.
48
+ Further, each commit, individually, should compile and pass tests, in order to
77
49
ensure git bisect and other automated tools function properly.
78
50
79
- When adding a new feature thought must be given to the long term technical debt.
51
+ When adding a new feature thought must be given to the long term technical debt.
80
52
Every new features should be covered by unit tests.
81
53
82
54
When refactoring, structure your PR to make it easy to review and don't hesitate
83
55
to split it into multiple small, focused PRs.
84
56
85
- The Minimal Supported Rust Version is nightly for the period of active
86
- development; it is enforced by our Travis. Later we plan to fix to some specific
87
- Rust version after the initial library release.
88
-
89
57
Commits should cover both the issue fixed and the solution's rationale.
90
- These [ guidelines] ( https://chris.beams.io/posts/git-commit/ ) should be kept in
58
+ These [ guidelines] ( https://chris.beams.io/posts/git-commit/ ) should be kept in
91
59
mind.
92
60
93
- To facilitate communication with other contributors, the project is making use
94
- of GitHub's "assignee" field. First check that no one is assigned and then
95
- comment suggesting that you're working on it. If someone is already assigned,
96
- don't hesitate to ask if the assigned party or previous commenters are still
61
+ To facilitate communication with other contributors, the project is making use
62
+ of GitHub's "assignee" field. First check that no one is assigned and then
63
+ comment suggesting that you're working on it. If someone is already assigned,
64
+ don't hesitate to ask if the assigned party or previous commenters are still
97
65
working on it if it has been awhile.
98
66
67
+ ### Proposing changes
68
+
69
+ When proposing changes via a pull-request or patch:
70
+
71
+ * Isolate changes in separate commits to make the review process easier.
72
+ * Don't make unrelated changes, unless it happens to be an obvious improvement to
73
+ code you are touching anyway ("boyscout rule").
74
+ * Rebase on ` master ` when needed.
75
+ * Keep your changesets small, specific and uncontroversial, so that they can be
76
+ merged more quickly.
77
+ * If the change is substantial or requires re-architecting certain parts of the
78
+ codebase, write a proposal in English first, and get consensus on that before
79
+ proposing the code changes.
80
+
99
81
### Preparing PRs
100
82
101
- The main library development happens in the ` master ` branch. This branch must
102
- always compile without errors (using Travis CI). All external contributions are
83
+ The main library development happens in the ` master ` branch. This branch must
84
+ always compile without errors (using Travis CI). All external contributions are
103
85
made within PRs into this branch.
104
86
105
87
Prerequisites that a PR must satisfy for merging into the ` master ` branch:
@@ -122,20 +104,60 @@ Additionally, to the `master` branch some repositories may have `develop` branch
122
104
for any experimental developments. This branch may not compile and should not be
123
105
used by any projects depending on the library.
124
106
107
+ ### Writing Git commit messages
108
+
109
+ A properly formed git commit subject line should always be able to complete the
110
+ following sentence:
111
+
112
+ If applied, this commit will _____
113
+
114
+ In addition, it should be capitalized and * must not* include a period.
115
+
116
+ For example, the following message is well formed:
117
+
118
+ Add support for .gif files
119
+
120
+ While these ones are ** not** : ` Adding support for .gif files ` ,
121
+ ` Added support for .gif files ` .
122
+
123
+ When it comes to formatting, here's a model git commit message[ 1] :
124
+
125
+ Capitalized, short (50 chars or less) summary
126
+
127
+ More detailed explanatory text, if necessary. Wrap it to about 72
128
+ characters or so. In some contexts, the first line is treated as the
129
+ subject of an email and the rest of the text as the body. The blank
130
+ line separating the summary from the body is critical (unless you omit
131
+ the body entirely); tools like rebase can get confused if you run the
132
+ two together.
133
+
134
+ Write your commit message in the imperative: "Fix bug" and not "Fixed bug"
135
+ or "Fixes bug." This convention matches up with commit messages generated
136
+ by commands like git merge and git revert.
137
+
138
+ Further paragraphs come after blank lines.
139
+
140
+ - Bullet points are okay, too.
141
+
142
+ - Typically a hyphen or asterisk is used for the bullet, followed by a
143
+ single space, with blank lines in between, but conventions vary here.
144
+
145
+ - Use a hanging indent.
146
+
125
147
### Peer review
126
148
127
149
Anyone may participate in peer review which is expressed by comments in the pull
128
150
request. Typically reviewers will review the code for obvious errors, as well as
129
151
test out the patch set and opine on the technical merits of the patch. PR should
130
- be reviewed first on the conceptual level before focusing on code style or
152
+ be reviewed first on the conceptual level before focusing on code style or
131
153
grammar fixes.
132
154
133
155
Coding Conventions
134
156
------------------
135
- Our CI enforces [ clippy's] ( https://github.com/rust-lang/rust-clippy )
157
+ Our CI enforces [ clippy's] ( https://github.com/rust-lang/rust-clippy )
136
158
[ default linting] ( https://rust-lang.github.io/rust-clippy/rust-1.52.0/index.html )
137
159
and [ rustfmt] ( https://github.com/rust-lang/rustfmt ) formatting defined by rules
138
- in [ .rustfmt.toml] ( ./.rustfmt.toml ) . The linter should be run with current
160
+ in [ .rustfmt.toml] ( ./.rustfmt.toml ) . The linter should be run with current
139
161
stable rust compiler, while formatter requires nightly version due to the use of
140
162
unstable formatting parameters.
141
163
@@ -150,35 +172,25 @@ cargo +nightly fmt --all
150
172
151
173
Security
152
174
--------
153
- Security is the primary focus of LNP/BP libraries; disclosure of security
154
- vulnerabilities helps prevent user loss of funds. If you believe a vulnerability
155
- may affect other implementations, please inform them. Guidelines for a
156
- responsible disclosure can be found in [ SECURITY.md] ( ./SECURITY.md ) file in the
157
- project root.
158
-
159
- Note that some of LNP/BP projects are currently considered "pre-production".
160
- Such projects can be distinguished by the absence of ` SECURITY.md ` . In such
161
- cases there are no special handling of security issues; please simply open
175
+ Responsible disclosure of security vulnerabilities helps prevent user loss of
176
+ privacy. If you believe a vulnerability may affect other implementations, please
177
+ inform them. Guidelines for a responsible disclosure can be found in
178
+ [ SECURITY.md] ( ./SECURITY.md ) file in the project root.
179
+
180
+ Note that some of our projects are currently considered "pre-production".
181
+ Such projects can be distinguished by the absence of ` SECURITY.md ` . In such
182
+ cases there are no special handling of security issues; please simply open
162
183
an issue on GitHub.
163
184
164
- Testing
165
- -------
166
- Related to the security aspect, LNP/BP developers take testing very seriously.
167
- Due to the modular nature of the project, writing new functional tests is easy
168
- and good test coverage of the codebase is an important goal.
169
-
170
- Fuzzing is heavily encouraged: feel free to add related material under ` fuzz/ `
171
-
172
- Mutation testing is planned; any contribution there would be warmly welcomed.
173
-
174
185
Going further
175
186
-------------
176
- You may be interested in Jon Atack guide on
187
+ You may be interested in Jon Atack guide on
177
188
[ How to review Bitcoin Core PRs] [ Review ] and [ How to make Bitcoin Core PRs] [ PR ] .
178
- While there are differences between the projects in terms of context and
189
+ While there are differences between the projects in terms of context and
179
190
maturity, many of the suggestions offered apply to this project.
180
191
181
192
Overall, have fun :)
182
193
194
+ [ 1 ] : http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
183
195
[ Review ] : https://github.com/jonatack/bitcoin-development/blob/master/how-to-review-bitcoin-core-prs.md
184
196
[ PR ] : https://github.com/jonatack/bitcoin-development/blob/master/how-to-make-bitcoin-core-prs.md
0 commit comments