github.com/xeptore/docker-cli@v20.10.14+incompatible/CONTRIBUTING.md (about)

     1  # Contributing to Docker
     2  
     3  Want to hack on Docker? Awesome!  We have a contributor's guide that explains
     4  [setting up a Docker development environment and the contribution
     5  process](https://docs.docker.com/opensource/project/who-written-for/). 
     6  
     7  This page contains information about reporting issues as well as some tips and
     8  guidelines useful to experienced open source contributors. Finally, make sure
     9  you read our [community guidelines](#docker-community-guidelines) before you
    10  start participating.
    11  
    12  ## Topics
    13  
    14  * [Reporting Security Issues](#reporting-security-issues)
    15  * [Design and Cleanup Proposals](#design-and-cleanup-proposals)
    16  * [Reporting Issues](#reporting-other-issues)
    17  * [Quick Contribution Tips and Guidelines](#quick-contribution-tips-and-guidelines)
    18  * [Community Guidelines](#docker-community-guidelines)
    19  
    20  ## Reporting security issues
    21  
    22  The Docker maintainers take security seriously. If you discover a security
    23  issue, please bring it to their attention right away!
    24  
    25  Please **DO NOT** file a public issue, instead send your report privately to
    26  [security@docker.com](mailto:security@docker.com).
    27  
    28  Security reports are greatly appreciated and we will publicly thank you for it.
    29  We also like to send gifts—if you're into Docker schwag, make sure to let
    30  us know. We currently do not offer a paid security bounty program, but are not
    31  ruling it out in the future.
    32  
    33  
    34  ## Reporting other issues
    35  
    36  A great way to contribute to the project is to send a detailed report when you
    37  encounter an issue. We always appreciate a well-written, thorough bug report,
    38  and will thank you for it!
    39  
    40  Check that [our issue database](https://github.com/docker/cli/issues)
    41  doesn't already include that problem or suggestion before submitting an issue.
    42  If you find a match, you can use the "subscribe" button to get notified on
    43  updates. Do *not* leave random "+1" or "I have this too" comments, as they
    44  only clutter the discussion, and don't help resolving it. However, if you
    45  have ways to reproduce the issue or have additional information that may help
    46  resolving the issue, please leave a comment.
    47  
    48  When reporting issues, always include:
    49  
    50  * The output of `docker version`.
    51  * The output of `docker info`.
    52  
    53  Also include the steps required to reproduce the problem if possible and
    54  applicable. This information will help us review and fix your issue faster.
    55  When sending lengthy log-files, consider posting them as a gist (https://gist.github.com).
    56  Don't forget to remove sensitive data from your logfiles before posting (you can
    57  replace those parts with "REDACTED").
    58  
    59  ## Quick contribution tips and guidelines
    60  
    61  This section gives the experienced contributor some tips and guidelines.
    62  
    63  ### Pull requests are always welcome
    64  
    65  Not sure if that typo is worth a pull request? Found a bug and know how to fix
    66  it? Do it! We will appreciate it. Any significant improvement should be
    67  documented as [a GitHub issue](https://github.com/docker/cli/issues) before
    68  anybody starts working on it.
    69  
    70  We are always thrilled to receive pull requests. We do our best to process them
    71  quickly. If your pull request is not accepted on the first try,
    72  don't get discouraged! Our contributor's guide explains [the review process we
    73  use for simple changes](https://docs.docker.com/opensource/workflow/make-a-contribution/).
    74  
    75  ### Talking to other Docker users and contributors
    76  
    77  <table class="tg">
    78    <col width="45%">
    79    <col width="65%">
    80    <tr>
    81      <td>Forums</td>
    82      <td>
    83        A public forum for users to discuss questions and explore current design patterns and
    84        best practices about Docker and related projects in the Docker Ecosystem. To participate,
    85        just log in with your Docker Hub account on <a href="https://forums.docker.com" target="_blank">https://forums.docker.com</a>.
    86      </td>
    87    </tr>
    88    <tr>
    89      <td>Community Slack</td>
    90      <td>
    91        The Docker Community has a dedicated Slack chat to discuss features and issues.  You can sign-up <a href="https://dockr.ly/slack" target="_blank">with this link</a>.
    92      </td>
    93    </tr>
    94    <tr>
    95      <td>Twitter</td>
    96      <td>
    97        You can follow <a href="https://twitter.com/docker/" target="_blank">Docker's Twitter feed</a>
    98        to get updates on our products. You can also tweet us questions or just
    99        share blogs or stories.
   100      </td>
   101    </tr>
   102    <tr>
   103      <td>Stack Overflow</td>
   104      <td>
   105        Stack Overflow has over 17000 Docker questions listed. We regularly
   106        monitor <a href="https://stackoverflow.com/search?tab=newest&q=docker" target="_blank">Docker questions</a>
   107        and so do many other knowledgeable Docker users.
   108      </td>
   109    </tr>
   110  </table>
   111  
   112  
   113  ### Conventions
   114  
   115  Fork the repository and make changes on your fork in a feature branch:
   116  
   117  - If it's a bug fix branch, name it XXXX-something where XXXX is the number of
   118      the issue. 
   119  - If it's a feature branch, create an enhancement issue to announce
   120      your intentions, and name it XXXX-something where XXXX is the number of the
   121      issue.
   122  
   123  Submit unit tests for your changes. Go has a great test framework built in; use
   124  it! Take a look at existing tests for inspiration. [Run the full test
   125  suite](README.md) on your branch before
   126  submitting a pull request.
   127  
   128  Update the documentation when creating or modifying features. Test your
   129  documentation changes for clarity, concision, and correctness, as well as a
   130  clean documentation build. See our contributors guide for [our style
   131  guide](https://docs.docker.com/opensource/doc-style) and instructions on [building
   132  the documentation](https://docs.docker.com/opensource/project/test-and-docs/#build-and-test-the-documentation).
   133  
   134  Write clean code. Universally formatted code promotes ease of writing, reading,
   135  and maintenance. Always run `gofmt -s -w file.go` on each changed file before
   136  committing your changes. Most editors have plug-ins that do this automatically.
   137  
   138  Pull request descriptions should be as clear as possible and include a reference
   139  to all the issues that they address.
   140  
   141  Commit messages must start with a capitalized and short summary (max. 50 chars)
   142  written in the imperative, followed by an optional, more detailed explanatory
   143  text which is separated from the summary by an empty line.
   144  
   145  Code review comments may be added to your pull request. Discuss, then make the
   146  suggested modifications and push additional commits to your feature branch. Post
   147  a comment after pushing. New commits show up in the pull request automatically,
   148  but the reviewers are notified only when you comment.
   149  
   150  Pull requests must be cleanly rebased on top of master without multiple branches
   151  mixed into the PR.
   152  
   153  **Git tip**: If your PR no longer merges cleanly, use `rebase master` in your
   154  feature branch to update your pull request rather than `merge master`.
   155  
   156  Before you make a pull request, squash your commits into logical units of work
   157  using `git rebase -i` and `git push -f`. A logical unit of work is a consistent
   158  set of patches that should be reviewed together: for example, upgrading the
   159  version of a vendored dependency and taking advantage of its now available new
   160  feature constitute two separate units of work. Implementing a new function and
   161  calling it in another file constitute a single logical unit of work. The very
   162  high majority of submissions should have a single commit, so if in doubt: squash
   163  down to one.
   164  
   165  After every commit, make sure the test suite passes. Include documentation
   166  changes in the same pull request so that a revert would remove all traces of
   167  the feature or fix.
   168  
   169  Include an issue reference like `Closes #XXXX` or `Fixes #XXXX` in the pull request
   170  description that close an issue. Including references automatically closes the issue
   171  on a merge.
   172  
   173  Please do not add yourself to the `AUTHORS` file, as it is regenerated regularly
   174  from the Git history.
   175  
   176  Please see the [Coding Style](#coding-style) for further guidelines.
   177  
   178  ### Merge approval
   179  
   180  Docker maintainers use LGTM (Looks Good To Me) in comments on the code review to
   181  indicate acceptance.
   182  
   183  A change requires LGTMs from an absolute majority of the maintainers of each
   184  component affected. For example, if a change affects `docs/` and `registry/`, it
   185  needs an absolute majority from the maintainers of `docs/` AND, separately, an
   186  absolute majority of the maintainers of `registry/`.
   187  
   188  For more details, see the [MAINTAINERS](MAINTAINERS) page.
   189  
   190  ### Sign your work
   191  
   192  The sign-off is a simple line at the end of the explanation for the patch. Your
   193  signature certifies that you wrote the patch or otherwise have the right to pass
   194  it on as an open-source patch. The rules are pretty simple: if you can certify
   195  the below (from [developercertificate.org](http://developercertificate.org/)):
   196  
   197  ```
   198  Developer Certificate of Origin
   199  Version 1.1
   200  
   201  Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
   202  660 York Street, Suite 102,
   203  San Francisco, CA 94110 USA
   204  
   205  Everyone is permitted to copy and distribute verbatim copies of this
   206  license document, but changing it is not allowed.
   207  
   208  Developer's Certificate of Origin 1.1
   209  
   210  By making a contribution to this project, I certify that:
   211  
   212  (a) The contribution was created in whole or in part by me and I
   213      have the right to submit it under the open source license
   214      indicated in the file; or
   215  
   216  (b) The contribution is based upon previous work that, to the best
   217      of my knowledge, is covered under an appropriate open source
   218      license and I have the right under that license to submit that
   219      work with modifications, whether created in whole or in part
   220      by me, under the same open source license (unless I am
   221      permitted to submit under a different license), as indicated
   222      in the file; or
   223  
   224  (c) The contribution was provided directly to me by some other
   225      person who certified (a), (b) or (c) and I have not modified
   226      it.
   227  
   228  (d) I understand and agree that this project and the contribution
   229      are public and that a record of the contribution (including all
   230      personal information I submit with it, including my sign-off) is
   231      maintained indefinitely and may be redistributed consistent with
   232      this project or the open source license(s) involved.
   233  ```
   234  
   235  Then you just add a line to every git commit message:
   236  
   237      Signed-off-by: Joe Smith <joe.smith@email.com>
   238  
   239  Use your real name (sorry, no pseudonyms or anonymous contributions.)
   240  
   241  If you set your `user.name` and `user.email` git configs, you can sign your
   242  commit automatically with `git commit -s`.
   243  
   244  ### How can I become a maintainer?
   245  
   246  The procedures for adding new maintainers are explained in the 
   247  global [MAINTAINERS](https://github.com/docker/opensource/blob/master/MAINTAINERS)
   248  file in the [https://github.com/docker/opensource/](https://github.com/docker/opensource/)
   249  repository.
   250  
   251  Don't forget: being a maintainer is a time investment. Make sure you
   252  will have time to make yourself available. You don't have to be a
   253  maintainer to make a difference on the project!
   254  
   255  ## Docker community guidelines
   256  
   257  We want to keep the Docker community awesome, growing and collaborative. We need
   258  your help to keep it that way. To help with this we've come up with some general
   259  guidelines for the community as a whole:
   260  
   261  * Be nice: Be courteous, respectful and polite to fellow community members:
   262    no regional, racial, gender, or other abuse will be tolerated. We like
   263    nice people way better than mean ones!
   264  
   265  * Encourage diversity and participation: Make everyone in our community feel
   266    welcome, regardless of their background and the extent of their
   267    contributions, and do everything possible to encourage participation in
   268    our community.
   269  
   270  * Keep it legal: Basically, don't get us in trouble. Share only content that
   271    you own, do not share private or sensitive information, and don't break
   272    the law.
   273  
   274  * Stay on topic: Make sure that you are posting to the correct channel and
   275    avoid off-topic discussions. Remember when you update an issue or respond
   276    to an email you are potentially sending to a large number of people. Please
   277    consider this before you update. Also remember that nobody likes spam.
   278  
   279  * Don't send email to the maintainers: There's no need to send email to the
   280    maintainers to ask them to investigate an issue or to take a look at a
   281    pull request. Instead of sending an email, GitHub mentions should be
   282    used to ping maintainers to review a pull request, a proposal or an
   283    issue.
   284  
   285  ### Guideline violations — 3 strikes method
   286  
   287  The point of this section is not to find opportunities to punish people, but we
   288  do need a fair way to deal with people who are making our community suck.
   289  
   290  1. First occurrence: We'll give you a friendly, but public reminder that the
   291     behavior is inappropriate according to our guidelines.
   292  
   293  2. Second occurrence: We will send you a private message with a warning that
   294     any additional violations will result in removal from the community.
   295  
   296  3. Third occurrence: Depending on the violation, we may need to delete or ban
   297     your account.
   298  
   299  **Notes:**
   300  
   301  * Obvious spammers are banned on first occurrence. If we don't do this, we'll
   302    have spam all over the place.
   303  
   304  * Violations are forgiven after 6 months of good behavior, and we won't hold a
   305    grudge.
   306  
   307  * People who commit minor infractions will get some education, rather than
   308    hammering them in the 3 strikes process.
   309  
   310  * The rules apply equally to everyone in the community, no matter how much
   311      you've contributed.
   312  
   313  * Extreme violations of a threatening, abusive, destructive or illegal nature
   314      will be addressed immediately and are not subject to 3 strikes or forgiveness.
   315  
   316  * Contact abuse@docker.com to report abuse or appeal violations. In the case of
   317      appeals, we know that mistakes happen, and we'll work with you to come up with a
   318      fair solution if there has been a misunderstanding.
   319  
   320  ## Coding Style
   321  
   322  Unless explicitly stated, we follow all coding guidelines from the Go
   323  community. While some of these standards may seem arbitrary, they somehow seem
   324  to result in a solid, consistent codebase.
   325  
   326  It is possible that the code base does not currently comply with these
   327  guidelines. We are not looking for a massive PR that fixes this, since that
   328  goes against the spirit of the guidelines. All new contributions should make a
   329  best effort to clean up and make the code base better than they left it.
   330  Obviously, apply your best judgement. Remember, the goal here is to make the
   331  code base easier for humans to navigate and understand. Always keep that in
   332  mind when nudging others to comply.
   333  
   334  The rules:
   335  
   336  1. All code should be formatted with `gofmt -s`.
   337  2. All code should pass the default levels of
   338     [`golint`](https://github.com/golang/lint).
   339  3. All code should follow the guidelines covered in [Effective
   340     Go](http://golang.org/doc/effective_go.html) and [Go Code Review
   341     Comments](https://github.com/golang/go/wiki/CodeReviewComments).
   342  4. Comment the code. Tell us the why, the history and the context.
   343  5. Document _all_ declarations and methods, even private ones. Declare
   344     expectations, caveats and anything else that may be important. If a type
   345     gets exported, having the comments already there will ensure it's ready.
   346  6. Variable name length should be proportional to its context and no longer.
   347     `noCommaALongVariableNameLikeThisIsNotMoreClearWhenASimpleCommentWouldDo`.
   348     In practice, short methods will have short variable names and globals will
   349     have longer names.
   350  7. No underscores in package names. If you need a compound name, step back,
   351     and re-examine why you need a compound name. If you still think you need a
   352     compound name, lose the underscore.
   353  8. No utils or helpers packages. If a function is not general enough to
   354     warrant its own package, it has not been written generally enough to be a
   355     part of a util package. Just leave it unexported and well-documented.
   356  9. All tests should run with `go test` and outside tooling should not be
   357     required. No, we don't need another unit testing framework. Assertion
   358     packages are acceptable if they provide _real_ incremental value.
   359  10. Even though we call these "rules" above, they are actually just
   360      guidelines. Since you've read all the rules, you now know that.
   361  
   362  If you are having trouble getting into the mood of idiomatic Go, we recommend
   363  reading through [Effective Go](https://golang.org/doc/effective_go.html). The
   364  [Go Blog](https://blog.golang.org) is also a great resource. Drinking the
   365  kool-aid is a lot easier than going thirsty.