github.com/pingcap/br@v5.3.0-alpha.0.20220125034240-ec59c7b6ce30+incompatible/CONTRIBUTING.md (about)

     1  # How to contribute
     2  
     3  This document outlines some of the conventions on development workflow, commit
     4  message formatting, contact points and other resources to make it easier to get
     5  your contribution accepted.
     6  
     7  ## Getting started
     8  
     9  - Fork the repository on GitHub.
    10  - Read the README.md for build instructions.
    11  - Play with the project, submit bugs, submit patches!
    12  
    13  ## Building BR
    14  
    15  Developing BR requires:
    16  
    17  * [Go 1.16+](http://golang.org/doc/code.html)
    18  * An internet connection to download the dependencies
    19  
    20  Simply run `make` to build the program.
    21  
    22  ```sh
    23  make
    24  ```
    25  
    26  ### Running tests
    27  
    28  This project contains unit tests and integration tests with coverage collection.
    29  See [tests/README.md](./tests/README.md) for how to execute and add tests.
    30  
    31  ### Updating dependencies
    32  
    33  BR uses [Go 1.11 module](https://github.com/golang/go/wiki/Modules) to manage dependencies.
    34  To add or update a dependency: use the `go mod edit` command to change the dependency.
    35  
    36  ## Contribution flow
    37  
    38  This is a rough outline of what a contributor's workflow looks like:
    39  
    40  - Create a topic branch from where you want to base your work. This is usually `master`.
    41  - Make commits of logical units and add test case if the change fixes a bug or adds new functionality.
    42  - Run tests and make sure all the tests are passed.
    43  - Make sure your commit messages are in the proper format (see below).
    44  - Push your changes to a topic branch in your fork of the repository.
    45  - Submit a pull request.
    46  - Your PR must receive LGTMs from two maintainers.
    47  
    48  Thanks for your contributions!
    49  
    50  ### Code style
    51  
    52  The coding style suggested by the Golang community is used in BR.
    53  See the [style doc](https://github.com/golang/go/wiki/CodeReviewComments) for details.
    54  
    55  Please follow this style to make BR easy to review, maintain and develop.
    56  
    57  ### Format of the Commit Message
    58  
    59  We follow a rough convention for commit messages that is designed to answer two
    60  questions: what changed and why. The subject line should feature the what and
    61  the body of the commit should describe the why.
    62  
    63  ```
    64  restore: add comment for variable declaration
    65  
    66  Improve documentation.
    67  ```
    68  
    69  The format can be described more formally as follows:
    70  
    71  ```
    72  <subsystem>: <what changed>
    73  <BLANK LINE>
    74  <why this change was made>
    75  <BLANK LINE>
    76  <footer>(optional)
    77  ```
    78  
    79  The first line is the subject and should be no longer than 70 characters, the
    80  second line is always blank, and other lines should be wrapped at 80 characters.
    81  This allows the message to be easier to read on GitHub as well as in various
    82  git tools.
    83  
    84  If the change affects more than one subsystem, you can use comma to separate them like `backup,restore:`.
    85  
    86  If the change affects many subsystems, you can use ```*``` instead, like ```*:```.
    87  
    88  For the why part, if no specific reason for the change,
    89  you can use one of some generic reasons like "Improve documentation.",
    90  "Improve performance.", "Improve robustness.", "Improve test coverage."