github.com/osdi23p228/fabric@v0.0.0-20221218062954-77808885f5db/docs/source/CONTRIBUTING.rst (about)

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