1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Add coding style to contributing guide

This commit is contained in:
Pratik Naik 2009-05-20 23:44:38 +02:00
parent dfcc3e2f89
commit 8ba4307bf7

View file

@ -161,7 +161,7 @@ h4. Fork the Rails Source Code
Fork Rails. Youre not going to put your patches right into the master branch, OK? This is where you need that copy of Rails that you cloned earlier. Think of a name for your new branch and run
<shell>
git checkout -b my_new_branch
git checkout -b my_new_branch
</shell>
It doesnt really matter what name you use, because this branch will only exist on your local computer.
@ -175,6 +175,15 @@ Now get busy and add your code to Rails (or edit the existing code). Youre on
* Include tests that fail without your code, and pass with it
* Update the documentation
h4. Follow the Coding Conventions
Rails follows a simple set of coding style conventions.
* Two spaces, no tabs
* Prefer +&&+/+||+ over +and+/+or+
* +MyClass.my_method(my_arg)+ not +my_method( my_arg )+ or +my_method my_arg+
* Follow the conventions you see used in the source already
h4. Sanity Check
You should not be the only person who looks at the code before you submit it. You know at least one other Rails developer, right? Show them what youre doing and ask for feedback. Doing this in private before you push a patch out publicly is the “smoke test” for a patch: if you cant convince one other developer of the beauty of your code, youre unlikely to convince the core team either.