1# Contributing to Phoenix 2 3Please take a moment to review this document in order to make the contribution 4process easy and effective for everyone involved! 5Also make sure you read our [Code of Conduct](CODE_OF_CONDUCT.md) that outlines our commitment towards an open and welcoming environment. 6 7## Using the issue tracker 8 9Use the issues tracker for: 10 11* [bug reports](#bug-reports) 12* [submitting pull requests](#pull-requests) 13 14Please **do not** use the issue tracker for personal support requests nor feature requests. Support requests should be sent to: 15 16* [the phoenix-talk mailing list](http://groups.google.com/group/phoenix-talk) 17* **[#elixir-lang](irc://chat.freenode.net/elixir-lang)** IRC channel on [chat.freenode.net](http://www.freenode.net/) 18 19Development issues can be discussed on [the phoenix-core mailing list](http://groups.google.com/group/phoenix-core). 20 21We do our best to keep the issue tracker tidy and organized, making it useful 22for everyone. For example, we classify open issues per perceived difficulty, 23making it easier for developers to [contribute to Phoenix](#pull-requests). 24 25## Bug reports 26 27A bug is a _demonstrable problem_ that is caused by the code in the repository. 28Good bug reports are extremely helpful - thank you! 29 30Guidelines for bug reports: 31 321. **Use the GitHub issue search** — check if the issue has already been 33 reported. 34 352. **Check if the issue has been fixed** — try to reproduce it using the 36 `master` branch in the repository. 37 383. **Isolate and report the problem** — ideally create a reduced test 39 case. 40 41Please try to be as detailed as possible in your report. Include information about 42your Operating System, as well as your Erlang, Elixir and Phoenix versions. Please provide steps to 43reproduce the issue as well as the outcome you were expecting! All these details 44will help developers to fix any potential bugs. 45 46Example: 47 48> Short and descriptive example bug report title 49> 50> A summary of the issue and the environment in which it occurs. If suitable, 51> include the steps required to reproduce the bug. 52> 53> 1. This is the first step 54> 2. This is the second step 55> 3. Further steps, etc. 56> 57> `<url>` - a link to the reduced test case (e.g. a GitHub Gist) 58> 59> Any other information you want to share that is relevant to the issue being 60> reported. This might include the lines of code that you have identified as 61> causing the bug, and potential solutions (and your opinions on their 62> merits). 63 64## Feature requests 65 66Feature requests are welcome and should be discussed on [the phoenix-core mailing list](http://groups.google.com/group/phoenix-core). But take a moment to find 67out whether your idea fits with the scope and aims of the project. It's up to *you* 68to make a strong case to convince the community of the merits of this feature. 69Please provide as much detail and context as possible. 70 71## Contributing Documentation 72 73Code documentation (`@doc`, `@moduledoc`, `@typedoc`) has a special convention: 74the first paragraph is considered to be a short summary. 75 76For functions, macros and callbacks say what it will do. For example write 77something like: 78 79```elixir 80@doc """ 81Marks the given value as HTML safe. 82""" 83def safe({:safe, value}), do: {:safe, value} 84``` 85 86For modules, protocols and types say what it is. For example write 87something like: 88 89```elixir 90defmodule Phoenix.HTML do 91 @moduledoc """ 92 Conveniences for working HTML strings and templates. 93 ... 94 """ 95``` 96 97Keep in mind that the first paragraph might show up in a summary somewhere, long 98texts in the first paragraph create very ugly summaries. As a rule of thumb 99anything longer than 80 characters is too long. 100 101Try to keep unnecessary details out of the first paragraph, it's only there to 102give a user a quick idea of what the documented "thing" does/is. The rest of the 103documentation string can contain the details, for example when a value and when 104`nil` is returned. 105 106If possible include examples, preferably in a form that works with doctests. 107This makes it easy to test the examples so that they don't go stale and examples 108are often a great help in explaining what a function does. 109 110## Pull requests 111 112Good pull requests - patches, improvements, new features - are a fantastic 113help. They should remain focused in scope and avoid containing unrelated 114commits. 115 116**IMPORTANT**: By submitting a patch, you agree that your work will be 117licensed under the license used by the project. 118 119If you have any large pull request in mind (e.g. implementing features, 120refactoring code, etc), **please ask first** otherwise you risk spending 121a lot of time working on something that the project's developers might 122not want to merge into the project. 123 124Please adhere to the coding conventions in the project (indentation, 125accurate comments, etc.) and don't forget to add your own tests and 126documentation. When working with git, we recommend the following process 127in order to craft an excellent pull request: 128 1291. [Fork](https://help.github.com/articles/fork-a-repo/) the project, clone your fork, 130 and configure the remotes: 131 132 ```bash 133 # Clone your fork of the repo into the current directory 134 git clone https://github.com/<your-username>/phoenix 135 # Navigate to the newly cloned directory 136 cd phoenix 137 # Assign the original repo to a remote called "upstream" 138 git remote add upstream https://github.com/phoenixframework/phoenix 139 ``` 140 1412. If you cloned a while ago, get the latest changes from upstream, and update your fork: 142 143 ```bash 144 git checkout master 145 git pull upstream master 146 git push 147 ``` 148 1493. Create a new topic branch (off of `master`) to contain your feature, change, 150 or fix. 151 152 **IMPORTANT**: Making changes in `master` is discouraged. You should always 153 keep your local `master` in sync with upstream `master` and make your 154 changes in topic branches. 155 156 ```bash 157 git checkout -b <topic-branch-name> 158 ``` 159 1604. Commit your changes in logical chunks. Keep your commit messages organized, 161 with a short description in the first line and more detailed information on 162 the following lines. Feel free to use Git's 163 [interactive rebase](https://help.github.com/articles/about-git-rebase/) 164 feature to tidy up your commits before making them public. 165 1665. Make sure all the tests are still passing. 167 168 ```bash 169 mix test 170 ``` 171 1726. Push your topic branch up to your fork: 173 174 ```bash 175 git push origin <topic-branch-name> 176 ``` 177 1787. [Open a Pull Request](https://help.github.com/articles/about-pull-requests/) 179 with a clear title and description. 180 1818. If you haven't updated your pull request for a while, you should consider 182 rebasing on master and resolving any conflicts. 183 184 **IMPORTANT**: _Never ever_ merge upstream `master` into your branches. You 185 should always `git rebase` on `master` to bring your changes up to date when 186 necessary. 187 188 ```bash 189 git checkout master 190 git pull upstream master 191 git checkout <your-topic-branch> 192 git rebase master 193 ``` 194 195Thank you for your contributions! 196