Blame CONTRIBUTING.md

Packit Service 7c31a4
# CONTRIBUTING
Packit Service 7c31a4
Packit Service 7c31a4
The libuv project welcomes new contributors. This document will guide you
Packit Service 7c31a4
through the process.
Packit Service 7c31a4
Packit Service 7c31a4
Packit Service 7c31a4
### FORK
Packit Service 7c31a4
Packit Service 7c31a4
Fork the project [on GitHub](https://github.com/libuv/libuv) and check out
Packit Service 7c31a4
your copy.
Packit Service 7c31a4
Packit Service 7c31a4
```
Packit Service 7c31a4
$ git clone https://github.com/username/libuv.git
Packit Service 7c31a4
$ cd libuv
Packit Service 7c31a4
$ git remote add upstream https://github.com/libuv/libuv.git
Packit Service 7c31a4
```
Packit Service 7c31a4
Packit Service 7c31a4
Now decide if you want your feature or bug fix to go into the master branch
Packit Service 7c31a4
or the stable branch.  As a rule of thumb, bug fixes go into the stable branch
Packit Service 7c31a4
while new features go into the master branch.
Packit Service 7c31a4
Packit Service 7c31a4
The stable branch is effectively frozen; patches that change the libuv
Packit Service 7c31a4
API/ABI or affect the run-time behavior of applications get rejected.
Packit Service 7c31a4
Packit Service 7c31a4
In case of doubt, open an issue in the [issue tracker][], post your question
Packit Service 7c31a4
to the [libuv mailing list], or contact one of [project maintainers][] on [IRC][].
Packit Service 7c31a4
Packit Service 7c31a4
Especially do so if you plan to work on something big.  Nothing is more
Packit Service 7c31a4
frustrating than seeing your hard work go to waste because your vision
Packit Service 7c31a4
does not align with that of a project maintainers.
Packit Service 7c31a4
Packit Service 7c31a4
Packit Service 7c31a4
### BRANCH
Packit Service 7c31a4
Packit Service 7c31a4
Okay, so you have decided on the proper branch.  Create a feature branch
Packit Service 7c31a4
and start hacking:
Packit Service 7c31a4
Packit Service 7c31a4
```
Packit Service 7c31a4
$ git checkout -b my-feature-branch -t origin/v1.x
Packit Service 7c31a4
```
Packit Service 7c31a4
Packit Service 7c31a4
(Where v1.x is the latest stable branch as of this writing.)
Packit Service 7c31a4
Packit Service 7c31a4
### CODE
Packit Service 7c31a4
Packit Service 7c31a4
Please adhere to libuv's code style. In general it follows the conventions from
Packit Service 7c31a4
the [Google C/C++ style guide]. Some of the key points, as well as some
Packit Service 7c31a4
additional guidelines, are enumerated below.
Packit Service 7c31a4
Packit Service 7c31a4
* Code that is specific to unix-y platforms should be placed in `src/unix`, and
Packit Service 7c31a4
  declarations go into `include/uv/unix.h`.
Packit Service 7c31a4
Packit Service 7c31a4
* Source code that is Windows-specific goes into `src/win`, and related
Packit Service 7c31a4
  publicly exported types, functions and macro declarations should generally
Packit Service 7c31a4
  be declared in `include/uv/win.h`.
Packit Service 7c31a4
Packit Service 7c31a4
* Names should be descriptive and concise.
Packit Service 7c31a4
Packit Service 7c31a4
* All the symbols and types that libuv makes available publicly should be
Packit Service 7c31a4
  prefixed with `uv_` (or `UV_` in case of macros).
Packit Service 7c31a4
Packit Service 7c31a4
* Internal, non-static functions should be prefixed with `uv__`.
Packit Service 7c31a4
Packit Service 7c31a4
* Use two spaces and no tabs.
Packit Service 7c31a4
Packit Service 7c31a4
* Lines should be wrapped at 80 characters.
Packit Service 7c31a4
Packit Service 7c31a4
* Ensure that lines have no trailing whitespace, and use unix-style (LF) line
Packit Service 7c31a4
  endings.
Packit Service 7c31a4
Packit Service 7c31a4
* Use C89-compliant syntax. In other words, variables can only be declared at
Packit Service 7c31a4
  the top of a scope (function, if/for/while-block).
Packit Service 7c31a4
Packit Service 7c31a4
* When writing comments, use properly constructed sentences, including
Packit Service 7c31a4
  punctuation.
Packit Service 7c31a4
Packit Service 7c31a4
* When documenting APIs and/or source code, don't make assumptions or make
Packit Service 7c31a4
  implications about race, gender, religion, political orientation or anything
Packit Service 7c31a4
  else that isn't relevant to the project.
Packit Service 7c31a4
Packit Service 7c31a4
* Remember that source code usually gets written once and read often: ensure
Packit Service 7c31a4
  the reader doesn't have to make guesses. Make sure that the purpose and inner
Packit Service 7c31a4
  logic are either obvious to a reasonably skilled professional, or add a
Packit Service 7c31a4
  comment that explains it.
Packit Service 7c31a4
Packit Service 7c31a4
Packit Service 7c31a4
### COMMIT
Packit Service 7c31a4
Packit Service 7c31a4
Make sure git knows your name and email address:
Packit Service 7c31a4
Packit Service 7c31a4
```
Packit Service 7c31a4
$ git config --global user.name "J. Random User"
Packit Service 7c31a4
$ git config --global user.email "j.random.user@example.com"
Packit Service 7c31a4
```
Packit Service 7c31a4
Packit Service 7c31a4
Writing good commit logs is important.  A commit log should describe what
Packit Service 7c31a4
changed and why.  Follow these guidelines when writing one:
Packit Service 7c31a4
Packit Service 7c31a4
1. The first line should be 50 characters or less and contain a short
Packit Service 7c31a4
   description of the change prefixed with the name of the changed
Packit Service 7c31a4
   subsystem (e.g. "net: add localAddress and localPort to Socket").
Packit Service 7c31a4
2. Keep the second line blank.
Packit Service 7c31a4
3. Wrap all other lines at 72 columns.
Packit Service 7c31a4
Packit Service 7c31a4
A good commit log looks like this:
Packit Service 7c31a4
Packit Service 7c31a4
```
Packit Service 7c31a4
subsystem: explaining the commit in one line
Packit Service 7c31a4
Packit Service 7c31a4
Body of commit message is a few lines of text, explaining things
Packit Service 7c31a4
in more detail, possibly giving some background about the issue
Packit Service 7c31a4
being fixed, etc etc.
Packit Service 7c31a4
Packit Service 7c31a4
The body of the commit message can be several paragraphs, and
Packit Service 7c31a4
please do proper word-wrap and keep columns shorter than about
Packit Service 7c31a4
72 characters or so. That way `git log` will show things
Packit Service 7c31a4
nicely even when it is indented.
Packit Service 7c31a4
```
Packit Service 7c31a4
Packit Service 7c31a4
The header line should be meaningful; it is what other people see when they
Packit Service 7c31a4
run `git shortlog` or `git log --oneline`.
Packit Service 7c31a4
Packit Service 7c31a4
Check the output of `git log --oneline files_that_you_changed` to find out
Packit Service 7c31a4
what subsystem (or subsystems) your changes touch.
Packit Service 7c31a4
Packit Service 7c31a4
Packit Service 7c31a4
### REBASE
Packit Service 7c31a4
Packit Service 7c31a4
Use `git rebase` (not `git merge`) to sync your work from time to time.
Packit Service 7c31a4
Packit Service 7c31a4
```
Packit Service 7c31a4
$ git fetch upstream
Packit Service 7c31a4
$ git rebase upstream/v1.x  # or upstream/master
Packit Service 7c31a4
```
Packit Service 7c31a4
Packit Service 7c31a4
Packit Service 7c31a4
### TEST
Packit Service 7c31a4
Packit Service 7c31a4
Bug fixes and features should come with tests.  Add your tests in the
Packit Service 7c31a4
`test/` directory. Each new test needs to be registered in `test/test-list.h`.
Packit Service 7c31a4
Packit Service 7c31a4
If you add a new test file, it needs to be registered in three places:
Packit Service 7c31a4
- `CMakeLists.txt`: add the file's name to the `uv_test_sources` list.
Packit Service 7c31a4
- `Makefile.am`: add the file's name to the `test_run_tests_SOURCES` list.
Packit Service 7c31a4
Packit Service 7c31a4
Look at other tests to see how they should be structured (license boilerplate,
Packit Service 7c31a4
the way entry points are declared, etc.).
Packit Service 7c31a4
Packit Service 7c31a4
Check README.md file to find out how to run the test suite and make sure that
Packit Service 7c31a4
there are no test regressions.
Packit Service 7c31a4
Packit Service 7c31a4
### PUSH
Packit Service 7c31a4
Packit Service 7c31a4
```
Packit Service 7c31a4
$ git push origin my-feature-branch
Packit Service 7c31a4
```
Packit Service 7c31a4
Packit Service 7c31a4
Go to https://github.com/username/libuv and select your feature branch.  Click
Packit Service 7c31a4
the 'Pull Request' button and fill out the form.
Packit Service 7c31a4
Packit Service 7c31a4
Pull requests are usually reviewed within a few days.  If there are comments
Packit Service 7c31a4
to address, apply your changes in a separate commit and push that to your
Packit Service 7c31a4
feature branch.  Post a comment in the pull request afterwards; GitHub does
Packit Service 7c31a4
not send out notifications when you add commits.
Packit Service 7c31a4
Packit Service 7c31a4
Packit Service 7c31a4
[issue tracker]: https://github.com/libuv/libuv/issues
Packit Service 7c31a4
[libuv mailing list]: http://groups.google.com/group/libuv
Packit Service 7c31a4
[IRC]: http://webchat.freenode.net/?channels=libuv
Packit Service 7c31a4
[Google C/C++ style guide]: https://google.github.io/styleguide/cppguide.html
Packit Service 7c31a4
[project maintainers]: https://github.com/libuv/libuv/blob/master/MAINTAINERS.md