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