Contributing: improve formatting section

This commit is contained in:
Dr Maxim Orlovsky 2022-01-10 12:12:59 +01:00
parent 78d1a82769
commit 313ac7d4a8
1 changed files with 7 additions and 20 deletions

View File

@ -173,31 +173,18 @@ preferred to "how it looks in Core" if everyone agrees.
### Formatting ### Formatting
We plan to utilize `rustfmt` for keeping the code formatting consistent. The repository currently does not use `rustfmt`.
However, this will be a gradual process since a thorough peer review is required
to make sure that no unintended changes are introduced with the change of
formatting. Thus, all PRs introducing large blocks of re-formatted code will not
be reviewed.
The current plan is to phase it in over multiple commits or even multiple PRs, New changes may format the code with `rustfmt`, but they should not re-format
which will introduce no changes other than re-formatting, such that each change any existing code for maintaining diff size small, keeping `git blame` intact and
may be independently re-reproduced by each reviewer. The first commit should add reduce review time. All PRs introducing large blocks of re-formatted code will
attributes to disable fmt for some parts of the code and a second one does the not be reviewed.
formatting so only the first one needs review, the rest will be reproducible.
You may check the [discussion on the formatting](https://github.com/rust-bitcoin/rust-bitcoin/issues/172) You may check the [discussion on the formatting](https://github.com/rust-bitcoin/rust-bitcoin/issues/172)
and [how it is planned to coordinate it with crate refactoring](https://github.com/rust-bitcoin/rust-bitcoin/pull/525) and [how it is planned to coordinate it with crate refactoring](https://github.com/rust-bitcoin/rust-bitcoin/pull/525)
Before formatting with `rustfmt` is implemented, it is recommended to follow For the new code it is recommended to follow style of the existing codebase and
style of the existing codebase and avoid any end-line space characters. avoid any end-line space characters.
<!--
Rust-fmt should be used as a coding style recommendations in general, with a
default coding style. By default, Rustfmt uses a style which conforms to the
[Rust style guide][style guide] that has been formalized through the [style RFC
process][fmt rfcs]. It is also required to run `cargo fmt` to make the code
formatted according to `rustfmt` parameters
-->
### Derivation ### Derivation