Coding Standards » History » Version 14

Toshi MARUYAMA, 2013-01-15 06:21
add link to "Contributing to Ruby on Rails" : "5.3 Follow the Coding Conventions"

1 1 Eric Davis
h1. Coding Standards
2 7 Felix Schäfer
3 7 Felix Schäfer
{{>toc}}
4 1 Eric Davis
5 5 Felix Schäfer
h2. Ruby and Rails Code
6 1 Eric Davis
7 14 Toshi MARUYAMA
TODO: until then, follow the basic Ruby and "Rails standards":http://guides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions.
8 1 Eric Davis
9 13 Jean-Baptiste Barth
* *Views*
10 13 Jean-Baptiste Barth
** use @blank? / present?@ instead of @empty? / any? / nil?@ when it doesn't affect code readability
11 13 Jean-Baptiste Barth
12 5 Felix Schäfer
h2. Javascript
13 4 Ariel Skrodzki
14 5 Felix Schäfer
TODO
15 1 Eric Davis
16 5 Felix Schäfer
h2. CSS
17 1 Eric Davis
18 5 Felix Schäfer
TODO
19 1 Eric Davis
20 5 Felix Schäfer
h2. Documentation
21 1 Eric Davis
22 9 Deon Joubert
Document you methods as needed and make sure any complex code is explained (e.g. regular expression parsing).  If it can't be understood 7 days later, it won't be understood next year and will need to be rewritten.
23 5 Felix Schäfer
24 5 Felix Schäfer
h2. Tests
25 5 Felix Schäfer
26 8 Graham King
Make sure any new code is tested, especially in the Controllers and Models.  Code without tests may (and probably will) be rejected on that reason alone.  Redmine is a very complex application with a lot of authentication and authorization code, so it's vital that changes are tested fully. Please don't take any offense from this hard stance, protecting everyone's data and trust in the system is very important.
27 12 Toshi MARUYAMA
28 5 Felix Schäfer
h2. Commits
29 5 Felix Schäfer
30 5 Felix Schäfer
Commits should be formatted as below.  If you are contributed via git, this will save the committer a bunch of time:
31 5 Felix Schäfer
32 1 Eric Davis
<pre>
33 5 Felix Schäfer
Short summary of your commit, 72 characters. #nnnn
34 5 Felix Schäfer
35 5 Felix Schäfer
(This is optional) Longer description of the change, including a 
36 5 Felix Schäfer
list of what changed if it's a major change. Limit each line to 72
37 5 Felix Schäfer
characters and use basic textile (* for lists). 
38 11 smith jackson
39 5 Felix Schäfer
Contributed by Your Name
40 5 Felix Schäfer
</pre>