github.com/kaituanwang/hyperledger@v2.0.1+incompatible/docs/source/CONTRIBUTING.rst (about)

     1  .. note:: Users who are migrating from Gerrit to GitHub: You can follow simple
     2            Git workflows to move your development from Gerrit to GitHub. After
     3            forking the Fabric repo, simply push the branches you want to save from
     4            your current Gerrit-based local repo to your remote forked repository.
     5            Once you've pushed the changes you want to save, simply delete your
     6            local Gerrit-based repository and clone your fork.
     7  
     8            For a basic Git workflow recommendation please see our doc at
     9            :doc:`github/github`.
    10  
    11  Contributions Welcome!
    12  ======================
    13  
    14  We welcome contributions to Hyperledger in many forms, and
    15  there's always plenty to do!
    16  
    17  First things first, please review the Hyperledger `Code of
    18  Conduct <https://wiki.hyperledger.org/community/hyperledger-project-code-of-conduct>`__
    19  before participating. It is important that we keep things civil.
    20  
    21  Ways to contribute
    22  ------------------
    23  There are many ways you can contribute to Hyperledger Fabric, both as a user and
    24  as a developer.
    25  
    26  As a user:
    27  
    28  - `Making Feature/Enhancement Proposals`_
    29  - `Reporting bugs`_
    30  - Help test an upcoming Epic on the
    31    `release roadmap <https://jira.hyperledger.org/secure/Dashboard.jspa?selectPageId=10104>`_.
    32    Contact the Epic assignee via the Jira work item or on
    33    `RocketChat <https://chat.hyperledger.org>`_.
    34  
    35  As a developer:
    36  
    37  - If you only have a little time, consider picking up a
    38    `"help-wanted" <https://jira.hyperledger.org/issues/?filter=10147>`_ task,
    39    see `Fixing issues and working stories`_.
    40  - If you can commit to full-time development, either propose a new feature
    41    (see `Making Feature/Enhancement Proposals`_) and
    42    bring a team to implement it, or join one of the teams working on an existing Epic.
    43    If you see an Epic that interests you on the
    44    `release roadmap <https://jira.hyperledger.org/secure/Dashboard.jspa?selectPageId=10104>`_,
    45    contact the Epic assignee via the Jira work item or on `RocketChat <https://chat.hyperledger.org/>`_.
    46  
    47  Getting a Linux Foundation account
    48  ----------------------------------
    49  
    50  In order to participate in the development of the Hyperledger Fabric
    51  project, you will need a Linux Foundation
    52  account. Once you have a LF ID you will be able to
    53  access all the Hyperledger community tools, including
    54  `Jira issue management <https://jira.hyperledger.org>`__,
    55  `RocketChat <https://chat.hyperledger.org/>`__, and the
    56  `Wiki <https://wiki.hyperledger.org/display/fabric/Hyperledger+Fabric>`__ (for editing, only).
    57  
    58  Follow the steps below to create a Linux Foundation account if you don't
    59  already have one.
    60  
    61  1. Go to the `Linux Foundation ID
    62     website <https://identity.linuxfoundation.org/>`__.
    63  
    64  2. Select the option ``I need to create a Linux Foundation ID``, and fill
    65     out the form that appears.
    66  
    67  3. Wait a few minutes, then look for an email message with the subject line:
    68     "Validate your Linux Foundation ID email".
    69  
    70  4. Open the received URL to validate your email address.
    71  
    72  5. Verify that your browser displays the message
    73     ``You have successfully validated your e-mail address``.
    74  
    75  6. Access `Jira issue management <https://jira.hyperledger.org>`__, or
    76     `RocketChat <https://chat.hyperledger.org/>`__.
    77  
    78  Project Governance
    79  ------------------
    80  
    81  Hyperledger Fabric is managed under an open governance model as described in
    82  our `charter <https://www.hyperledger.org/about/charter>`__. Projects and
    83  sub-projects are lead by a set of maintainers. New sub-projects can
    84  designate an initial set of maintainers that will be approved by the
    85  top-level project's existing maintainers when the project is first
    86  approved.
    87  
    88  Maintainers
    89  ~~~~~~~~~~~
    90  
    91  The Fabric project is lead by the project's top level `maintainers <https://github.com/hyperledger/fabric/blob/master/MAINTAINERS.md>`__.
    92  The maintainers are responsible for reviewing and merging all patches submitted
    93  for review, and they guide the overall technical direction of the project within
    94  the guidelines established by the Hyperledger Technical Steering Committee (TSC).
    95  
    96  Becoming a maintainer
    97  ~~~~~~~~~~~~~~~~~~~~~
    98  
    99  The project's maintainers will, from time-to-time, consider
   100  adding or removing a maintainer. An existing maintainer can submit a
   101  change set to the `maintainers <https://github.com/hyperledger/fabric/blob/master/MAINTAINERS.md>`__ file. A nominated
   102  Contributor may become a Maintainer by a majority approval of the proposal
   103  by the existing Maintainers. Once approved, the change set is then merged
   104  and the individual is added to (or alternatively, removed from) the maintainers
   105  group. Maintainers may be removed by explicit resignation, for prolonged
   106  inactivity (3 or more months), or for some infraction of the `code of conduct
   107  <https://wiki.hyperledger.org/community/hyperledger-project-code-of-conduct>`__
   108  or by consistently demonstrating poor judgement. A maintainer removed for
   109  inactivity should be restored following a sustained resumption of contributions
   110  and reviews (a month or more) demonstrating a renewed commitment to the project.
   111  
   112  Release cadence
   113  ~~~~~~~~~~~~~~~
   114  
   115  The Fabric maintainers have settled on a quarterly (approximately) release
   116  cadence (see `releases <https://github.com/hyperledger/fabric#releases>`__).
   117  At any given time, there will be a stable LTS (long term support) release branch,
   118  as well as the master branch for upcoming new features.
   119  Follow the discussion on the #fabric-release channel in RocketChat.
   120  
   121  Making Feature/Enhancement Proposals
   122  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   123  
   124  First, take time to review
   125  `JIRA <https://jira.hyperledger.org/issues/?filter=12524>`__
   126  to be sure that there isn't already an open (or recently closed) proposal for the
   127  same function. If there isn't, to make a proposal we recommend that you open a
   128  JIRA Epic or Story, whichever seems to best fit the circumstance and
   129  link or inline a "one pager" of the proposal that states what the feature would
   130  do and, if possible, how it might be implemented. It would help also to make a
   131  case for why the feature should be added, such as identifying specific use
   132  case(s) for which the feature is needed and a case for what the benefit would be
   133  should the feature be implemented. Once the JIRA issue is created, and the
   134  "one pager" either attached, inlined in the description field, or a link to a
   135  publicly accessible document is added to the description, send an introductory
   136  email to the fabric@lists.hyperledger.org mailing list linking the
   137  JIRA issue, and soliciting feedback.
   138  
   139  Discussion of the proposed feature should be conducted in the JIRA issue itself,
   140  so that we have a consistent pattern within our community as to where to find
   141  design discussion.
   142  
   143  Getting the support of three or more of the Hyperledger Fabric maintainers for
   144  the new feature will greatly enhance the probability that the feature's related
   145  PRs will be included in a subsequent release.
   146  
   147  Maintainers meeting
   148  ~~~~~~~~~~~~~~~~~~~
   149  
   150  The maintainers hold regular maintainers meetings.
   151  The purpose of the maintainers meeting is to plan for and review the progress of
   152  releases, and to discuss the technical and operational direction of the project
   153  and sub-projects.
   154  
   155  Please see the
   156  `wiki <https://wiki.hyperledger.org/display/fabric/Maintainer+Meetings>`__
   157  for maintainer meeting details.
   158  
   159  New feature/enhancement proposals as described above should be presented to a
   160  maintainers meeting for consideration, feedback and acceptance.
   161  
   162  Release roadmap
   163  ~~~~~~~~~~~~~~~
   164  
   165  The Fabric release roadmap of epics is maintained in
   166  `JIRA <https://jira.hyperledger.org/secure/Dashboard.jspa?selectPageId=10104>`__.
   167  
   168  Communications
   169  ~~~~~~~~~~~~~~
   170  
   171  We use `RocketChat <https://chat.hyperledger.org/>`__ for communication
   172  and Google Hangouts™ for screen sharing between developers. Our
   173  development planning and prioritization is done in
   174  `JIRA <https://jira.hyperledger.org>`__, and we take longer running
   175  discussions/decisions to the `mailing
   176  list <https://lists.hyperledger.org/mailman/listinfo/hyperledger-fabric>`__.
   177  
   178  Contribution guide
   179  ------------------
   180  
   181  Install prerequisites
   182  ~~~~~~~~~~~~~~~~~~~~~
   183  
   184  Before we begin, if you haven't already done so, you may wish to check that
   185  you have all the :doc:`prerequisites <prereqs>` installed on the platform(s)
   186  on which you'll be developing blockchain applications and/or operating
   187  Hyperledger Fabric.
   188  
   189  Getting help
   190  ~~~~~~~~~~~~
   191  
   192  If you are looking for something to work on, or need some expert
   193  assistance in debugging a problem or working out a fix to an issue, our
   194  `community <https://www.hyperledger.org/community>`__ is always eager to
   195  help. We hang out on
   196  `Chat <https://chat.hyperledger.org/channel/fabric/>`__, IRC
   197  (#hyperledger on freenode.net) and the `mailing
   198  lists <https://lists.hyperledger.org/>`__. Most of us don't bite :grin:
   199  and will be glad to help. The only silly question is the one you don't
   200  ask. Questions are in fact a great way to help improve the project as
   201  they highlight where our documentation could be clearer.
   202  
   203  Reporting bugs
   204  ~~~~~~~~~~~~~~
   205  
   206  If you are a user and you have found a bug, please submit an issue using
   207  `JIRA <https://jira.hyperledger.org/secure/Dashboard.jspa?selectPageId=10104>`__.
   208  Before you create a new JIRA issue, please try to search the existing items to
   209  be sure no one else has previously reported it. If it has been previously
   210  reported, then you might add a comment that you also are interested in seeing
   211  the defect fixed.
   212  
   213  .. note:: If the defect is security-related, please follow the Hyperledger
   214            `security bug reporting process <https://wiki.hyperledger.org/display/HYP/Defect+Response>`__.
   215  
   216  If it has not been previously reported, you may either submit a PR with a
   217  well documented commit message describing the defect and the fix, or you 
   218  may create a new JIRA. Please try to provide
   219  sufficient information for someone else to reproduce the
   220  issue. One of the project's maintainers should respond to your issue within 24
   221  hours. If not, please bump the issue with a comment and request that it be
   222  reviewed. You can also post to the relevant Hyperledger Fabric channel in
   223  `Hyperledger Chat <https://chat.hyperledger.org>`__.  For example, a doc bug should
   224  be broadcast to ``#fabric-documentation``, a database bug to ``#fabric-ledger``,
   225  and so on...
   226  
   227  Submitting your fix
   228  ~~~~~~~~~~~~~~~~~~~
   229  
   230  If you just submitted a JIRA for a bug you've discovered, and would like to
   231  provide a fix, we would welcome that gladly! Please assign the JIRA issue to
   232  yourself, then submit a pull request (PR). Please refer to :doc:`github/github`
   233  for a detailed workflow.
   234  
   235  Fixing issues and working stories
   236  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   237  
   238  Review the `issues
   239  list <https://jira.hyperledger.org/issues/?filter=10580>`__ and find
   240  something that interests you. You could also check the
   241  `"help-wanted" <https://jira.hyperledger.org/issues/?filter=10147>`__
   242  list. It is wise to start with something relatively straight forward and
   243  achievable, and that no one is already assigned. If no one is assigned,
   244  then assign the issue to yourself. Please be considerate and rescind the
   245  assignment if you cannot finish in a reasonable time, or add a comment
   246  saying that you are still actively working the issue if you need a
   247  little more time.
   248  
   249  Reviewing submitted Pull Requests (PRs)
   250  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   251  
   252  Another way to contribute and learn about Hyperledger Fabric is to help the
   253  maintainers with the review of the PRs that are open. Indeed
   254  maintainers have the difficult role of having to review all the PRs
   255  that are being submitted and evaluate whether they should be merged or
   256  not. You can review the code and/or documentation changes, test the
   257  changes, and tell the submitters and maintainers what you think. Once
   258  your review and/or test is complete just reply to the PR with your
   259  findings, by adding comments and/or voting. A comment saying something
   260  like "I tried it on system X and it works" or possibly "I got an error
   261  on system X: xxx " will help the maintainers in their evaluation. As a
   262  result, maintainers will be able to process PRs faster and everybody
   263  will gain from it.
   264  
   265  Just browse through `the open PRs on GitHub
   266  <https://github.com/hyperledger/fabric/pulls>`__ to get started.
   267  
   268  PR Aging
   269  ~~~~~~~~
   270  
   271  As the Fabric project has grown, so too has the backlog of open PRs. One
   272  problem that nearly all projects face is effectively managing that backlog
   273  and Fabric is no exception. In an effort to keep the backlog of Fabric and
   274  related project PRs manageable, we are introducing an aging policy which
   275  will be enforced by bots.  This is consistent with how other large projects
   276  manage their PR backlog.
   277  
   278  PR Aging Policy
   279  ~~~~~~~~~~~~~~~
   280  
   281  The Fabric project maintainers will automatically monitor all PR activity for
   282  delinquency. If a PR has not been updated in 2 weeks, a reminder comment will be
   283  added requesting that the PR either be updated to address any outstanding
   284  comments or abandoned if it is to be withdrawn. If a delinquent PR goes another
   285  2 weeks without an update, it will be automatically abandoned. If a PR has aged
   286  more than 2 months since it was originally submitted, even if it has activity,
   287  it will be flagged for maintainer review.
   288  
   289  If a submitted PR has passed all validation but has not been reviewed in 72
   290  hours (3 days), it will be flagged to the #fabric-pr-review channel daily until
   291  it receives a review comment(s).
   292  
   293  This policy applies to all official Fabric projects (fabric, fabric-ca,
   294  fabric-samples, fabric-test, fabric-sdk-node, fabric-sdk-java, fabric-gateway-java,
   295  fabric-chaincode-node, fabric-chaincode-java, fabric-chaincode-evm,
   296  fabric-baseimage, and fabric-amcl).
   297  
   298  Setting up development environment
   299  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   300  
   301  Next, try :doc:`building the project <dev-setup/build>` in your local
   302  development environment to ensure that everything is set up correctly.
   303  
   304  What makes a good pull request?
   305  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   306  
   307  -  One change at a time. Not five, not three, not ten. One and only one.
   308     Why? Because it limits the blast area of the change. If we have a
   309     regression, it is much easier to identify the culprit commit than if
   310     we have some composite change that impacts more of the code.
   311  
   312  -  Include a link to the JIRA story for the change. Why? Because a) we
   313     want to track our velocity to better judge what we think we can
   314     deliver and when and b) because we can justify the change more
   315     effectively. In many cases, there should be some discussion around a
   316     proposed change and we want to link back to that from the change
   317     itself.
   318  
   319  -  Include unit and integration tests (or changes to existing tests)
   320     with every change. This does not mean just happy path testing,
   321     either. It also means negative testing of any defensive code that it
   322     correctly catches input errors. When you write code, you are
   323     responsible to test it and provide the tests that demonstrate that
   324     your change does what it claims. Why? Because without this we have no
   325     clue whether our current code base actually works.
   326  
   327  -  Unit tests should have NO external dependencies. You should be able
   328     to run unit tests in place with ``go test`` or equivalent for the
   329     language. Any test that requires some external dependency (e.g. needs
   330     to be scripted to run another component) needs appropriate mocking.
   331     Anything else is not unit testing, it is integration testing by
   332     definition. Why? Because many open source developers do Test Driven
   333     Development. They place a watch on the directory that invokes the
   334     tests automagically as the code is changed. This is far more
   335     efficient than having to run a whole build between code changes. See
   336     `this definition <http://artofunittesting.com/definition-of-a-unit-test/>`__
   337     of unit testing for a good set of criteria to keep in mind for writing
   338     effective unit tests.
   339  
   340  -  Minimize the lines of code per PR. Why? Maintainers have day jobs,
   341     too. If you send a 1,000 or 2,000 LOC change, how long do you think
   342     it takes to review all of that code? Keep your changes to < 200-300
   343     LOC, if possible. If you have a larger change, decompose it into
   344     multiple independent changes. If you are adding a bunch of new
   345     functions to fulfill the requirements of a new capability, add them
   346     separately with their tests, and then write the code that uses them
   347     to deliver the capability. Of course, there are always exceptions. If
   348     you add a small change and then add 300 LOC of tests, you will be
   349     forgiven;-) If you need to make a change that has broad impact or a
   350     bunch of generated code (protobufs, etc.). Again, there can be
   351     exceptions.
   352  
   353  .. note:: Large pull requests, e.g. those with more than 300 LOC are more than likely
   354            not going to receive an approval, and you'll be asked to refactor
   355            the change to conform with this guidance.
   356  
   357  -  Write a meaningful commit message. Include a meaningful 55 (or less)
   358     character title, followed by a blank line, followed by a more
   359     comprehensive description of the change. Each change MUST include the JIRA
   360     identifier corresponding to the change (e.g. [FAB-1234]). This can be
   361     in the title but should also be in the body of the commit message.
   362  
   363  .. note:: Example commit message:
   364  
   365            ::
   366  
   367                [FAB-1234] fix foobar() panic
   368  
   369                Fix [FAB-1234] added a check to ensure that when foobar(foo string)
   370                is called, that there is a non-empty string argument.
   371  
   372  Finally, be responsive. Don't let a pull request fester with review
   373  comments such that it gets to a point that it requires a rebase. It only
   374  further delays getting it merged and adds more work for you - to
   375  remediate the merge conflicts.
   376  
   377  Legal stuff
   378  -----------
   379  
   380  **Note:** Each source file must include a license header for the Apache
   381  Software License 2.0. See the template of the `license header
   382  <https://github.com/hyperledger/fabric/blob/master/docs/source/dev-setup/headers.txt>`__.
   383  
   384  We have tried to make it as easy as possible to make contributions. This
   385  applies to how we handle the legal aspects of contribution. We use the
   386  same approach—the `Developer's Certificate of Origin 1.1
   387  (DCO) <https://github.com/hyperledger/fabric/blob/master/docs/source/DCO1.1.txt>`__—that the Linux® Kernel
   388  `community <https://elinux.org/Developer_Certificate_Of_Origin>`__ uses
   389  to manage code contributions.
   390  
   391  We simply ask that when submitting a patch for review, the developer
   392  must include a sign-off statement in the commit message.
   393  
   394  Here is an example Signed-off-by line, which indicates that the
   395  submitter accepts the DCO:
   396  
   397  ::
   398  
   399      Signed-off-by: John Doe <john.doe@example.com>
   400  
   401  You can include this automatically when you commit a change to your
   402  local git repository using ``git commit -s``.
   403  
   404  Related Topics
   405  --------------
   406  
   407  .. toctree::
   408     :maxdepth: 1
   409  
   410     MAINTAINERS
   411     jira_navigation
   412     dev-setup/devenv
   413     dev-setup/build
   414     testing
   415     style-guides/go-style
   416  
   417  .. Licensed under Creative Commons Attribution 4.0 International License
   418     https://creativecommons.org/licenses/by/4.0/