Developer Review¶
Part to copy for push to Dev QA
Migrations (No duplicate numbers, class names) -
Code Indentation and Style (2 spaces + formatted) -
Naming (meaningfull method names, ! ?) -
Structure and Length (no long methods, light controllers, repeated code)-
Javascript Checks (JSLint, Global, Namespacing) -
Unit Tests -
HTML and CSS (IE6, IE7, FF)-
SQL (ansi, capitals, indentation) -
Checklist¶
1. Style
Have you followed the coding style guide for all of your javascript, html, css, js and ruby?
2. Naming
Do your method names and attribute names convey meaning?
If a method alters or modifies something you should consider ending the method with ! remove_all_units!
if it's a method that returns true or false it should end with a question mark is_allowed?
3. Structure and length
Have you got long methods, do they need to be separated out into smaller easy to manage chunks?
Have you moved methods up to models where possible?
Are there repeated chunks that should be refactored into a single function?
4. Comments for hard or odd bits
Have you done something weird that's going to confuse one of the other coders, put in quick comments to explain why.
Are your comments in english? Does the english make sense or do you need to get it checked?
5. Javascript
Have you run your code and passed through JSLint?
Have you ensured that your not polluting the global namespace.
Are your functions in namespaced appropriately (i.e. the order me a coffee functions are all in SomeNamespace.CoffeeOrdering = {}
Are all of your function names in camel case?
6. Unit tests
Does your code have sufficient unit test coverage where appropriate?
7. HTML / CSS
Does it work and look good in IE6 / IE7 /FF / Safari (Where possible and necessary to test)
Ensure that there are no inline styles (unless absolutely necessary)
Is your html formatted
8. SQL
Are all of your sql statements in capital letters?
9. Ansi Standard Joins
Have you used Ansi-Standard joins and ensured that your table joins are separated from your where clauses.
e.g.
The Code Style Guide¶
The developer review is to ensure high quality, maintainable readable code. Each developer should "review" the code themselves before submitting it, but it needs to cover the following aspects:
1. Code indentation and style.
Is the entire file you submitted neat, indented (2 spaces) and formatted correctly?
Ruby¶
Spacing
2 Spaces for every piece of indented code
Comments
Comments should the follow the styles in:
http://rdoc.sourceforge.net/doc/index.html
In short
# Calculates some_code by using bla and some other business rule
some_code = bla + 1
and
# Test to see if a new word contains the same
# letters as the original
def is_anagram?(text)
@initial_letters == letters_of(text)
end
If the functionality is not obvious, there needs to be a comment describing what it does in English. If you think your English is wrong, then you can just ask someone else to review it for you.
Spacing between functions
use
a = 1
not
a=1
Lining functions up
use
dog = 1
cattle = 2
something_else = 3
not
dog=1
cattle=2
something_else=3
Comments should use the rubydoc styles shown at
Javascript¶
Function calls should be:
this.foo(bar);
Not
this.foo (bar);
The space differentiates them from method invocations.
Control statements should be:
// space between if and parentheses
if (something == x) {
doSomethingElse();
} else { // else on same line as close and open braces
doSomethingNice();
}
//space between switch and parentheses
switch (x) {
case 'y' :
return 'something';
break;
case 'n' :
return 'somethingElse';
break;
}
//space between for and parentheses
for (var i=0; i<n; i++) {
...
}
Conditions and assignments should have spaces ( except maybe in for loop declarations
)
Use:
if (x == y) {
...
}
y = x;
Not
if (x==y) {
...
}
y=x;
HTML Formatting (2 spaces)¶
<div>
<ul>
<li><a href="bla.html">something</a></li>
</ul>
<p>Some Paragarph</p>
<p>Some other paragraph</p>
</div>
CSS Formatting (2 spaces)¶
#something {
border: 1px solid red;
color: green}
#something a {
font-weight: bold;}
#something div {
background-color: red;}
.some_other_class {
border: none;}
.some_other_class {
border: 1px solid blue;}
Javascript¶
The majority of javascript should be stored in separate files, which group functionality together. E.g. the functionality for a page.
The javascript should be namespaced and not pollute the global namaspace.
Only very small inline javascript should exist. E.g.
<% js do %>
Prohost.admin_page.init(<%= @init.to_json %>);
<% end %>
h2. SQL Formatting Note:
* Capital Letters for SQL keywords
* Line everything up
Instead of:
SELECT *
FROM table_a, table_b, table_c
WHERE table_a.id = table_b.foreign_key_id and
table_a.desc LIKE '%hello%' and
table_c.foreign_key_id = table_a.id (+)
Format it like this:
SELECT *
FROM table_a
JOIN table_b ON table_b.foreign_key_id = table_a.id
LEFT JOIN table_c ON table_c.foreign_key_id = table_a.id
WHERE table_a.desc LIKE '%hello%'
分享到:
相关推荐
在软件开发过程中,保持代码的一致性和可读性至关重要,这就是Eclipse中的CodeStyle和CheckStyle功能的价值所在。这两项工具允许开发者定义和遵循统一的编码规范,从而提高团队合作效率,减少因为代码风格不一致导致...
IDEA Code Style Xml.zip是一个压缩包,其中包含了用于配置IntelliJ IDEA代码样式的XML文件。IntelliJ IDEA是一款流行的Java集成开发环境(IDE),它提供了丰富的功能来帮助开发者高效编码。代码风格是编程实践中...
在软件开发过程中,代码规范和CodeStyle扮演着至关重要的角色。它们不仅有助于提高代码的可读性和一致性,还能促进团队间的协作效率,降低维护成本。本文将深入探讨代码规范及CodeStyle的使用,并结合提供的文档资源...
eclipse配置代码格式的codestyle.xml文件,在Eclipse或MyEclipse中点击Window -> Preferences菜单,点击左侧的“Java”->“Code Style”->Formatter中import即可
"Eclipse Codestyle和Format"是指Eclipse中用于规范代码风格和自动格式化的功能。通过定制和应用这些设置,开发者可以确保整个项目中的代码保持一致性和可读性。 1. **Eclipse Codestyle**: - Codestyle,又称为...
CodeStyle配置文件是用来规定代码格式化的规则,帮助开发者遵循一定的编码规范,提高团队间的代码可读性和维护性。本篇文章将详细讲解`CodeFormatter.xml`和`codetemplates.xml`这两个配置文件以及相关的配置文档。 ...
MyEclipse code style
eclipse开发android,代码标准...1、Preference->Java->Code Style->Formatter->Import->添加android-formatting.xml文件 2、Preference->Java->Code Style->Organize Imports->Import->添加android.importorder文件
"idea-codestyle-hook-plugin"正是一款专为解决此问题而设计的开源插件,它可以在提交代码时自动应用项目所设定的代码样式,确保每一行代码都符合团队规范。 首先,让我们理解一下代码样式的重要性。代码样式是编程...
Node.js编程-Sublime Code Style
MyEclipse Java code style 注释模板 xml 很通用的注释模板 操作方法: windows->Preferences->Java ->code style 导入xml文件即可 添加注释的快捷键是alt+shfit+J
提升java代码的可读行,规范行。该模板严格按照代码的缩进原则进行编写。 使用方法:1 在eclipse中选中一个工程,右键单击->propertys->java code style->formatter->import->导入该xml文件
Eclipse Code Formatter xml
android studio修改code style文件
eclipse 里 ctrl + shift + f的 Project — Properties - Java Code Style - Formatter
1. **PEP 8: Python Code Style Guide**:PEP 8 是Python官方推荐的代码风格指南,它提供了一系列关于如何编写清晰、一致的Python代码的指导原则。例如,使用空格来分隔操作符和括号,避免使用过于复杂的表达式等。 ...
Google的Java编码规范 This document serves as the ...code in the Java™ Programming Language. A Java source file is described as being in Google Style if and only if it adheres to the rules herein.
导入之后,仅需要改下tab的大小即可。
as格式化code
很好的一款代码检测规格文件,常见的代码书写bug或者不合理的地方都会提示,